Skip to content

feat: status line 显示会话累计 tokens 和请求次数#98

Open
dengmik-commits wants to merge 1 commit into
lessweb:mainfrom
dengmik-commits:feat/token-status-line
Open

feat: status line 显示会话累计 tokens 和请求次数#98
dengmik-commits wants to merge 1 commit into
lessweb:mainfrom
dengmik-commits:feat/token-status-line

Conversation

@dengmik-commits
Copy link
Copy Markdown
Contributor

改动

buildStatusLine() 中 tokens 展示从 activeTokens(仅最近一次 API 响应)改为会话累计值

之前:status: processing · tokens: 1234
之后:status: processing · tokens: 12.3k / 5 reqs

数据来源

  • totalTokensentry.usage.total_tokens(会话累计,每次 API 调用累加)
  • totalReqsentry.usagePerModel 各模型的 total_reqs 求和(已有跟踪链路)
  • 格式化:<1000 直显,<10000 显示 1.2k,>=10000 显示 12k

为什么不用 activeTokens

activeTokens 存储的是最近一次 API 响应的 total_tokenssession.ts:1221),只用于 compaction 阈值比较,不是累计值。entry.usage.total_tokens 才是真正的会话累计。

Replace activeTokens (latest response only) with cumulative total_tokens
from entry.usage and total_reqs from entry.usagePerModel, formatted as
"tokens: 12.3k / 5 reqs".
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.

1 participant