From 882ab886682551b6bc45b6a4f729d5390a3773aa Mon Sep 17 00:00:00 2001 From: maweibin Date: Fri, 20 Mar 2026 11:02:40 +0800 Subject: [PATCH] - Fix the webchat context usage banner to use the same notion of \"used tokens\" as the `session_status` command. --- ui/src/ui/views/chat.browser.test.ts | 2 +- ui/src/ui/views/chat.ts | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/ui/src/ui/views/chat.browser.test.ts b/ui/src/ui/views/chat.browser.test.ts index c17525bb60b..0d3d6a58563 100644 --- a/ui/src/ui/views/chat.browser.test.ts +++ b/ui/src/ui/views/chat.browser.test.ts @@ -37,7 +37,7 @@ function createProps(overrides: Partial = {}): ChatProps { key: "main", kind: "direct", updatedAt: null, - inputTokens: 3_800, + totalTokens: 3_800, contextTokens: 4_000, }, ], diff --git a/ui/src/ui/views/chat.ts b/ui/src/ui/views/chat.ts index 88a712706f0..afa858fdd04 100644 --- a/ui/src/ui/views/chat.ts +++ b/ui/src/ui/views/chat.ts @@ -255,7 +255,8 @@ function renderContextNotice( session: GatewaySessionRow | undefined, defaultContextTokens: number | null, ) { - const used = session?.inputTokens ?? 0; + // Use the same notion as `session_status`: the fresh totalTokens + const used = session?.totalTokens ?? 0; const limit = session?.contextTokens ?? defaultContextTokens ?? 0; if (!used || !limit) { return nothing;