Skip to content

Commit b76b4f7

Browse files
edyedy
authored andcommitted
fix(tui): per-file polish round 7 — dialog-model favorites key
Favorites/recents options used the optional model.id (id?: string) instead of the reliable map key item.modelID, so a model entry without id would throw on model.id.includes("-nano") and produce an undefined selection. Use item.modelID consistently, matching the providerOptions branch.
1 parent 46f39d5 commit b76b4f7

2 files changed

Lines changed: 4 additions & 3 deletions

File tree

MERGE.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,7 @@ fork 与上游改了同一处(常见于 TUI 视觉/UX、core 加固逻辑)
202202
| 逐文件打磨轮4:`context/{sync,sdk,project,local,theme,route}.tsx` | 高/中 | 保留 bug 修复:sync `message.removed`/`message.part.removed``if (!messages/!parts) break`(未加载会话/被驱逐消息触发 `search(undefined)` 抛错杀死事件循环)+ `lsp.updated` 改无条件调用 debounce(默认无 workspace 时 LSP 状态不再刷新的回归)+ 会话列表排序改用与二分查找一致的码位比较(localeCompare 大小写次序不一致);sdk `onCleanup` 移出 `await` 之后(owner 已失效导致订阅永不清理)+ SSE 重连循环连接/迭代包 try/catch 并在收到事件后重置退避(一次网络错误即永久断连);project/local 事件订阅补 onCleanup;删除死代码(LocalTheme、RouteContext、SyncContext 解构、theme_mode 只写不读的持久化)(上游若已做可取上游版本) |
203203
| 逐文件打磨轮5:`routes/session/{index,dialog-message}.tsx` || 保留 bug 修复:TextPart `tableOptions` 由 setup 期字面量改 `createMemo`(原 `theme.border` 快照在主题切换后冻结表格边框色);`index.tsx` revert 分支与 `dialog-message.tsx` revert/copy/fork 四处 `sync.data.part[id].reduce``?? []`(消息 part 未加载时 `.reduce` 抛错);moveChild 方向语义(`- direction`)疑似与命令名相反但属上游行为,择要跳过(上游若已做可取上游版本) |
204204
| 逐文件打磨轮6:`feature-plugins/system/diff-viewer-ui.tsx``routes/session/{dialog-timeline,permission,dialog-fork-from-timeline,subagent-footer,question}.tsx`+`routes/home*.tsx`+`feature-plugins/{system/*,home/*}` 已审计) || 保留 bug 修复:`Panel` `borderProps.borderColor` 由 setup 期快照改 getter(`theme.border` 随对象展开保持响应式,原主题切换后 diff 查看器面板边框色冻结,`Separator` 已用 `() =>` 正确);fork `.data!.id` 无守卫(与 `dialog-message.tsx` fork 同款上游模式)择要跳过;`diff-viewer-file-tree-utils.moveFileTreeSelectionToFile` 仅测试引用但恐留待键位,暂不删(上游若已做可取上游版本) |
205+
| 逐文件打磨轮7:`component/dialog-model.tsx``dialog-{agent,move-session,theme-list,variant,session-delete-failed,session-list,skill,stash,workspace-file-changes,workspace-list}.tsx`+`command-palette.tsx` 已审计) || 保留 bug 修复:收藏/最近模型选项由可选的 `model.id` 改用可靠的映射键 `item.modelID``id?: string` 缺省时 `model.id.includes("-nano")` 抛错、选中项 modelID 变 undefined;并与 providerOptions 分支用键一致);`dialog-theme-list` `theme.all()` setup 期快照(需订阅 `subscribeThemes` 才能修,`all()` 非响应式且启动后基本不变)择要跳过(上游若已做可取上游版本) |
205206

206207
### 其他
207208

packages/tui/src/component/dialog-model.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,14 +36,14 @@ export function DialogModel(props: { providerID?: string }) {
3636
return [
3737
{
3838
key: item,
39-
value: { providerID: provider.id, modelID: model.id },
39+
value: { providerID: provider.id, modelID: item.modelID },
4040
title: model.name ?? item.modelID,
4141
description: provider.name,
4242
category,
43-
disabled: provider.id === "opencode" && model.id.includes("-nano"),
43+
disabled: provider.id === "opencode" && item.modelID.includes("-nano"),
4444
footer: model.cost?.input === 0 && provider.id === "opencode" ? "Free" : undefined,
4545
onSelect: () => {
46-
onSelect(provider.id, model.id)
46+
onSelect(provider.id, item.modelID)
4747
},
4848
},
4949
]

0 commit comments

Comments
 (0)