mirror of
https://github.com/getcompanion-ai/co-mono.git
synced 2026-04-15 11:02:17 +00:00
Fix context percentage showing 0% when last message was aborted
Skip aborted assistant messages when calculating context usage in footer. Fixes #12
This commit is contained in:
parent
aecb4cd3bb
commit
4ff9c826d8
1 changed files with 2 additions and 2 deletions
|
|
@ -36,11 +36,11 @@ export class FooterComponent {
|
|||
}
|
||||
}
|
||||
|
||||
// Get last assistant message for context percentage calculation
|
||||
// Get last assistant message for context percentage calculation (skip aborted messages)
|
||||
const lastAssistantMessage = this.state.messages
|
||||
.slice()
|
||||
.reverse()
|
||||
.find((m) => m.role === "assistant") as AssistantMessage | undefined;
|
||||
.find((m) => m.role === "assistant" && m.stopReason !== "aborted") as AssistantMessage | undefined;
|
||||
|
||||
// Calculate context percentage from last message (input + output + cacheRead + cacheWrite)
|
||||
const contextTokens = lastAssistantMessage
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue