Skip to content

feat: usage counter stories and basic UI#516

Merged
alashchev17 merged 15 commits intomainfrom
feat/usage-counters-for-messages
Feb 25, 2025
Merged

feat: usage counter stories and basic UI#516
alashchev17 merged 15 commits intomainfrom
feat/usage-counters-for-messages

Conversation

@alashchev17
Copy link
Member

@alashchev17 alashchev17 commented Feb 20, 2025

Feature: Usage counters for messages/chat threads

Description

  • What was the problem?
  • How did you solve it?
  • Any background context or related links?

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Refactoring (no functional changes, only code improvements)
  • Documentation update

How to Test

  • Step 1:
  • Step 2:
  • ...

Screenshots (if applicable)

image

Checklist

  • My code follows the code style of this project.
  • I have performed a self-review of my code.
  • I have commented my code, particularly in hard-to-understand areas.
  • I have added tests that prove my fix is effective or that my feature works.
  • New and existing unit tests pass locally with my changes.
  • Any dependent changes have been merged and published in downstream modules.
  • I have updated the documentation where necessary.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could move up a directory to src/components/UsageCounter ?

}

if (cur.delta.role === null || cur.finish_reason !== null) {
// saving usage if is assistant message and no delta role
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

okay so it's safe to remove the comments?

Copy link
Contributor

@MarcMcIntosh MarcMcIntosh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Left a few comments, I think the ChatContent directory has a few to many "components" in to so UsageCounter could be moved up to the components directory.

Also, it looks like the dev branch has been updated :)

@alashchev17 alashchev17 changed the base branch from main to dev February 24, 2025 17:29
@alashchev17 alashchev17 changed the base branch from dev to main February 24, 2025 17:42
@alashchev17 alashchev17 changed the base branch from main to dev February 24, 2025 18:34
@alashchev17 alashchev17 changed the base branch from dev to main February 24, 2025 18:34
@alashchev17 alashchev17 merged commit c7e90e9 into main Feb 25, 2025
2 checks passed
@alashchev17 alashchev17 deleted the feat/usage-counters-for-messages branch February 25, 2025 17:31
MDario123 pushed a commit that referenced this pull request Mar 6, 2025
* feat: usage counter stories and basic UI

* chore: fixed prettier check

* feat: saving usage to assistant message on stream & reasoning mode selection fix

* fix: stubs for usage counters, fixed stories and refactored UsageCounters

* chore: removed console.log

* feat: storing usage object for chat thread instead of for each assistant message & showing suggestion to open new chat, if prompt tokens are exceeding 30k limit boundary

* chore: better place for calculateInputTokens utility function

* refactoring(middleware): simplified chat response middleware

* chore: remove unused imports

* refactoring: remove duplicate code

* feat: calculating recommended maximum input limit based on model n_ctx

* fix: fix tests

* fix: moved UsageCounter to separate component modlet out of ChatContent scope, removed comments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants