Skip to content

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

fix(desktop): keep unavailable image model settings reachable

Tioit-Wang30496ad76fc3
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 1c56952d0..d96c93bf4 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -192,6 +192,11 @@ jobs:
- name: Run provider optional client certificate E2E
run: xvfb-run --auto-servernum pnpm test:e2e:provider-client-certificate
+ - name: Run image model settings Electron tests
+ run: |
+ xvfb-run --auto-servernum node --test apps/desktop/test/image-generation-row-empty-state.test.mjs
+ xvfb-run --auto-servernum node scripts/e2e-image-generation-ui.mjs
+
- name: Run browser capture/resize E2E
run: |
node --test scripts/e2e/with-openbox.test.mjs
diff --git a/apps/desktop/src/components/settings/ImageGenerationModelRow.tsx b/apps/desktop/src/components/settings/ImageGenerationModelRow.tsx
index 8f94fa592..78801c998 100644
--- a/apps/desktop/src/components/settings/ImageGenerationModelRow.tsx
+++ b/apps/desktop/src/components/settings/ImageGenerationModelRow.tsx
@@ -32,30 +32,12 @@ export function ImageGenerationModelRow({
// selection (an explicitly cleared list is not resurrected), a missing list
// falls back to the legacy single binding, and a signed-in vendor account
// offers the image model it answers with. The settings page validates the
- // user's choice against this same list, so every row shown here is selectable.
+ // user's choice against this same list.
const candidates = imageGenerationPickerCandidates(
settings.imageGenerationModels,
binding,
providers,
);
- // The row never disappears, not even with nothing to pick (#2563): the
- // built-in GenerateImages error sends the user here, and a hidden row
- // turned that pointer into a dead end.
- if (candidates.length === 0) {
- return (
- <div className="settings-row model-default-row model-image-row">
- <div className="settings-row-copy model-default-copy">
- <div className="settings-row-title model-default-label">{t("settings.imageModel")}</div>
- <div className="settings-row-detail model-default-value">
- <span className="model-default-empty" role="status">
- {t("settings.imageModelNoneAvailable")}
- </span>
- </div>
- </div>
- </div>
- );
- }
-
const activeCandidate = binding
? candidates.find((candidate) =>
candidate.providerId === binding.providerId &&
@@ -81,9 +63,14 @@ export function ImageGenerationModelRow({
disabled: !available,
};
});
- // Disabled rows are not choices. With none left, the summary stays hidden
- // instead of showing a checked model the user can no longer pick.
- if (!options.some((option) => !option.disabled)) return null;
+ const runnableCount = options.filter((option) => !option.disabled).length;
+ // Keep the setting reachable from GenerateImages errors even when there is
+ // nothing to pick (#2563). Distinguish missing setup from unavailable models.
+ const status = candidates.length === 0
+ ? "settings.imageModelNoneAvailable"
+ : activeCandidate || runnableCount === 0
+ ? "settings.imageModelUnavailable"
+ : "settings.imageModelUnset";
const checkedId = valid && activeCandidate ? imageModelOptionId(activeCandidate) : "";
return (
@@ -99,12 +86,12 @@ export function ImageGenerationModelRow({
</>
) : (
<span className="model-default-empty" role="status">
- {t(activeCandidate ? "settings.imageModelUnavailable" : "settings.imageModelUnset")}
+ {t(status)}
</span>
)}
</div>
</div>
- {onChange && (options.filter((option) => !option.disabled).length > 1 || !checkedId) ? (
+ {onChange && runnableCount > 0 && (runnableCount > 1 || !checkedId) ? (
<SettingsMenuSelect
className="model-image-selector settings-model-select"
label={t("settings.imageModel")}
diff --git a/apps/desktop/test/image-generation-row-empty-state.test.mjs b/apps/desktop/test/image-generation-row-empty-state.test.mjs
index f59d9e65d..eb67ebffd 100644
--- a/apps/desktop/test/image-generation-row-empty-state.test.mjs
+++ b/apps/desktop/test/image-generation-row-empty-state.test.mjs
@@ -4,9 +4,8 @@
* The built-in GenerateImages error sends the user to
* Settings > Models > Image generation model (#2563). The row used to vanish
* entirely while no image-capable model existed, turning that pointer into a
- * dead end; this pins that an empty candidate list still renders the row with
- * an explicit "nothing available" state, and that a real candidate still gets
- * the normal picker.
+ * a dead end. Cover an empty list, a list with no runnable candidate, and
+ * the normal picker when candidates are runnable.
*/
import assert from "node:assert/strict";
import { spawn } from "node:child_process";
@@ -20,7 +19,7 @@ import { repositoryRoot, resolveElectronBinary } from "../../../scripts/e2e/boot
const root = repositoryRoot();
const { build } = createRequire(join(root, "packages/agent-runtime/package.json"))("esbuild");
-test("image model row stays visible without candidates and picks normally with them", {
+test("image model row stays visible when empty or unavailable and keeps working when runnable", {
timeout: 60_000,
skip: process.platform === "linux" && !process.env.DISPLAY ? "Electron requires a display" : false,
}, async () => {
@@ -35,8 +34,6 @@ import { createInstance } from "i18next";
import { I18nextProvider } from "react-i18next";
import { catalogs } from "@pi-desktop/i18n";
import { ImageGenerationModelRow } from "./apps/desktop/src/components/settings/ImageGenerationModelRow";
-const i18n = createInstance();
-await i18n.init({ lng: "en", resources: { en: { translation: catalogs.en } } });
const provider = {
id: "prov", name: "Prov", enabled: true, hasSecret: true, hasOauth: false,
authKind: "api_key_and_base_url", baseUrl: "https://example.test",
@@ -47,33 +44,48 @@ const other = {
authKind: "api_key_and_base_url", baseUrl: "https://other.test",
models: [{ id: "img-two" }],
};
-function Fixture({ settings }) {
- return <ImageGenerationModelRow settings={settings} providers={[provider, other]} onChange={() => {}} />;
+function Fixture({ settings, providers }) {
+ return <ImageGenerationModelRow settings={settings} providers={providers} onChange={() => {}} />;
}
-const root = createRoot(document.getElementById("root"));
-const render = (settings) => flushSync(() => root.render(
- <I18nextProvider i18n={i18n}><Fixture settings={settings} /></I18nextProvider>));
-const emptySettings = { imageGenerationModels: [], imageGeneration: null };
-render(emptySettings);
-const row = () => document.querySelector(".model-image-row");
-assert(row(), "Row must render with no image candidates");
-assert(row().textContent.includes(i18n.t("settings.imageModel")), "Row title must name the setting");
-assert(
- row().textContent.includes(i18n.t("settings.imageModelNoneAvailable")),
- "Empty state must explain that no image model is available",
-);
-const withCandidate = {
- imageGenerationModels: [{ providerId: "prov", modelId: "img-model" }, { providerId: "other", modelId: "img-two" }],
- imageGeneration: { providerId: "prov", modelId: "img-model" },
+window.imageRowProbe = async () => {
+ const i18n = createInstance();
+ await i18n.init({ lng: "en", resources: { en: { translation: catalogs.en } } });
+ const root = createRoot(document.getElementById("root"));
+ const render = (settings, providers) => flushSync(() => root.render(
+ <I18nextProvider i18n={i18n}><Fixture settings={settings} providers={providers} /></I18nextProvider>));
+ const row = () => document.querySelector(".model-image-row");
+ const picker = () => row()?.querySelector(".model-image-selector");
+ const check = (condition, message) => {
+ if (!condition) throw new Error(message);
+ };
+ const checkStatus = (key) => {
+ check(row()?.querySelector(".model-default-label")?.textContent === i18n.t("settings.imageModel"),
+ "The row must keep its settings label: " + key);
+ check(row()?.querySelector('[role="status"]')?.textContent === i18n.t(key),
+ "Expected image model status: " + key);
+ check(!picker(), "Picker must be absent with no runnable candidates");
+ };
+
+ render({ imageGenerationModels: [], imageGeneration: null }, [provider, other]);
+ checkStatus("settings.imageModelNoneAvailable");
+
+ const configured = {
+ imageGenerationModels: [{ providerId: "prov", modelId: "img-model" }, { providerId: "other", modelId: "img-two" }],
+ imageGeneration: { providerId: "prov", modelId: "img-model" },
+ };
+ const unavailable = [{ ...provider, enabled: false }, { ...other, hasSecret: false }];
+ render(configured, unavailable);
+ checkStatus("settings.imageModelUnavailable");
+ render({ ...configured, imageGeneration: null }, unavailable);
+ checkStatus("settings.imageModelUnavailable");
+
+ render(configured, [provider, other]);
+ check(row()?.querySelector(".model-default-provider")?.textContent === "Prov" &&
+ row()?.querySelector(".model-default-model")?.textContent === "img-model",
+ "Row must show the configured provider and model");
+ check(picker(), "Picker must appear when multiple candidates are runnable");
+ return { ok: true };
};
-render(withCandidate);
-assert(row(), "Row must render with a candidate");
-assert(
- row().textContent.includes("Prov") && row().textContent.includes("img-model"),
- "Row must show the configured provider and model",
-);
-assert(document.querySelector(".model-image-selector"), "Picker must appear for a runnable candidate");
-window.probe = { ok: true };
` },
outfile: join(temp, "renderer.js"), bundle: true, platform: "browser", format: "esm", jsx: "automatic",
define: { "process.env.NODE_ENV": '"production"', "import.meta.env.DEV": "false" },
@@ -88,18 +100,26 @@ app.setPath("userData", path.join(__dirname, "profile"));
app.whenReady().then(async () => {
const win = new BrowserWindow({ show: false, webPreferences: { sandbox: true, contextIsolation: true, nodeIntegration: false } });
win.webContents.on("console-message", (event) => console.error(event.message));
- try { await win.loadFile(path.join(__dirname, "index.html")); console.log("IMAGE_ROW " + JSON.stringify(await win.webContents.executeJavaScript("window.probe"))); app.exit(0); }
+ try { await win.loadFile(path.join(__dirname, "index.html")); console.log("IMAGE_ROW " + JSON.stringify(await win.webContents.executeJavaScript("window.imageRowProbe()"))); app.exit(0); }
catch (error) { console.error(error); app.exit(1); }
});`);
const env = { ...process.env };
delete env.ELECTRON_RUN_AS_NODE;
const child = spawn(resolveElectronBinary(root).electronBinary, [join(temp, "main.cjs")], { env, windowsHide: true, stdio: ["ignore", "pipe", "pipe"] });
let output = "";
- for (const stream of [child.stdout, child.stderr]) stream.on("data", (data) => { output += data; });
- const timeout = setTimeout(() => child.kill(), 30_000);
+ for (const stream of [child.stdout, child.stderr]) {
+ stream.setEncoding("utf8");
+ stream.on("data", (data) => { output += data; });
+ }
+ let timedOut = false;
+ const timeout = setTimeout(() => {
+ timedOut = true;
+ child.kill();
+ }, 30_000);
let code;
try { code = await new Promise((resolve, reject) => { child.once("error", reject); child.once("close", resolve); }); }
finally { clearTimeout(timeout); }
+ assert.equal(timedOut, false, `Image row Electron probe timed out:\n${output}`);
assert.equal(code, 0, output);
assert.match(output, /IMAGE_ROW {"ok":true/);
} finally { await rm(temp, { recursive: true, force: true }); }
diff --git a/apps/desktop/test/model-advanced-capabilities.test.mjs b/apps/desktop/test/model-advanced-capabilities.test.mjs
index d1a882b07..941b2da33 100644
--- a/apps/desktop/test/model-advanced-capabilities.test.mjs
+++ b/apps/desktop/test/model-advanced-capabilities.test.mjs
@@ -94,7 +94,7 @@ test("the capability row carries no explanatory copy or extra controls", () => {
});
-test("image generation selection hides the summary when nothing can be chosen", () => {
+test("image generation marking lives with attachment capabilities and uses shared candidates", () => {
assert.match(
pickerSource,
/className="provider-chosen-capability-rows">[\s\S]*?settings\.setImageModel/,
@@ -110,12 +110,6 @@ test("image generation selection hides the summary when nothing can be chosen",
// only while no list was ever saved, plus a signed-in vendor account's image
// model — now lives in the shared helper, pinned by image-generation-default.test.mjs.
assert.ok(imageModelRowSource.includes("imageGenerationPickerCandidates("));
- assert.match(imageModelRowSource, /if \(!options\.some\(\(option\) => !option\.disabled\)\) return null;/);
- // With no candidates the row must still render, so the GenerateImages
- // error pointer lands on a visible setting instead of a dead end (#2563).
- assert.match(imageModelRowSource, /if \(candidates\.length === 0\) \{/);
- assert.match(imageModelRowSource, /imageModelNoneAvailable/);
- assert.match(imageModelRowSource, /imageModelUnavailable/);
});
test("the Composer model rows use the provider binding for vision badges", () => {
diff --git a/docs/spec/03-runtime/21-image-generation.md b/docs/spec/03-runtime/21-image-generation.md
index ddddda73f..b9682fb51 100644
--- a/docs/spec/03-runtime/21-image-generation.md
+++ b/docs/spec/03-runtime/21-image-generation.md
@@ -12,7 +12,31 @@ longer offer — the stored candidate list changed between the menu rendering an
the click — reports that the image model could not be saved instead of silently
keeping the previous default.
-Model Advanced exposes **Set as image model** alongside the image and document attachment capabilities in the model capability group, not as a separate control row. The checkbox is multi-select: saving a provider persists every checked model in `imageGenerationModels`; Cancel leaves settings unchanged. Saving candidates does not replace the default conversation model. Unchecking every image model on the provider that holds the current default clears that default, even when another provider still has a runnable candidate. The Models page drops the check and does not select the other candidate automatically. Unchecking the current model while another model on the same provider stays marked moves the default to the first runnable marked candidate. The unmarked model is available for chat again after saving and reopening settings. Saving another provider preserves a still-runnable image default. Below the default model row in the same defaults panel, **Image generation model** shows the current default and offers a menu to choose one from all marked candidates. When no candidate is configured, or none of them can be selected, the summary row is hidden. A candidate whose provider still exists but is disabled, credential-less or otherwise unusable displays only **Currently unavailable** while another marked candidate can still be selected; a candidate whose provider row is gone is dropped from the stored list on the next settings read or write instead of staying listed. A signed-in ChatGPT (Codex) account is eligible for its own image model, which its provider row offers next to the models it configures; every other OAuth account is not, and there is no fallback.
+Model Advanced exposes **Set as image model** alongside the image and document
+attachment capabilities in the model capability group, not as a separate control
+row. The checkbox is multi-select: saving a provider persists every checked model
+in `imageGenerationModels`; Cancel leaves settings unchanged. Saving candidates
+does not replace the default conversation model. Unchecking every image model on
+the provider that holds the current default clears that default, even when
+another provider still has a runnable candidate. The Models page drops the check
+and does not select the other candidate automatically. Unchecking the current
+model while another model on the same provider stays marked moves the default to
+the first runnable marked candidate. The unmarked model is available for chat
+again after saving and reopening settings. Saving another provider preserves a
+still-runnable image default.
+
+The **Image generation model** row in Models settings stays visible. With no
+candidates it points to **Set as image model** in the provider's model settings.
+With candidates but none runnable it shows **Currently unavailable**, even if no
+default is selected. Neither state shows a picker. With runnable candidates the
+row shows the selected provider and model, **Not configured** if no default is
+selected, or **Currently unavailable** if the selected candidate cannot run. The
+picker lets the user choose a runnable candidate without silently changing the
+default. A candidate whose provider row is gone is dropped from the stored list on
+the next settings read or write. A signed-in ChatGPT (Codex) account is eligible
+for its own image model, which its provider row offers next to the models it
+configures; every other OAuth account is not, and there is no fallback.
+
Only a pure image-generation endpoint is excluded from the default conversation picker, provider quick-default action, and Composer model menu; a marked model that also supports conversation keeps its chat eligibility everywhere, because the image binding is host-owned and independent of the conversation route (#2253). A pure image-generation endpoint is recognized by a model id its family reserves for image generation (for example `gpt-image-*`, DALL·E or Imagen ids) or by published output modalities that name no text output; unknown custom metadata stays chat-eligible. Other providers with the same model ID remain independent. Existing conversation bindings and history are preserved; a conversation still pinned to a pure image candidate must select a chat model before sending. Runtime launch rejects a marked pure image-generation model before inference.
The marking checkbox has localized help explaining chat/default-menu exclusion
@@ -42,6 +66,10 @@ files per item for editing; a previous generated path supports iterative edits.
Prompt length is bounded at 32,000 characters. Unsupported or excessive input is
rejected rather than truncated. Plan and Goal cannot execute the tool.
+Without a configured image binding the tool returns `IMAGE_NOT_CONFIGURED` and
+points to **Settings → Models → Image generation model**. The message explains
+that MCP image tools are separate and do not serve as this tool's backend.
+
The bundled `pi-desktop/imagegen` skill is discoverable in ordinary sessions and
loads through the existing Skill tool. It teaches prompting, batches, reference
edits, preserving originals, partial-failure handling and project asset delivery.
diff --git a/docs/spec/06-delivery/e2e/conversation.md b/docs/spec/06-delivery/e2e/conversation.md
index 3003eb411..12e31f1a4 100644
--- a/docs/spec/06-delivery/e2e/conversation.md
+++ b/docs/spec/06-delivery/e2e/conversation.md
@@ -375,8 +375,9 @@ folder/mixed-selection behavior. No system clipboard contents are changed.
image checkbox. Cancel once, repeat and Save, then reopen settings and editor.
- **Expected:** Cancel preserves both configurations. Save removes the model and
its image candidate and clears the image default, even when another image
- candidate remains on this or another provider. The settings summary therefore
- shows the unavailable state until the user explicitly chooses a new default.
+ candidate remains on this or another provider. The image model row remains
+ visible: it shows **Not configured** with a picker when another candidate is
+ runnable, or an empty-state hint without a picker when no candidates remain.
An unaffected chat default stays unchanged; a removed chat default still falls
back to the first configured model. Reload preserves results.
- **Specs:** 03-runtime/21-image-generation. **Acceptance:** B.
@@ -388,27 +389,30 @@ folder/mixed-selection behavior. No system clipboard contents are changed.
- **Preconditions:** Isolated desktop profile and workspace, built image feature,
local chat and OpenAI Images HTTP fixtures; no live provider credentials.
- **Steps:** Open Models settings with no image model configured; verify the image
- summary row is absent. Open a provider's Advanced model settings and verify
- **Set as image model** is grouped with the image/document attachment
- capabilities and can be checked for multiple models. Save, use the image
- summary menu to choose one marked model as the default, then submit a
- two-image request through the composer and edit the first output through a
+ model row shows the no-candidates hint without a picker. Open a provider's
+ Advanced model settings and verify **Set as image model** is grouped with
+ the image/document attachment capabilities and can be checked for multiple
+ models. Save, choose a marked model from the image summary menu, then submit
+ a two-image request through the composer and edit the first output through a
follow-up message. Collapse tool details.
-- **Expected:** After saving, the image summary appears with a 12px default-row
- gap and lists all marked candidates, the selected default is changeable
- without changing the chat default, decoded image previews stay outside
- collapsed process details, multipart source upload is used for editing,
+- **Expected:** After saving, the image summary keeps its 12px default-row gap
+ and lists all marked candidates in the picker. Changing the image default does
+ not change the chat default, decoded image previews stay outside collapsed
+ process details, multipart source upload is used for editing,
originals are preserved, and no image HTTP request occurs while unconfigured.
-- **Settings interactions:** The unconfigured state renders no image summary.
- Mark candidates in the attachment capability group, save, and select one
- from the summary menu. An existing missing/disabled candidate shows only
- Currently unavailable. Covered in `scripts/e2e-image-generation-ui.mjs`.
+- **Settings interactions:** Mark candidates in the attachment capability group,
+ save, and select one from the summary menu. A missing or disabled default
+ shows **Currently unavailable**; another runnable candidate remains selectable.
+ When all marked models are unavailable, the row still shows **Currently
+ unavailable**, without a picker. Covered in `scripts/e2e-image-generation-ui.mjs`
+ and `apps/desktop/test/image-generation-row-empty-state.test.mjs`.
- **Image model deselection (#826):** With one provider and one model marked
for images, uncheck it in the provider editor. Cancel must preserve the image
default; Save must clear both its candidate and default binding. Reopen settings
- and the editor: the image row stays hidden, the checkbox stays unchecked, and
- the model can be selected as the chat default. Covered in English and Chinese
- by `scripts/e2e-image-generation-ui.mjs` with an API-boundary fixture.
+ and the editor: the image row shows the no-candidates hint without a picker,
+ the checkbox stays unchecked, and the model can be the chat default. Covered
+ in English and Chinese by `scripts/e2e-image-generation-ui.mjs` with an
+ API-boundary fixture.
- **Conversation selection:** Every marked image provider/model is absent from
default and Composer candidates. Other providers retain same-ID models. An
existing session pinned to any marked image binding is rejected before
diff --git a/packages/i18n/src/locales/de/index.ts b/packages/i18n/src/locales/de/index.ts
index 44139ff65..8a2789e2c 100644
--- a/packages/i18n/src/locales/de/index.ts
+++ b/packages/i18n/src/locales/de/index.ts
@@ -1120,7 +1120,7 @@ export const de = {
"imageModel": "Bildgenerierungsmodell",
"imageModelUnset": "Nicht konfiguriert",
"imageModelUnavailable": "Derzeit nicht verfügbar",
- "imageModelNoneAvailable": "Kein Bildmodell verfügbar. Markieren Sie in den Einstellungen eines Anbieters ein Modell als zur Bilderzeugung fähig.",
+ "imageModelNoneAvailable": "Kein Bildmodell verfügbar. Wählen Sie in den Modelleinstellungen eines Anbieters „$t(settings.setImageModel)“.",
"imageModelSaveFailed": "Bildmodell konnte nicht gespeichert werden.",
"clearImageModel": "Löschen",
"setImageModel": "Als Bildmodell festlegen",
diff --git a/packages/i18n/src/locales/en/index.ts b/packages/i18n/src/locales/en/index.ts
index fd681470e..95fe9c602 100644
--- a/packages/i18n/src/locales/en/index.ts
+++ b/packages/i18n/src/locales/en/index.ts
@@ -1130,7 +1130,7 @@ deleteRunningSessionBlocked: "Stop the running session before deleting it.",
imageModel: "Image generation model",
imageModelUnset: "Not configured",
imageModelUnavailable: "Currently unavailable",
- imageModelNoneAvailable: "No image generation model available. Mark a model as image-capable in a provider's model settings.",
+ imageModelNoneAvailable: "No image generation model available. Use “$t(settings.setImageModel)” in a provider's model settings.",
imageModelSaveFailed: "Could not save the image model.",
clearImageModel: "Clear",
setImageModel: "Set as image model",
diff --git a/packages/i18n/src/locales/es/index.ts b/packages/i18n/src/locales/es/index.ts
index 5e22cc197..0ab3a0b7a 100644
--- a/packages/i18n/src/locales/es/index.ts
+++ b/packages/i18n/src/locales/es/index.ts
@@ -1120,7 +1120,7 @@ export const es = {
"imageModel": "Modelo de imágenes",
"imageModelUnset": "Sin configurar",
"imageModelUnavailable": "No disponible por ahora",
- "imageModelNoneAvailable": "No hay ningún modelo de generación de imágenes disponible. Marca un modelo como capaz de generar imágenes en los ajustes del modelo de un proveedor.",
+ "imageModelNoneAvailable": "No hay ningún modelo de generación de imágenes disponible. Usa «$t(settings.setImageModel)» en los ajustes de modelos de un proveedor.",
"imageModelSaveFailed": "No se pudo guardar el modelo.",
"clearImageModel": "Borrar",
"setImageModel": "Usar para generar imágenes",
diff --git a/packages/i18n/src/locales/fr/index.ts b/packages/i18n/src/locales/fr/index.ts
index 137fb95ec..31f6ce876 100644
--- a/packages/i18n/src/locales/fr/index.ts
+++ b/packages/i18n/src/locales/fr/index.ts
@@ -1120,7 +1120,7 @@ export const fr = {
"imageModel": "Modèle de génération d’images",
"imageModelUnset": "Non configuré",
"imageModelUnavailable": "Indisponible pour le moment",
- "imageModelNoneAvailable": "Aucun modèle de génération d’images disponible. Marquez un modèle comme capable de générer des images dans les réglages des modèles d’un fournisseur.",
+ "imageModelNoneAvailable": "Aucun modèle de génération d’images disponible. Utilisez « $t(settings.setImageModel) » dans les réglages des modèles d’un fournisseur.",
"imageModelSaveFailed": "Impossible d’enregistrer le modèle.",
"clearImageModel": "Effacer",
"setImageModel": "Définir comme modèle d’images",
diff --git a/packages/i18n/src/locales/ko/index.ts b/packages/i18n/src/locales/ko/index.ts
index 6b849f3e7..98381adc5 100644
--- a/packages/i18n/src/locales/ko/index.ts
+++ b/packages/i18n/src/locales/ko/index.ts
@@ -1127,7 +1127,7 @@ export const ko = {
"imageModel": "이미지 생성 모델",
"imageModelUnset": "설정되지 않음",
"imageModelUnavailable": "현재 사용 불가",
- "imageModelNoneAvailable": "사용 가능한 이미지 생성 모델이 없습니다. 제공자 모델 설정에서 모델을 이미지 생성 가능으로 표시하세요.",
+ "imageModelNoneAvailable": "사용 가능한 이미지 생성 모델이 없습니다. 제공자의 모델 설정에서 ‘$t(settings.setImageModel)’을 선택하세요.",
"imageModelSaveFailed": "이미지 모델을 저장할 수 없습니다.",
"clearImageModel": "지우기",
"setImageModel": "이미지 모델로 설정",
diff --git a/packages/i18n/src/locales/pt-BR/index.ts b/packages/i18n/src/locales/pt-BR/index.ts
index d2e13b997..f8f4733a1 100644
--- a/packages/i18n/src/locales/pt-BR/index.ts
+++ b/packages/i18n/src/locales/pt-BR/index.ts
@@ -1117,7 +1117,7 @@ export const ptBR = {
imageModel: "Modelo de imagens",
imageModelUnset: "Sem configurar",
imageModelUnavailable: "Atualmente indisponível",
- imageModelNoneAvailable: "Nenhum modelo de geração de imagens disponível. Marque um modelo como capaz de gerar imagens nas configurações de modelo de um provedor.",
+ imageModelNoneAvailable: "Nenhum modelo de geração de imagens disponível. Use “$t(settings.setImageModel)” nas configurações de modelos de um provedor.",
imageModelSaveFailed: "Não foi possível salvar o modelo de imagem.",
clearImageModel: "Limpar",
setImageModel: "Definir como modelo de geração de imagens",
diff --git a/packages/i18n/src/locales/tr/index.ts b/packages/i18n/src/locales/tr/index.ts
index 589a63bef..e61cde3fe 100644
--- a/packages/i18n/src/locales/tr/index.ts
+++ b/packages/i18n/src/locales/tr/index.ts
@@ -1127,7 +1127,7 @@ export const tr = {
"imageModel": "Görsel oluşturma modeli",
"imageModelUnset": "Yapılandırılmadı",
"imageModelUnavailable": "Şu anda kullanılamıyor",
- "imageModelNoneAvailable": "Kullanılabilir görsel üretim modeli yok. Bir sağlayıcının model ayarlarında bir modeli görsel üretebilir olarak işaretleyin.",
+ "imageModelNoneAvailable": "Kullanılabilir görsel üretim modeli yok. Sağlayıcının model ayarlarında “$t(settings.setImageModel)” seçeneğini kullanın.",
"imageModelSaveFailed": "Görsel modeli kaydedilemedi.",
"clearImageModel": "Temizle",
"setImageModel": "Görsel modeli olarak ayarla",
diff --git a/packages/i18n/src/locales/zh-CN/index.ts b/packages/i18n/src/locales/zh-CN/index.ts
index db315cdc2..4356c4310 100644
--- a/packages/i18n/src/locales/zh-CN/index.ts
+++ b/packages/i18n/src/locales/zh-CN/index.ts
@@ -1123,7 +1123,7 @@ deleteRunningSessionBlocked: "请先停止运行中的会话,再删除它。",
imageModel: "生图模型",
imageModelUnset: "未配置",
imageModelUnavailable: "暂不可用",
- imageModelNoneAvailable: "暂无可用的生图模型,可在服务商的模型设置中将模型标记为生图模型。",
+ imageModelNoneAvailable: "暂无可用的生图模型。请在服务商的模型设置中选择「$t(settings.setImageModel)」。",
imageModelSaveFailed: "无法保存生图模型。",
clearImageModel: "清除",
setImageModel: "设为生图模型",
diff --git a/packages/i18n/src/locales/zh-TW/index.ts b/packages/i18n/src/locales/zh-TW/index.ts
index 6e8174bb3..1c982e300 100644
--- a/packages/i18n/src/locales/zh-TW/index.ts
+++ b/packages/i18n/src/locales/zh-TW/index.ts
@@ -1123,7 +1123,7 @@ deleteRunningSessionBlocked: "請先停止執行中的會話,再刪除它。",
imageModel: "生圖模型",
imageModelUnset: "未設定",
imageModelUnavailable: "暫不可用",
- imageModelNoneAvailable: "暫無可用的生圖模型,可在服務商的模型設定中將模型標記為生圖模型。",
+ imageModelNoneAvailable: "暫無可用的生圖模型。請在服務商的模型設定中選擇「$t(settings.setImageModel)」。",
imageModelSaveFailed: "無法儲存生圖模型。",
clearImageModel: "清除",
setImageModel: "設為生圖模型",
diff --git a/scripts/e2e/image-generation-ui.tsx b/scripts/e2e/image-generation-ui.tsx
index 799d6f901..d45d0e393 100644
--- a/scripts/e2e/image-generation-ui.tsx
+++ b/scripts/e2e/image-generation-ui.tsx
@@ -126,6 +126,12 @@ globalThis.imageGenerationProbe = async () => {
[...document.querySelectorAll<HTMLInputElement>(
".provider-chosen-capability input[type=\"checkbox\"]",
)].find((element) => element.getAttribute("aria-label") === label);
+ const findImageRow = () => container.querySelector(".model-image-row");
+ const expectStatusWithoutPicker = (key: "settings.imageModelNoneAvailable" | "settings.imageModelUnavailable") => {
+ const row = findImageRow();
+ assert(row?.querySelector('[role="status"]')?.textContent === i18n.t(key), `expected image model status: ${key}`);
+ assert(!row?.querySelector('button[aria-haspopup="listbox"]'), "unexpected image model picker");
+ };
try {
for (const locale of ["en", "zh-CN"]) {
await i18n.changeLanguage(locale);
@@ -136,10 +142,7 @@ globalThis.imageGenerationProbe = async () => {
settings = { ...settings, imageGeneration: null, imageGenerationModels: null };
flushSync(() => useAppStore.setState({ settings }));
render();
- const initialImageRow = [...container.querySelectorAll<HTMLElement>(".settings-row")].find(
- (element) => element.textContent?.includes(i18n.t("settings.imageModel")),
- );
- assert(!initialImageRow, "unconfigured image model row should be hidden");
+ expectStatusWithoutPicker("settings.imageModelNoneAvailable");
// Enter from the real model settings page, not the advanced pane alone.
await editProviderForModelSettings();
await until(
@@ -250,6 +253,10 @@ globalThis.imageGenerationProbe = async () => {
assert(row.querySelector('[role="status"]')?.textContent === i18n.t("settings.imageModelUnavailable"), "unavailable state missing");
assert(!row.querySelector(".model-default-provider"), "unavailable binding still displays provider");
}
+ flushSync(() => useAppStore.setState({
+ providers: [{ ...provider, enabled: false }, { ...alternate, hasSecret: false }, chatProvider],
+ }));
+ expectStatusWithoutPicker("settings.imageModelUnavailable");
settings = { ...settings, imageGeneration: null };
flushSync(() => useAppStore.setState({ settings, providers }));
const unsetImageRow = [...container.querySelectorAll<HTMLElement>(".settings-row")].find(
@@ -291,7 +298,7 @@ globalThis.imageGenerationProbe = async () => {
flushSync(() => root.render(null));
flushSync(() => useAppStore.setState({ settings: structuredClone(settings) }));
render();
- assert(!container.querySelector(".model-image-row"), "image summary returned after reopen");
+ expectStatusWithoutPicker("settings.imageModelNoneAvailable");
await editProviderForModelSettings();
await until(() => !!imageModelToggle(i18n.t("settings.setImageModel")), "unmarked checkbox did not persist");
assert(!imageModelToggle(i18n.t("settings.setImageModel"))?.checked, "reopened model is still marked");
@@ -341,8 +348,13 @@ globalThis.imageGenerationProbe = async () => {
flushSync(() => root.render(null));
flushSync(() => useAppStore.setState({ settings: structuredClone(settings) }));
render();
- assert(!!container.querySelector(".model-image-row") === remaining,
- "image summary did not reflect the saved candidates after reopen");
+ if (remaining) {
+ assert(findImageRow()?.querySelector('[role="status"]')?.textContent === i18n.t("settings.imageModelUnset"),
+ "remaining candidate should not become the default");
+ assert(findImageRow()?.querySelector('button[aria-haspopup="listbox"]'), "remaining candidate should stay selectable");
+ } else {
+ expectStatusWithoutPicker("settings.imageModelNoneAvailable");
+ }
editImages();
await until(() => !!document.querySelector(".provider-chosen-row"), "saved provider did not reopen");
assert(![...document.querySelectorAll(".provider-chosen-row-id")]
@@ -379,10 +391,9 @@ globalThis.imageGenerationProbe = async () => {
},
});
click(button(i18n.t("settings.configureImageModel")));
- assert(
- useAppStore.getState().settingsTab === "agent" && useAppStore.getState().page === "settings",
- "setup action did not navigate",
- );
+ const { settingsOpen, settingsTab, settingsAnchor } = useAppStore.getState();
+ assert(settingsOpen && settingsTab === "agent" && settingsAnchor === "settings.imageModel",
+ "setup action did not open Models settings at the image model row");
const imageReads: string[] = [];
const readImage = api.fsReadImageDataUrl;
api.fsReadImageDataUrl = async (ref, mimeType) => {
@@ -405,8 +416,8 @@ globalThis.imageGenerationProbe = async () => {
"advanced-save-cancel",
"unmark-only-image-model-save-reopen-chat-default-preserved",
"advanced-provider-switch",
- "unconfigured-summary-hidden",
- "unavailable-summary",
+ "unconfigured-summary-visible-without-picker",
+ "unavailable-summary-with-and-without-runnable-candidates",
"chat-default-preserved",
"image-preview-partial-failure",
"setup-navigation",