Repository navigation
feat: add context window usage to chat input - #12546
Closed
murillocamargo wants to merge 4 commits into
Closed
murillocamargo wants to merge 4 commits into
murillocamargo wants to merge 4 commits into
Conversation
Collaborator
|
Thanks for the PR. However, besides the basic UI features, this is not aligned to how we want to implement this, and it's token tracking will not accurately reflect the backend token accounting. In short, no additional tokenizer usage or awaiting database promises are necessary and there are more nuances to consider that are easily overlooked. The current approach will be off when attachments/tools/agent instructions are in play, let alone switching models, message trees, etc. If you're curious to investigate: https://github.com/danny-avila/agents |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds a live context tracker to the chat input so users can see context window usage directly while chatting, with a compact ring indicator and a hover card that breaks usage down into total, input, and output tokens.
This addresses #9543.
There was a previous draft attempt in #10958. This implementation reuses the general UI direction, but fixes the main stale-data problem: the context usage now updates after each chat response without requiring a conversation switch or full page refresh.
Implementation details:
ContextTrackercomponent to the chat inputDemo:
Change Type
Testing
Manual verification:
Test Configuration:
feat/context-trackermainChecklist