Skip to content

Conversation

@mrubens
Copy link
Collaborator

@mrubens mrubens commented Mar 7, 2025

Context

One thing that's not clear in the context window progress bar is the amount of space that's reserved for the output tokens of the model. I've become particularly nervous about this since we let people extend their max tokens out to 128k tokens with the new thinking models. So, I think we should update the progress bar to give a visual hint about how much the output tokens are limiting their context.

Implementation

This PR computes the amount and percent of the context window that's reserved for output and displays it to the right of the input context.

Screenshots

before after
Screenshot 2025-03-07 at 3 13 10 PM Screenshot 2025-03-07 at 3 12 52 PM

Important

Add reserved output tokens display to context window progress bar with supporting logic and tests.

  • Feature:
    • Display reserved output tokens in context window progress bar in TaskHeader.tsx.
    • Use calculateTokenDistribution and getMaxTokensForModel from model-utils.ts.
  • Logic:
    • calculateTokenDistribution calculates token distribution percentages and sizes.
    • getMaxTokensForModel determines max tokens based on model and API config.
  • Tests:
    • Add ContextWindowProgress.test.tsx for rendering tests.
    • Add ContextWindowProgressLogic.test.ts for logic tests.
    • Add getMaxTokensForModel.test.tsx for utility function tests.

This description was created by Ellipsis for 671064a. It will automatically update as commits are pushed.

@changeset-bot
Copy link

changeset-bot bot commented Mar 7, 2025

⚠️ No Changeset found

Latest commit: 671064a

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@dosubot dosubot bot added the size:L This PR changes 100-499 lines, ignoring generated files. label Mar 7, 2025
Copy link
Collaborator

@cte cte left a comment

Choose a reason for hiding this comment

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

Wow - looks great!

@dosubot dosubot bot added lgtm This PR has been approved by a maintainer enhancement New feature or request labels Mar 7, 2025
@mrubens mrubens force-pushed the show_output_tokens branch from 5d47934 to c70d1ce Compare March 7, 2025 20:24
@mrubens mrubens force-pushed the show_output_tokens branch from c70d1ce to de47cab Compare March 7, 2025 20:30
@dosubot dosubot bot added size:XL This PR changes 500-999 lines, ignoring generated files. and removed size:L This PR changes 100-499 lines, ignoring generated files. labels Mar 7, 2025
@mrubens mrubens force-pushed the show_output_tokens branch from de47cab to 1246e99 Compare March 7, 2025 20:42
Copy link
Contributor

Choose a reason for hiding this comment

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

Several inline style objects (e.g., for the overlay divs) are repeated. Consider extracting these common styles into constants or CSS classes to improve maintainability.

@mrubens mrubens force-pushed the show_output_tokens branch from 1246e99 to a5f8f01 Compare March 7, 2025 21:04
@mrubens mrubens force-pushed the show_output_tokens branch from a5f8f01 to 671064a Compare March 7, 2025 21:13
@mrubens mrubens merged commit ec8145f into main Mar 7, 2025
9 checks passed
@mrubens mrubens deleted the show_output_tokens branch March 7, 2025 21:20
@github-project-automation github-project-automation bot moved this from New to Done in Roo Code Roadmap Mar 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request lgtm This PR has been approved by a maintainer size:XL This PR changes 500-999 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants