Repository navigation
Conversation
added 3 commits
October 25, 2026 19:14
复用前端已有消息展示模型提供商、响应时间和结束信息,不增加后端读取。统一费用摘要与分项显示为最多四位小数截断,保持原始数据不变。 关联 agegr#1416、agegr#1417。
This branch has not been deployed
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.
优化回复用量摘要,支持精确明细与平均输出速度
关联议题
Closes #1416
改动说明
将回复底部用量行改为“紧凑摘要 + 按需精确明细”,复用现有视觉和通知机制,不新增设置、依赖或会话字段。
紧凑摘要
UsageIcon,沿用顶部统计栏的 SVG:输入 ↑、输出 ↓,缓存读写使用互为镜像的圆弧箭头。.0;四舍五入到 1000K 时提升为 1M。精确明细
addNoticeToast 展示未缩写的用量、总计、费用、耗时和速度。$0.023180000000000003 → $0.0231;小于$0.0001显示为$0。原始费用及累计结果不变。timestamp,完成时间仅在开始时间及durationMs有效时推导,使用查看者时区;整轮明细不显示最后一次响应的元信息,避免范围混淆。en、zh-CN、zh-TW,图标保留本地化的名称提示;Provider 标签分别为Provider、模型提供商、模型供應商。用量与速度口径
0.0 t/s。MessageView的 memo 比较,避免派生对象导致无关 Markdown 重绘,也避免总费用未变时漏掉分项更新。范围与兼容性
验证
以下检查在独立功能分支
feat/usage-notice-emoji的提交ceddc2f上执行,base 为上游main的e533d9b:npm test:2889 通过、1 跳过、0 失败。本机以 root 运行,测试进程通过setpriv --bounding-set=-dac_override,-dac_read_search关闭文件访问绕过能力,使权限相关测试按预期执行。node_modules/.bin/tsc --noEmit --incremental false。npm run lint。git diff --check。node e2e/usage-notice.mjs:Chromium 下 1280px 桌面与 375px 手机宽度通过。浏览器回归使用隔离的合成会话目录和自行启动的开发服务,结束后停止该服务并清理合成会话;不写入真实会话,也不运行
next build。主要文件
components/MessageUsage.tsx、components/UsageIcon.tsx:摘要、图标和精确明细。lib/message-usage.ts:数字格式化、同范围平均速度和整轮汇总。components/MessageView.tsx、components/ChatWindow.tsx、components/AppShell.tsx:展示与现有 Toast 的接入。lib/i18n/messages/{en,zh-CN,zh-TW}.ts:本地化文案。e2e/usage-notice.mjs和docs/agents/sessions.md:回归与维护说明。