Skip to content

Commit e8b3a2d

Browse files
author
王璨
committed
fix: 修复 session 切换时 context window 不刷新 & token
显示精度 - web-backend.ts: session load 后 broadcastContextWindow(true),确保 加载已保存 session 时前端 ContextWindowBar 立即显示正确的 token 统计 - ContextWindowBar.tsx: formatTokenCount 对 <1000 的值直接显示原始数字 而非 "0.0k",避免小数 token 被误读为零
1 parent 293781c commit e8b3a2d

2 files changed

Lines changed: 2 additions & 1 deletion

File tree

src/ui/web/web-backend.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1036,6 +1036,7 @@ export class WebUiBackend implements UiBackend {
10361036
config: this.buildConfigData(),
10371037
messages,
10381038
});
1039+
this.broadcastContextWindow(true);
10391040
this.pushSessionList(client);
10401041
break;
10411042
}

web/src/components/ContextWindowBar.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ function formatTokenCount(n: number): string {
5353
if (n >= 1_000) {
5454
return (n / 1_000).toFixed(1) + "k";
5555
}
56-
return (n / 1_000).toFixed(1) + "k";
56+
return n.toString();
5757
}
5858

5959
export function ContextWindowBar({ data }: ContextWindowBarProps) {

0 commit comments

Comments
 (0)