feat: 输入框思考等级旁上下文占用进度环 - #197
Merged
Merged
Conversation
- 新组件 ContextUsageRing:内联 SVG 20px 环形(SIZE=20/STROKE=2.5/RADIUS=8.75), 进度弧 stroke-dashoffset=CIRC·(1-percent/100)+rotate(-90); 导出纯函数 contextUsagePercent(0-100 整数 clamp + limit<=0 防御) - 隐藏条件 used<=0||limit<=0;占用率≥80% data-state=warning + text-warning, 否则 normal + text-primary;title/aria-label 复用 formatNum 千位分隔 - MessageInput 新增可选 props tokenUsage/contextWindowTokens,上限解析链 activeModel.limit.context ?? contextWindowTokens ?? 128000, 渲染位置:hasConfigRow 之后、micButton 之前 - App inputProps 透传 tokenUsage 与 agentSettings.contextWindowTokens - i18n:chat.contextUsage.tooltip(zh/en) - 测试:ContextUsageRing 6 项行为 + MessageInput 4 项集成 + ChatContext 会话切换 tokenUsage 重置回归
- RTL rerender 替换整棵渲染树导致 useI18n Provider 丢失,wrappedRender 的 rerender 重新包裹 I18nProvider
- SVG 元素 className 为 SVGAnimatedString,断言改用 getAttribute('class')
Owner
Author
|
双轴审查通过(APPROVE,由独立审查 agent 产出): 规范轴:无 MAJOR。1 MINOR(contextUsagePercent 对 NaN 的防御性改进,数据链路实际不会产生 NaN,登记不阻塞)+ 2 NIT(cn 单字符串调用、测试几何常量 double-entry 设计,均无需修改)。 规格轴:Task #196 全部 8 条 AC 满足(逐条有测试证据);技术方案 §6 Testing Decisions 的 Observable Result 全覆盖;零改动清单(ChatContext.tsx / types.ts / ConversationSidebar.tsx / useAgent.ts)无违规。 验证:全量 1056 tests passed,eslint 0 error,typecheck + build:chrome 通过,CI(test/lint)绿。 |
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.
上下文占用进度环(context-usage-ring)
变更内容
ContextUsageRing.tsx:内联 SVG 20px 圆形进度环 + 导出纯函数contextUsagePercent(0-100 clamp、limit<=0 防御)used<=0 || limit<=0不渲染;占用率 ≥80% 进度弧text-warning变色(data-state="warning|normal")title/aria-label:上下文占用:45,200 / 128,000(formatNum千位分隔,zh/en 双语)MessageInput新增可选 propstokenUsage/contextWindowTokens;上限解析activeModel.limit.context ?? contextWindowTokens ?? 128000;渲染于 reasoning-select 之后、micButton 之前App.tsxinputProps 透传两行;i18n 新增chat.contextUsage.tooltip验证
Closes #196