Skip to content

Context window chart #2516

Merged
kzsb03 merged 33 commits intodevfrom
context-management
Jan 26, 2026
Merged

Context window chart #2516
kzsb03 merged 33 commits intodevfrom
context-management

Conversation

@tevanburen
Copy link
Copy Markdown
Contributor

@tevanburen tevanburen commented Jan 12, 2026

Description

Add a context window for users to visualize memory usage via tokens used / tokens max.

Changes Made

  • Added pie chart to visualize % of memory usage
  • Added a new HoverCard component to the library
  • Enabled information display (HoverCard) for users to learn more about their memory usage.
  • Parse response of GetPlaygroundMessages to read # of tokens used on each message
  • Fetch and store # of tokens available for each model in chat.store
  • Context Window only shows if above 12.5% usage of memory

How to Test

To View Context Window: <12.5% Context Usage

  1. Go to Playground, choose an AI model of choice and send a chat (Ex. "hi")
  2. Since the context window only shows when a user uses more than 12.5%, your message should not trigger the context window component.

To View Context Window: >12.5% Context Usage

  1. To quickly view context window, lower token count (ex. 2000) within your AI model of choice via the .smss file in semoss/model. Find the command line CONTEXT_WINDOW and change the token count manually there.
  2. Restart your Eclipse server, then enable the same AI model of choice in Playground.
  3. Write a task to give your AI that would prompt it to use a larger token response (Ex. "Write a very long poem").
  4. Verify that Context Window component is visible and accurately displays amount of tokens used by hovering over pie chart graphic.

To View Context Window: >75% Context Usage

  1. Have your AI write another high-token output response (Ex. "Write an even longer poem") until your context window reaches above 75% usage.
  2. The Context Window component should turn colors to our destructive color (red) and accurately displays amount of tokens used by hovering over pie chart graphic.

Notes

hi doshi

@tevanburen tevanburen linked an issue Jan 12, 2026 that may be closed by this pull request
1 task
@tevanburen
Copy link
Copy Markdown
Contributor Author

tevanburen commented Jan 12, 2026

TODO:

  • Style the component correctly in context-chart.tsx (font, chart, logic for destructive)
  • Calculate the percentage correctly in room.tsx using Ryan's reactor
  • Have the chart only appear when >10%
  • Round numbers using ceil function
  • Add tooltip

@bbelledd bbelledd marked this pull request as ready for review January 22, 2026 19:05
@bbelledd bbelledd requested a review from a team as a code owner January 22, 2026 19:05
Copy link
Copy Markdown
Contributor

@rithvik-doshi rithvik-doshi left a comment

Choose a reason for hiding this comment

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

lgtm

@kzsb03 kzsb03 merged commit 2c189ef into dev Jan 26, 2026
3 checks passed
@kzsb03 kzsb03 deleted the context-management branch January 26, 2026 17:00
@github-actions
Copy link
Copy Markdown

@CodiumAI-Agent /update_changelog

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.

Calculate Remaining Context Window

4 participants