feat(desktop): add tps throughput, cache token counts, and output tokens to status bar / 底部信息栏新增 tps 吞吐、缓存 token 和输出 token 显示#6931
Open
HaoyueQin wants to merge 1 commit into
Conversation
HaoyueQin
force-pushed
the
feat/status-bar-throughput-cache-tokens
branch
2 times, most recently
from
July 26, 2026 11:57
0ece3d8 to
8ed2cc0
Compare
Contributor
Author
|
After the initial submission, the status-bar label for token throughput was updated for localization consistency: English: "tok/s" → "tps" (matching the ctx-style abbreviation convention) PR 初始提交后,token 吞吐量的状态栏标签进行了本地化调整: 英文:"tok/s" → "tps"(与 ctx 等缩写风格一致) |
…okens to status bar and composer run strip - StatusBar: new turn_tps, turn_output_tokens, turn_cache_tokens items with i18n - Composer run strip: streaming TPS estimate (chars/4) with tool-arg support - Text-based token estimation as fallback when provider omits streaming usage events - Completed TPS persists across turns via lastTurn* state fields - StatusBar horizontal mouse-wheel scroll with hidden scrollbar - Three-language i18n (en/zh/zh-TW) for all new labels and tooltips
HaoyueQin
force-pushed
the
feat/status-bar-throughput-cache-tokens
branch
from
July 26, 2026 12:55
c0c9cc8 to
d1bb80f
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR adds three new configurable status-bar display items and a streaming throughput readout in the composer run strip, addressing several unmet requests from the closed issue #5677.
New status bar items (persistent, bottom bar):
turn_tps— output token throughput (tokens/s), computed from(completionTokens + reasoningTokens) / (turn duration − wait time). Persists until the next turn completes.turn_output_tokens— completion tokens from the most recent request, displayed as an exact integer ("out 1250").turn_cache_tokens— prompt cache hit/miss token counts ("hit 12345 | miss 4567"), using i18n-aware labels.All three are opt-in via Settings → Status Bar Items (drag-to-reorder, toggle visibility) and follow the existing
|separator and metric-label/value layout conventions.Streaming throughput in composer run strip (above the input box):
tokens/sestimate joins the existing↓ N tokensreadout:来感觉了… 12s · 25 tokens/s · ↓ 850 tokens.usageevents with token counts (common with some DeepSeek-compatible backends), the display falls back to a character-count estimate (chars ÷ 4), matching the approach used by MiMo-Code's sidebar TPS.write_filebodies, etc.) is included in the estimate so the readout stays meaningful during long tool dispatches.Additional changes:
<span>(normal weight) +<b>(value only), matching the weight of every other status bar metric.Data model:
useControllerState gainsturnDoneAt(recorded atturn_done),turnOutputTokens(accumulated from usage events:completionTokens + reasoningTokens), andturnTextChars(live text+reasoning character count for estimation).lastTurnOutputTokens/lastTurnStartAt/lastTurnDoneAt/lastTurnWaitAccumMspreserve the previous turn's completed values so the status bar does not reset to "-" on the next turn.Files changed (12):
desktop/frontend/src/lib/useController.tsturnDoneAt,turnOutputTokens,turnTextChars,lastTurn*fields; record inturn_done/usage/texthandlersdesktop/frontend/src/lib/statusBarItems.tsturn_tps,turn_output_tokens,turn_cache_tokensinternal/config/config.godefaultDesktopStatusBarItemsdesktop/frontend/src/components/StatusBar.tsxformatTpshelper, 3 item renderers (Gauge/FileOutput/HardDrive icons),onWheelhorizontal scrolldesktop/frontend/src/components/Composer.tsxturnOutputTokens+turnTextCharsprops; splitrunTickerinto prefix/suffix with estimate tooltip; includeturnArgCharsin estimatedesktop/frontend/src/App.tsxdesktop/frontend/src/components/SettingsPanel.tsxstatusBarItemLabeldesktop/frontend/src/locales/{en,zh,zh-TW}.tsdesktop/frontend/src/styles.css.statusbar__cache-sepdesktop/frontend/src/__tests__/typography-overflow-contract.test.tsoverflow→overflow-yassertionVerification
gofmt -l .— clean (zero output)npx tsc --noEmit(desktop/frontend) — zero errorswails build— successful (Windows/amd64, 33 s)REASONIX_HOME=D:\reasonix-dev-isolated— streaming TPS, status bar items, persistence, i18n, and horizontal scroll all behave as expectedRelationship to #5677
Issue #5677 ("关于界面显示的一些建议") was closed as completed, but several items mentioned in the request body were not implemented at the time of closing:
The remaining suggestions in #5677 (circular context-gauge redesign, de-duplicating overview panel metrics) are out of scope for this PR.
Streaming estimation caveat
The run-strip TPS and
↓ N tokensvalues are character-count estimates (chars ÷ 4) when the provider does not report token counts in mid-streamusageevents. This can diverge from the final exact values (sometimes by 30–50%), especially for code-heavy or mixed-language content. The final persistent values in the status bar are exact (from the APIusageevent). A hover tooltip on the run strip explains this to the user.Cache impact
Cache-impact: none — the
config.gochange is a three-line addition to a default-item slice; it does not affect system-prompt construction, tool schema serialization, or any cache-sensitive path.Cache-guard: existing
go test ./internal/config/covers config normalization; no new guard test needed.System-prompt-review: self-reviewed (no prompt impact) — config.go change only appends three display-item IDs to defaultDesktopStatusBarItems; no system prompt, memory prefix, output style, or skill index construction is affected.
摘要
本 PR 新增了三个可自定义的底部状态栏显示项,并在输入框上方的 composer run strip 中添加了流式吞吐量读数,补全了已关闭的 Issue #5677 中尚未实现的若干需求。
新增状态栏项(底部持久显示):
turn_tps— 输出 token 吞吐速度(tokens/s),公式为(completionTokens + reasoningTokens) / (轮次耗时 − 等待时间)。数值保留至下一轮完成才更新。turn_output_tokens— 最近一次请求的 completion token 数,精确整数显示(如 "输出 1250")。turn_cache_tokens— 请求级 prompt 缓存命中/未命中 token 数(如 "命中 12345 | 未命中 4567"),标签跟随界面语言切换。所有三项均可通过「设置 → 状态栏项目」自由开关和拖拽排序,遵循现有的
|分隔符和"标签+数值"布局规范。输入框上方 run strip 中的流式吞吐量:
↓ 850 tokens旁新增实时tokens/s估算,显示为来感觉了… 12s · 25 tokens/s · ↓ 850 tokens。usage事件(token 计数)时,自动回退到字符数估算(chars ÷ 4),与 MiMo-Code 侧边栏 TPS 的算法一致。write_file的文件体)已纳入估算,避免工具调用期间数值无意义下降。其他改进:
<span>,仅数值加粗,与其他状态栏项的字体粗细一致。数据模型:
useControllerState 新增turnDoneAt(在turn_done事件中记录)、turnOutputTokens(从 usage 事件累加completionTokens + reasoningTokens)、turnTextChars(流式文本+推理字符总数,用于估算)。lastTurnOutputTokens/lastTurnStartAt/lastTurnDoneAt/lastTurnWaitAccumMs保存上一轮完成时的精确值,确保状态栏不会在新一轮开始时变成 "-"。修改文件(12 个):(同上表,略)
与 #5677 的关系
Issue #5677("关于界面显示的一些建议")已被标记为已关闭,但其中部分需求在关闭时并未实现:
#5677 中的其余建议(上下文圆形进度条改为横向、概览窗口去重等)不在本 PR 范围内。
流式估算误差说明
当模型供应商不在流式过程中报告 token 计数时,run strip 的 TPS 和
↓ N tokens均基于字符数估算(chars ÷ 4),与精确值之间可能存在 30–50% 的偏差(尤其在代码或混合语言场景下)。底部状态栏中的持久值为 API 返回的精确值。run strip 上的悬浮提示已向用户说明这一点。缓存影响
Cache-impact: none —
config.go仅往默认项切片追加了三行字符串,不影响系统提示词构建、工具 schema 序列化或任何缓存敏感路径。Cache-guard: 现有
go test ./internal/config/已覆盖配置标准化逻辑,无需新增守护测试。System-prompt-review: N/A — 未改动 provider 可见的系统提示词、记忆前缀、输出风格或技能索引行为。
效果展示