Repository navigation
fix(settings): let an image-generation model stay usable for chat - #2304
Conversation
Marking a model as the image-generation model used to remove it from the composer and default-model menus, block selection in the model menu, and fail session launch outright, so a model like gpt6.1-terra that serves both image generation and conversation could only ever be one or the other. The image binding is host-owned and independent of the conversation route, so the designation no longer excludes a model anywhere on the chat side: composer lists, default-model options, subagent choices, composer readiness and session launch all keep the model, and saving an image default no longer forces the chat default off it. The settings hint text is updated in every locale to match.
e5c83f8 to
c90c554
Compare
The provider-model-config source-pattern tests pinned the old exclusion implementation (image-skipping first-model pick, image-aware chatModelOptions/providerServesChatModels signatures and the default replacement guard). Update them to pin the new inclusion behaviour.
The native-pi-sessions readiness pin evaluated the Composer modelReady expression with the old image exclusion; the designation no longer blocks chat readiness, so the image-provider case now expects ready.
vastsa
left a comment
There was a problem hiding this comment.
#2253 的方向合理:生图绑定不应使同一模型失去对话资格。但当前提交还不能合入:
- 请移除误提交的
apps/desktop/.vision-pin-launch-test-bVrsfz/session-launch.mjs(1018 行构建/测试临时产物),将范围限定为实际源码、测试和文案。 image-conversation-selection.test.mjs新的 launch 用例在.catch()中吞掉所有不含image model的异常,因此即使 launch 因为其他配置/路由错误始终无法成功,该用例仍通过。请构造完整的 launch fixture,直接 await 成功结果并断言 provider/model/binding 正确;同时覆盖 image binding 保留、保存标记后聊天默认模型不变。可以 mock 外部 Host/provider 边界,无需真实付费模型调用。
本轮是源码/测试审查,未执行该 PR 的测试或 E2E,也尚未完成对话/subagent 完整行为验证;上述问题修好后继续验证。
|
Thanks, but this cannot land as is:
|
…the committed launch artifact - remove apps/desktop/.vision-pin-launch-test-bVrsfz/session-launch.mjs (accidental build/test artifact, vastsa#2304 review 1) - rewrite the launch case in image-conversation-selection.test.mjs: full launch fixture mocking the Host/provider boundary, direct await of a successful resolveAgentRuntimeLaunch with assertions on provider/model/binding instead of a .catch() that swallowed every non-'image model' error (review 2) - cover that the image binding reaches the send path and that the chat default model is unchanged once an image binding is saved
|
@koeria is attempting to deploy a commit to the vastsa's projects Team on Vercel. A member of the Team first needs to authorize it. |
|
复查新 head 20bf901:临时构建产物已移除,launch 用例也改为直接 await 并断言返回值,这两项已处理。此前 02:33 的核心阻碍仍未解决:composerModelsForProvider/defaultModelOptions 和 session launch 仍是直接移除全部排除,没有依据对话能力区分纯生图端点与双能力模型;新增用例甚至要求 gpt-image-2.5 出现在聊天菜单。请保留纯生图模型不可用于 chat 的约束,只放行支持对话的生图标记模型,并分别覆盖两类模型的选择/发送行为。docs/spec/03-runtime/21-image-generation.md 与 scripts/e2e-image-chat.mjs 也未随行为更新。本轮已检查新 diff 和测试源码,未执行该 head 的测试或 E2E;暂不合入。 |
…mit dual-capability models Reviewer follow-up on vastsa#2253: the previous head removed the image-model chat exclusion wholesale, which let pure image-generation endpoints (no conversation route, such as gpt-image-2.5) into the Composer, the default-model menus and session launch. The constraint the ADR image-generation-capability establishes is restored, now decided by capability instead of the image binding alone: - a new shared isImageOnlyChatModel/modelSupportsConversation predicate excludes only pure image-generation endpoints — recognized by a reserved image-only model id or by published output modalities that name no text output; unknown custom metadata stays chat-eligible; - a dual-capability model (image-marked and conversation-capable) keeps its chat eligibility in the Composer list, default-model options, subagent choices, Composer readiness and model-menu selection, and session launch succeeds with the image binding intact (vastsa#2253); - session launch rejects a marked pure image-generation endpoint before inference; - tests cover both classes separately: pure image rejected from menus and launch, dual capability admitted with the binding preserved; - the image-generation spec and the image-chat E2E describe and enforce the capability-based behavior; the localized settings hint says the same in every locale.
|
复查 f9578f4:diff 已新增 modelSupportsConversation/isImageOnlyChatModel,开始区分纯生图与双能力模型,因此此前“直接移除全部排除”的意见不应继续套用于新 head;该方向需要进一步独立验证。本轮先定位到两个落地阻碍:JS CI 43469724816 的桌面测试仍断言 /subagentModelChoices(providers)/,新代码已传入第二个 image binding 参数,请更新该源码断言并保留两类模型的行为覆盖;Electron 同一 run 的 browser capture/resize 在截图等待 30000ms 后超时。请修正过期断言、排查/重跑 E2E,并更新 PR 正文(正文仍描述移除所有过滤,已与新代码不符)。未执行此 head 的独立模型选择/发送验收,暂不合入。 |
…e-binding argument
|
复查 59849e3:此前源码断言/CI 问题已修复,当前六项 Actions 均通过;不再沿用旧阻碍。还有一个选择与发送规则不一致的问题:defaultModelOptions、Composer 的 canSend 和模型菜单调用 isImageOnlyChatModel 时均未传入第四个 metadata 参数,launch 却传入 modelConfig。因此对于非保留命名、但已发布 output:["image"] 的绑定模型(例如 vendor/custom-image),菜单允许选、发送按钮可用,launch 才拒绝。 我独立执行了该 head 的原始 shared helper:同一 binding/provider/modelId,不传 metadata 返回 false(不视为 image-only),传入 {modalities:{output:["image"]}} 返回 true。此为真实 helper 执行加调用点审查,未声称完整 UI/模型服务 E2E。请让选择、默认值、子代理和发送使用一致的能力信息/判定,并覆盖一个非 gpt-image/dall-e/imagen 命名的已知 image-only 模型,以及未知自定义和双能力模型。当前暂不合入。 |
…lity call site The metadata argument reached only session launch; the default picker, Composer canSend, the model menu and the settings/subagent paths all called isImageOnlyChatModel without it, so a non-reserved image-only bound model (output modalities naming no text) stayed selectable and sendable in the UI while launch rejected it. - resolve discovery metadata in defaultModelOptions and thread it through providerServesChatModels, keepsAppDefaultModel, loginDefaultModel and the subagent model helpers - Composer canSend and the model menu pass the selected candidate's discovered row; ModelConfigPage reads the store's providerModels - new cases: a non-reserved image-only model excluded by metadata and rejected at launch, an unknown custom model kept eligible, a dual-capability model selectable and launching
|
复查 4b67b9b:本次已向主要选择/发送路径传入 metadata,之前缺少第四参数的意见已有实质处理,六项 Actions 也均通过。仍有一处动态更新遗漏:SubagentEditorSheet.tsx:594 的 modelChoices 用 useMemo 缓存,依赖只有 [providers],settings/imageGenerationModels 与 providerModels 却通过 useAppStore.getState() 读取。catalog-slice 的缓存/远程发现只更新 providerModels,不更换 providers,因此打开编辑器后能力信息到达,即使因编辑字段重新渲染,也不会重新过滤。 独立执行验证:直接提取此 head 的原始 useMemo 代码块,并打包执行原始 subagentModelChoices。相同 providers 引用,初始 metadata 为空时 vendor/custom-image 出现在列表;随后补入 output:["image"],直接重新调用 helper 得到 0 个选项,但原始 memo 块重渲染仍返回 1 个。此为原始代码块与 helper 的执行诊断,不是已挂载 UI 或真实模型 E2E。 请用响应式 selector 订阅 settings 的相关 image bindings 和 providerModels,并把它们加入 modelChoices 的依赖,覆盖“编辑器保持打开,metadata 从未知更新为 image-only”的状态变化;SubagentFallbackModels 的 getState 读取也建议一并检查更新订阅。当前暂不合入;完成后再验证完整 UI 与最终集成候选。 |
The modelChoices memo read settings.imageGenerationModels and providerModels through useAppStore.getState() while depending only on [providers]. The catalog slice swaps providerModels without replacing the providers array, so image-only metadata arriving after the sheet opened never re-filtered the list until it was closed and reopened. Subscribe to the settings slices and the discovered catalog, derive the image bindings reactively, and apply the same subscription to SubagentFallbackModels' row labels. Add a regression test that replays the late-metadata transition (unknown -> output:["image"]) with the providers reference held constant.
|
复查 b84f779:SubagentEditorSheet / SubagentFallbackModels 已改用响应式订阅,之前的 memo 依赖意见已实质处理;六项 Actions 均通过。 本轮独立执行发现保存默认值的回归,仍暂不合入:ModelConfigPage.afterSaved 删除 replacementChatModelId 后,在 imageModelIds 保存分支仅应用 planImageGenerationDefaults,不再迁移变为纯生图的聊天默认值。复现:provider p 配置 gpt-image-2.5 和 chat,当前聊天默认为 p/gpt-image-2.5、尚未标记生图;编辑 provider 时将 gpt-image-2.5 标记为生图并保存。原 main 回调保存 defaultModelId=chat,新回调仍保存 defaultModelId=gpt-image-2.5,同时 imageGenerationModels 已包含它。随后聊天菜单过滤该默认值、launch 按新规则拒绝,尽管 chat 可用。 验证方式:提取原始 afterSaved 函数,使用真实 planImageGenerationDefaults 和 shared helper 执行、以 api.getSettings/setSettings 边界替身捕获保存结果;baseline 与 candidate 分别断言 chat / gpt-image-2.5。此为生产回调执行诊断,不是已挂载 UI 或真实 provider E2E。定向原生测试本地因隔离 worktree 尚未链接 @pi-desktop/shared 而在收集阶段失败,不计为测试通过,也不归因于 PR。 请保留双能力模型的聊天默认值,但基于保存后的 image bindings 和能力 metadata,仅对已不可聊天的默认值恢复最小迁移(有可用替代时选替代);不能使用保存前 imageGenerationCandidates 判断新标记。请覆盖双能力保持、纯生图迁移及没有替代模型的明确行为,再验证选择/默认/发送一致性。 |
…to chat The imageModelIds branch of ModelConfigPage.afterSaved stopped migrating the app's chat default when replacementChatModelId was removed, so marking a model for image generation during a save left the default pointing at a model the chat menus filter out and launch rejects even though the provider still serves chat models. Judge the default from post-save state — the bindings planImageGenerationDefaults writes plus the discovered metadata — never from the pre-save imageGenerationCandidates memo, which cannot see what this save just marked. A dual-capability default keeps its chat role; a default this save left unable to chat moves to a chat model the saved provider still serves; with no replacement the stored default is left untouched. The verbatim afterSaved closure runs against real helpers with api.getSettings/setSettings stand-ins, covering all three behaviors.
…omposer model menus
|
复查 3bda0ac:保存后按新 image bindings 判断默认值的改动已解决上轮复现的迁移回归。独立运行新 head 及 GitHub 集成候选 4ac68c2(main 043d11c)的五组定向测试,两次均 60/60 通过;集成候选桌面构建、diff check 通过,六项 Actions 通过。 本轮仍暂不合入,原因是端到端验证尚未完成,不是沿用已解决的业务阻碍:PR 修改的 scripts/e2e-image-chat.mjs 仍等待设置页 AI 按钮,并引用已不存在的 .model-default-trigger、旧 composer-menu-entry / model-group-label;原脚本停在 AI settings。复用本机 sidecar 产物、隔离 PI_DESKTOP_AGENTS_DIR 后,用临时脚本适配导航继续诊断,又遇到新版按服务分区/搜索的模型行断言不稳定,未获得完整通过结果。这些失败尚不能直接认定为 PR 业务回归,也不能计为 E2E 通过。 建议把该 E2E 更新为当前设置/模型菜单交互,通过服务分区或搜索定位明确 provider/model,实际选择被标记的双能力模型并发送;保留纯生图不可选/拒绝以及默认值迁移的覆盖。随后在最新 main 的集成候选上重跑,通过后再合入。Vercel 两项检查显示 Account is blocked,与上述六项 Actions 区分记录。 |
|
复查新 head 34d4d96:已重新构建最新 integration 587e93d(base 043d11c),运行提交内原版 e2e-image-chat.mjs,设置页及保存已通过,但在第258行停下:composer-model-option 实际1项,断言要求2项,尚未完成标记模型实际发送。请按当前 provider rail/分区交互逐个选择并断言具体 fixture 模型,而不是假设同时展示两个服务的总行数。另外后续仍查询 .composer-model-group-label,应同步核实当前分区 DOM。请保留纯生图排除与双能力选中并发送的行为断言,跑通整个脚本后再合入。此次没有证明产品发送回归,也没有完整 E2E 通过。 |
Co-authored-by: koeria <[email protected]>
|
复查 6697044(与最新 main 2270533 合成集成候选,worktree 内独立构建 shared/i18n/desktop,复用 Host debug 二进制,本地 SSE 模型): 诊断(断言前打印): 根因不在脚本: 本轮暂不合入。 |
… chat defaults Unify recent-model availability on isImageOnlyChatModel so a dual-capability model marked for image generation stays chat-eligible, while discovered metadata that publishes no text output still excludes it (vastsa#2253). Call sites pass composerModelMetadata through, and tests cover both inheritance paths.
|
复查默认继承修复:在最新 main e17e5e7 的独立集成候选 808e098 上,默认继承/模型选择等定向测试31/31、相邻测试116/116、desktop typecheck 和构建均通过。原版 scripts/e2e-image-chat.mjs 完整通过,覆盖双能力模型选中实际发送、纯生图排除、生图、下载、编辑、未配置提示,共3次本地图片请求。使用真实 Electron/Host/sidecar及隔离数据、本地模型 fixture,无真实 provider 请求。初次运行因缺少候选 sidecar 构建路径失败,补上复用构建链接后重跑通过,未修改测试断言。 已非强制合入最新 main 并推回作者分支,等待刷新后的 CI,再进行最终合入检查。 |
vastsa
left a comment
There was a problem hiding this comment.
Latest head a170769 completes the previously requested dual-capability inheritance fix. Independent validation from the previous run: 31 focused and 116 adjacent tests, desktop typecheck/build, and full image-chat Electron E2E passed, including marked-model chat send, generation, download, edit and setup navigation. The full E2E was rerun after integrating main d0963be. This run confirms all six latest-head CI checks pass and the GitHub integration tree 1466449841afe9984bca7b9467122a68345a2f40 equals the tested candidate. No live paid provider calls.
Closes #2253
问题
此前模型一旦被标记为生图模型,聊天侧就完全排除:composer 与默认模型菜单移除该模型、菜单拒绝选择、composer 判定不可发送,session launch 直接抛错("The image model cannot be used for conversation")。像 gpt6.1-terra 这类既支持生图又支持对话的模型被迫二选一。
修复
引入能力语义区分(f9578f4):
modelSupportsConversation/isImageOnlyChatModel只把纯生图端点挡在聊天侧之外;双能力(生图 + 对话)模型在聊天侧保持可用。生图绑定本身由 host 侧独立持有,与对话通道无关。composerModelsForProvider/defaultModelOptions依据能力判定过滤:纯生图模型不进聊天菜单,双能力模型保留modelReady仅拦截纯生图模型replacementChatModelId逻辑移除)SubagentEditorSheet)传入 image bindings 参数,纯生图模型不出现在子代理模型菜单,双能力模型可选image-conversation-selection.test.mjs、default-model-display.test.mjs、subagent-models.test.mjs、subagent-editor-presets.test.mjs)验证
pnpm -w run typecheck全部通过apps/desktop相关用例(image-conversation-selection、default-model-display、subagent-models、subagent-editor-presets 等)全部通过scripts/e2e-browser-capture-resize.mjs及其调用路径未修改);该步骤在 main 上同期通过,本次超时判断为环境 flaky,CI 重跑确认元数据参数一致性补齐(回应 review)
isImageOnlyChatModel的第 4 个 metadata 参数此前只有 session launch 传入,其余调用点都没传,导致"未保留命名但output:["image"]的绑定模型"在菜单可选、可发送、launch 才被拒。本提交(4b67b9b)把所有调用点统一到同一个判定来源:defaultModelOptions新增可选discovered参数并解析 discovery 元数据,经providerServesChatModels、keepsAppDefaultModel、loginDefaultModel透传到默认模型、vendor 登录默认与子代理路径(subagentModelDisplay/subagentModelChoices,组件从 store 传providerModels)modelReady(canSend)传入selectedModelInfo;模型菜单selectModel传入候选模型的 discovery 行ModelConfigPage的chatModelOptions、firstModelId、providerReady全部传入 store 的providerModelscomposerModelMetadata/composerModelChatEligible(src/lib/composer-models.ts)新增用例(
image-conversation-selection.test.mjs、native-pi-sessions.test.mjs):vision-image)的 image-only 绑定模型:discovered 元数据output:["image"]时 defaultModelOptions 排除、canSend 不可发送、launch 以MODEL_NOT_CONFIGURED拒绝——三处一致output:["text","image"]):菜单可选、可发送、launch 成功验证:定向套件(image-conversation-selection、composer-models、native-pi-sessions、provider-model-config、composer-send-state、image-generation-default 等 115 用例)全部通过;
tsc -p tsconfig.json --noEmit通过;biome lint 通过;check-style-tokens、check-architecture通过。E2E 适配(第五轮复查)
scripts/e2e-image-chat.mjs已按当前 UI 重写设置页与模型菜单交互,选择器全部从源码核实(SettingsPage/SettingsMenuSelect/ImageGenerationModelRow/ComposerModelList/useComposerModelMenu):[data-nav="settings"]→.settings-search输入「模型」过滤 →.settings-nav-item(智能体分组)直达模型页,替换已移除的「AI」二级入口。.model-image-selector .settings-menu-select-trigger打开 AnchoredMenu,.settings-menu-select-option共 3 项(两个双能力 fixture 绑定 +gpt-image-1纯生图端点),选择双能力模型后断言 toast「已设为生图模型」与settingsGet归一化往返(迁移覆盖保留);原.model-default-trigger/.model-default-option及 11–13px 间距断言随旧行移除,改为断言行内渲染的 provider·model 绑定值。.composer-model-thinking-chip→.composer-model-search input按服务分区搜索定位,断言两个 provider 分组(aria-label)各一项.composer-model-option(共 2 项),gpt-image-1不出现(纯生图端点不进 chat 候选),随后实际选中被标记的双能力模型(aria-checked)并用它发送后续生图/编辑请求;.composer-menu-entry/.composer-model-group-label旧引用替换为当前结构。/models增加gpt-image-1(IMAGE_ONLY_MODEL_ID 命中),使「纯生图不可选」与「双能力保留可选」在同一菜单里直接对拍;未配置生图时的「配置生图模型」拒绝路径原样保留。沙盒无桌面环境,完整 Electron E2E 由维护者/CI 执行;本地已做静态验证:
node --check语法通过、全部选择器在源码中存在、e2e/host.mjs/boot.mjs/wait.mjs/fixture 可正常 import 并启动 fixture handler。会话默认继承统一判定(第七轮回应)
此前
availableRecentModels用旧的内联 image 逻辑过滤最近模型,与isImageOnlyChatModel的判定不一致:双能力但被标记生图的模型会被最近列表排除,纯生图端点在部分路径反而漏排。本次(5d30f36)统一到同一判定来源:availableRecentModels改用isImageOnlyChatModel判定,新增第 4 参discovered,经composerModelMetadata解析 discovery 元数据;inheritedSessionModelBinding/pinnedSessionModelBinding透传Composer.tsx、fast-mode-command.ts、session-coordination.ts、session-slice.tsoutput:["image"]时排除并回落到下一个可聊天模型测试:
test/recent-models.test.mjs更新纯生图端点用例(gpt-image-1现经统一判定排除),新增「双能力默认模型被新会话继承」用例覆盖保存默认、最近选择、image-only discovered 排除、dual discovered 保留四条路径;定向套件recent-models/session-model/session-create20 用例全部通过,tsc --noEmit通过。E2Ee2e-image-chat.mjs中「默认模型继承后可发送」路径(checked:1 断言)随本次判定一致化应可如期通过。