Skip to content

fix(settings): reconcile image bindings when removing provider models - #873

Merged
vastsa merged 4 commits into
vastsa:mainfrom
hui455:fix/image-model-removal
Sep 22, 2026
Merged

vastsa merged 4 commits into
vastsa:mainfrom
hui455:fix/image-model-removal

Conversation

@hui455

@hui455 hui455 commented Sep 22, 2026

Copy link
Copy Markdown
Contributor

问题与改动

从服务商的已选模型中移除默认生图模型并保存时,如果没有操作生图复选框,保存流程会跳过生图设置同步,留下不可用的默认绑定。

保存现在会清除已移除模型的生图候选并清空生图默认值;即使还有其他可用候选,也不会自动切换,直到用户主动选择新的默认模型。取消编辑保持原配置。若同次保存也移除了聊天默认模型,保留原有的聊天默认值修复行为。外部停用、失效绑定的展示规则不变。

同步中英文图片生成规格与 E2E-IMAGES-remove-configured-model 场景。无 IPC、数据库 schema、凭据或权限变更。

验证

  • 新增完整 Electron 应用回归在上游代码失败,在修复候选通过;覆盖真实窗口、preload IPC、Electron Main、Rust Host SQLite、保存后回读、进程重启和重新打开设置,并验证存在其他服务商候选时仍清空默认值。
  • 77 项相关单元/契约测试、Desktop typecheck、Biome、样式 token、架构检查、文档检查、PR base 和 diff 检查通过。
  • 验证使用 Windows x64 完整 Electron 应用和本地 HTTP 模型列表 fixture;未调用真实生图服务,未测试完整安装包、macOS 或 Linux。

hui455 and others added 4 commits September 22, 2026 18:58
Treat explicit provider-model removal as releasing its image binding, including legacy selections whose capability checkbox was untouched. Keep the existing chat-default repair when the same save removes it.
Keep the image default row visible when removal clears the active binding so the settings page explains the unavailable state while preserving the remaining candidates.
…ementation

The branch's final semantics clear the image default when the removed model was
the default, even when another candidate remains; the Configuration paragraph,
the new removal section (both locales), the zh e2e scenario and the desktop e2e
assertion still described the earlier fallback rule.
@vastsa

vastsa commented Sep 22, 2026

Copy link
Copy Markdown
Owner

维护者侧处理完毕,head da39364ea 四项门禁全绿(JS build/typecheck/lint/architecture/test、Rust host-core、Docs、Head contains latest base),据此合入。

我做的两件事

  1. 把最新 main 合入分支以满足 Head contains latest base(无冲突,未 force-push)。
  2. 追加一个提交 docs: align the removal semantics and the e2e assertion with the implementation,把规格与断言对齐到你最后一个提交(ca81bcb0f)确定的语义——「被移除的模型是当前默认值时,默认值直接清空,即使还有其他候选」:
    • docs/spec/03-runtime/21-image-generation.md:配置段那句「the first remaining runnable candidate becomes the default, or the default becomes null if none remains」和新增的「### Provider model removal」段里「select the first remaining runnable candidate or clear the default when none remains」;
    • docs/zh-CN/spec/03-runtime/21-image-generation.md:对应两句;
    • docs/zh-CN/spec/06-delivery/04-e2e-test-plan.md:E2E-IMAGES-remove-configured-model 的预期;
    • scripts/e2e/image-generation-ui.tsx:322:断言由 (remaining ? "q" : undefined) 改为 undefined。原来那条与实现矛盾,而 CI 不跑该 e2e,所以门禁全绿也掩盖了它——这是本次唯一真正的“红”点。

修复代码本身(image-generation-default.ts 的 removedDefaultModel、ModelConfigPage.tsx 两条分支合并、ImageGenerationModelRow 的显示条件)未改动。

留档的后续项(不阻塞本次合入,建议另开 issue)

  • 清空默认值后若只剩一个候选,ImageGenerationModelRow.tsx:74 的 candidates.length > 1 会同时隐藏选择器,摘要行只剩「暂不可用」,用户必须回到服务商编辑器重勾复选框才能恢复默认——清空语义带来的 UX 死角。
  • removeProvider(ModelConfigPage.tsx:287-301)与禁用服务商仍不清理生图绑定,与「显式移除模型即释放」不对称。
  • ProviderSetupDialog.tsx:268-276 的新逻辑没有单测(CI 只跑 unit),目前仅由上面那条 e2e 覆盖。

@vastsa
vastsa merged commit a670e28 into vastsa:main Sep 22, 2026
4 checks passed
vastsa added a commit to hui455/PI-Desktop that referenced this pull request Sep 22, 2026
Conflict resolution: keep this branch's provider-save feedback paragraph and take
main's updated removal wording (vastsa#873), so both locales state the clear semantics;
keep both new E2E scenarios and both desktop e2e scenario names.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants