Skip to content

Local-first AI coding agent desktop: Electron + Rust host core + pi Agent Harness + user-installable plugins

fix(settings): use provider feedback after image capability saves

Jack61e33684a51a
diff --git a/apps/desktop/src/components/settings/ModelConfigPage.tsx b/apps/desktop/src/components/settings/ModelConfigPage.tsx
index dc065c016..510f2f0b3 100644
--- a/apps/desktop/src/components/settings/ModelConfigPage.tsx
+++ b/apps/desktop/src/components/settings/ModelConfigPage.tsx
@@ -204,7 +204,9 @@ export function ModelConfigPage() {
const nextSettings = { ...current, ...plan };
await api.setSettings(nextSettings);
useAppStore.setState({ settings: nextSettings });
- showToast(t("settings.imageModelSelected"), { variant: "success" });
+ showToast(t(editingProvider ? "settings.providerUpdated" : "settings.providerSaved"), {
+ variant: "success",
+ });
} else if (copyDraft) {
showToast(t("settings.providerSaved"), { variant: "success" });
} else if (!editingProvider) {
diff --git a/docs/spec/03-runtime/21-image-generation.md b/docs/spec/03-runtime/21-image-generation.md
index 174e8997b..5fa6515d8 100644
--- a/docs/spec/03-runtime/21-image-generation.md
+++ b/docs/spec/03-runtime/21-image-generation.md
@@ -58,6 +58,11 @@ attachment store after realpath containment. Each edit input set is capped at
## Results and recovery
+Saving a provider confirms the provider was saved or updated, including when
+image capabilities were marked or unmarked. It must not claim that an image
+model was selected after deselection. Choosing an image default from the
+summary menu retains the image-selection confirmation.
+
Each result records index, status (`succeeded`, `failed`, `cancelled`), successful
path/MIME type or a safe error code. New files get unique names in session scratch;
editing never overwrites its source. The tool result and transcript retain file
diff --git a/docs/spec/06-delivery/04-e2e-test-plan.md b/docs/spec/06-delivery/04-e2e-test-plan.md
index 9d95e4860..4faa56de7 100644
--- a/docs/spec/06-delivery/04-e2e-test-plan.md
+++ b/docs/spec/06-delivery/04-e2e-test-plan.md
@@ -8,6 +8,18 @@
## 1. Goals
+### E2E-IMAGES-provider-save-feedback
+
+- **Preconditions:** Image configuration UI fixture; English and Chinese.
+- **Steps:** Mark image models and save the provider; choose a different image
+ default from its summary; then unmark the sole image model and save.
+- **Expected:** Provider edits confirm the provider update, including after
+ clearing the image selection. Explicit default selection keeps its specific
+ image-selection confirmation. Persisted bindings retain their existing behavior.
+- **Specs:** 03-runtime/21-image-generation. **Acceptance:** B.
+- **Milestone:** Maintenance. **Status:** Automated by
+ `scripts/e2e-image-generation-ui.mjs`.
+
### E2E-IMAGES-desktop-conversation
- **Preconditions:** Isolated desktop profile and workspace, built image feature,
diff --git a/docs/zh-CN/spec/03-runtime/21-image-generation.md b/docs/zh-CN/spec/03-runtime/21-image-generation.md
index ac47fe1b3..732d3a301 100644
--- a/docs/zh-CN/spec/03-runtime/21-image-generation.md
+++ b/docs/zh-CN/spec/03-runtime/21-image-generation.md
@@ -6,6 +6,10 @@
## 配置
+保存服务商时,无论是否勾选或取消生图标记,成功提示都确认“服务已保存”
+或“服务已更新”,避免取消标记后仍声称“已设为生图模型”。
+从生图摘要菜单选择默认模型时,仍显示生图选择成功提示。
+
模型高级设置将“设为生图模型”与图片、文档附件能力放在同一能力组中,不再单独占一行;复选框支持多选,保存服务商表单后把所有勾选模型写入 `imageGenerationModels`,取消不会改变设置。保存候选不会替换默认对话模型。取消勾选当前生图模型并保存后,默认生图绑定改为剩余的第一个可用候选;没有可用候选时清空。取消标记的模型恢复为可选对话模型,重新打开设置后仍保持这一状态。保存其他服务商时保留仍可用的默认生图模型。默认模型下方同一面板中的“生图模型”显示当前默认,并提供菜单从所有已标记候选中选择一个。没有候选时隐藏摘要行;已存在但服务商停用、缺少凭据或模型移除的候选仅显示“暂不可用”。OAuth 账户不适用,也不会自动回退。
所有已标记的服务商/模型组合都会从默认对话模型选择器、服务商快速设为默认操作和 Composer 模型菜单中排除。其他服务商的同名模型独立保留。已有会话绑定和历史不改写;仍绑定任一生图候选的会话必须选择对话模型才能发送,运行时也会在推理前拒绝所有已标记生图模型。
diff --git a/docs/zh-CN/spec/06-delivery/04-e2e-test-plan.md b/docs/zh-CN/spec/06-delivery/04-e2e-test-plan.md
index a52de6b78..2ff9aea9a 100644
--- a/docs/zh-CN/spec/06-delivery/04-e2e-test-plan.md
+++ b/docs/zh-CN/spec/06-delivery/04-e2e-test-plan.md
@@ -9,6 +9,16 @@
---
+### E2E-IMAGES-provider-save-feedback
+
+- **前提:** 生图配置 UI fixture,中英文界面。
+- **步骤:** 勾选生图模型并保存服务商;从摘要菜单切换默认生图模型;
+ 再取消唯一生图模型的标记并保存。
+- **预期:** 服务商编辑确认“服务已更新”,清除生图选择后也不会提示已选择
+ 生图模型;摘要菜单切换仍显示生图选择成功提示。绑定保存行为不变。
+- **规格:** 03-runtime/21-image-generation。**验收:** B。
+- **里程碑:** 维护。**状态:** `scripts/e2e-image-generation-ui.mjs` 自动覆盖。
+
### E2E-IMAGES-deselect-default
- **前提:** 只有一个服务商、一个模型,且该模型已标记为生图模型。
diff --git a/scripts/e2e/image-generation-ui.tsx b/scripts/e2e/image-generation-ui.tsx
index 6da30e75a..b427c991d 100644
--- a/scripts/e2e/image-generation-ui.tsx
+++ b/scripts/e2e/image-generation-ui.tsx
@@ -165,6 +165,8 @@ globalThis.imageGenerationProbe = async () => {
(element) => element.textContent?.includes(i18n.t("settings.imageModel")),
)!;
assert(imageRow, "saved image model summary missing");
+ assert(useAppStore.getState().toasts.at(-1)?.message === i18n.t("settings.providerUpdated"),
+ "marking models should confirm the provider update");
const gap = imageRow.getBoundingClientRect().top - defaultRow.getBoundingClientRect().bottom;
assert(gap >= 11 && gap <= 13, `model defaults should be adjacent rows, got ${gap}px`);
assert(settings.defaultModelId === "chat-model", "image model changed default chat model");
@@ -224,6 +226,8 @@ globalThis.imageGenerationProbe = async () => {
"image default provider did not switch",
);
assert(settings.defaultProviderId === "chat" && settings.defaultModelId === "chat-model", "image switch changed chat default");
+ assert(useAppStore.getState().toasts.at(-1)?.message === i18n.t("settings.imageModelSelected"),
+ "explicit image default selection lost its specific confirmation");
assert(row.textContent?.includes("Images B"), "new provider name missing");
for (const invalid of [
{ ...alternate, enabled: false },
@@ -262,6 +266,8 @@ globalThis.imageGenerationProbe = async () => {
click(imageModelToggle(i18n.t("settings.imageModelSelected")));
click(button(i18n.t("settings.saveProvider")));
await until(() => !document.querySelector(".provider-setup-dialog"), "unmark save did not finish");
+ assert(useAppStore.getState().toasts.at(-1)?.message === i18n.t("settings.providerUpdated"),
+ "unmark save incorrectly claims an image model was selected");
assert(settings.imageGeneration === null, "unmark kept the old image default");
assert(settings.imageGenerationModels?.length === 0, "unmark kept image candidates");
// Remount settings from the saved API value, then reopen the provider.
@@ -329,6 +335,7 @@ globalThis.imageGenerationProbe = async () => {
ok: true,
locales: ["en", "zh-CN"],
scenarios: [
+ "provider-save-feedback-for-image-mark-and-unmark",
"advanced-save-cancel",
"unmark-only-image-model-save-reopen-chat-selection",
"advanced-provider-switch",