[建议 / Feature] 流式输出时实时显示 Token 速度(tok/s / tokens per second)
Open
Nobody has claimed this yet.
priority: P2
- Dominant language
- No language data
- Stars
- 22
- Forks
- 1
- PR merge metrics
- No merged PRs in 30d
Description
使用场景 · Use case
在长文本/长回答流式生成时(尤其是一次性生成数千 token 的回复、代码、文档),用户无法感知当前模型的输出速度,只能盯着文字一点点出现。不知道是网络慢、模型慢、还是卡住了。目前 ZCode 界面只显示最终累计 token 用量(usage),没有实时的「每秒输出速度」指标。
参考产品:
- Cursor 的 usage 面板会显示
↑ tokens/sec实时输出速度 - Claude Code / Codex CLI 的状态栏在流式输出期间会动态显示
tok/s - ChatGPT / Claude Web 也提供类似的速度感知
建议方案 · Proposal
- 流式输出期间:在回复底部 / 状态栏显示实时的
x.x tok/s(输出速度),每 1~2 秒刷新一次,由客户端根据usage_update增量 token 和耗时自行计算(增量 token ÷ 时间差),不依赖服务端新增字段。 - 可选开关:在「设置 → 显示」中提供开关(如
messageStreamShowTokenSpeed),默认开启,允许不关心的用户关闭。 - 可选展示时机:仅在流式生成过程中显示(避免像终态 usage 那样常驻),生成结束后可与累计 token 一起展示。
预期价值 · Expected value
- 用户能立即区分「正常输出中」与「卡死/断流」,减少误判和焦虑,减少无谓的取消/重试。
- 方便对比不同模型、不同 API 提供方(如 bigmodel / deepseek / 中转站)的实际输出速度,帮助选型。
- 参考产品已有此指标,属于体验层面的高频预期功能。
补充材料 · Additional context
- 技术参考:ZCode 运行时会通过 ACP 协议下发
usage_update(token 用量)事件(社区项目 zcode-open-bridge 有记录),客户端据此即可计算 tok/s,无需改动服务端。 - 已在 zai-org/feedback 中以
tok/s、token speed、throughput等关键词搜索确认无重复。
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
The issue names no repository files or tests. Start by locating the client handling ACP usage_update events and the settings/display controls; done means showing a refreshable tok/s value during streaming, with an option to disable it and final usage still available after generation.
Written by the indexing model from the issue text.
Assessment
- Domain
- frontend
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100