feat(sidebar): 最近会话行首显示最后一轮使用的模型图标 - #735
Merged
Merged
Conversation
- Add shared ProviderBrandIcon component with isKnownProviderId guard (legacy rows persist "", optimistic rows may carry "pending" or a custom provider instance id — only enum hits render an icon) - Render the icon left of the row title, hidden in selection mode; native title tooltip shows the last-used model name - Compare providerId/model in areRenderedHistoryItemsEqual so rows re-render after a new turn persists a different model - Converge two byte-identical private ProviderBrandIcon copies (ComposerModelControls, modelPicker) onto the shared component
StackCairn
marked this pull request as draft
September 2, 2026 12:44
Contributor
|
PR governance checks passed. Awaiting human review. |
AlphaCatMeow
marked this pull request as ready for review
September 2, 2026 12:47
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.
Linked issue
Closes #734
Summary
侧栏「最近会话」每行只有标题,多供应商混用时看不出会话用的是哪个模型。本 PR 在每行标题左侧加一个 16px 供应商 logo,依据是最后一轮对话实际使用的模型——
chatHistory的provider_id每轮 upsert 覆写,天然就是这个语义,前端数据也已透传到SidebarConversation,因此不涉及后端和数据结构变更:ProviderBrandIcon,并导出isKnownProviderId白名单守卫。侧栏的providerId是宽 string:老数据存的是空串、GUI 乐观行可能回退"pending"、Web 端乐观行存的是自定义供应商实例 id。这些值不能进现有图标组件的 fallback 分支(会错显示成 OpenAI logo),守卫只放行五个枚举值,未命中不渲染图标、标题顶格;title显示具体模型名,悬停行内其他区域仍显示会话标题(HTML title 取最内层元素,无冲突);多选模式下图标隐藏,让位给同为h-4 w-4的 checkbox,标题位置不跳动;areRenderedHistoryItemsEqual补比较providerId/model:该 memo 比较函数此前不含这两个字段,行内一旦展示模型信息,换模型后新一轮持久化时行不会重渲染,图标会停留在旧值。store 层reconcile.ts本就比较这两个字段,item 引用只在字段真变时更换,不会引入多余重渲染;ComposerModelControls与modelPicker里两份字节等价的私有ProviderBrandIcon收敛到共享组件;ProviderPresentation的版本尺寸契约不同(height="1em"随文字缩放),保留并留了 TODO。侧栏行组件在
agent-ui由 GUI 与 WebUI 共用,一处改动两端生效。Change scope
crates/agent-ui/src/components/ProviderBrandIcon.tsx(新增)crates/agent-ui/src/components/chat/ChatHistorySidebarRows.tsx(行首图标 + memo 修复)crates/agent-ui/src/components/chat/ComposerModelControls.tsx(私有副本收敛)crates/agent-ui/src/pages/settings/modelPicker.tsx(私有副本收敛)crates/agent-ui/src/pages/settings/ProviderPresentation.tsx(仅注释)Screenshots / preview
Verification
pnpm typecheck:ui✅biome check新增文件无诊断;lint:ui全仓与 main 基线错误数一致(480,均为本机 CRLF 存量格式问题),本 PR 未新增pnpm test:webui685/685 ✅pnpm test:gui2898 pass / 5 fail,失败集与 main 基线完全一致(已在无改动基线上复跑确认),与本 PR 无关provider_id行不渲染图标、多选模式图标隐藏、换模型后新一轮对话持久化时图标更新Pre-submit checklist