Skip to content

Every agent's model. One place. Codex on DeepSeek, Claude Code on Kimi, from the menu bar.

gui: Image recognition says where a custom provider's model is marked as seeing (nexnull)

yetone79856727f531
diff --git a/internal/gui/api.go b/internal/gui/api.go
index 59b867a37..076622f68 100644
--- a/internal/gui/api.go
+++ b/internal/gui/api.go
@@ -407,6 +407,10 @@ type settingsJSON struct {
// the Vision the user picked when magpie can't find it any more:
// VisionAuto describes in its place, and the row says so
VisionMissing string `json:"visionMissing,omitempty"`
+ // VisionNotMarked are the custom providers (AddedByAddress) with a model left
+ // out of VisionModels only because nothing says it takes images: the
+ // user can say so in the provider's Names & levels (nexnull on Discord)
+ VisionNotMarked []string `json:"visionNotMarked,omitempty"`
// the reasoning levels of the model that describes images now, and the
// one it is asked at when one is picked (VisionEffort fitted to them)
VisionEfforts []string `json:"visionEfforts,omitempty"`
@@ -651,6 +655,11 @@ func settingsState() settingsJSON {
m.Provider, m.PName = "", e.Group
}
s.VisionModels = append(s.VisionModels, m)
+ } else if e.Group == "" && !e.Images && e.ImageInput == nil && e.Provider.AddedByAddress() && e.Provider.Ready() &&
+ !slices.Contains(s.VisionNotMarked, cmp.Or(e.Provider.Name, e.Provider.ID)) {
+ // unknown, not answered: one its list or the user said no to
+ // (ModelImages) isn't counted
+ s.VisionNotMarked = append(s.VisionNotMarked, cmp.Or(e.Provider.Name, e.Provider.ID))
}
}
s.TitleModels = []modelRef{}
diff --git a/internal/gui/assets/app.js b/internal/gui/assets/app.js
index f8641a5eb..59a820270 100644
--- a/internal/gui/assets/app.js
+++ b/internal/gui/assets/app.js
@@ -21145,6 +21145,11 @@ function renderImages(s, keep) {
if (gone) who.append(el("div", "sub err vision-missing", s.visionAuto
? t("{model}, picked here, isn't set up any more: its provider was removed or turned off, or no longer has it. {auto}, the automatic choice, describes images in its place. Pick another model here.", { model: v, auto: named(s.visionAuto) })
: t("{model}, picked here, isn't set up any more: its provider was removed or turned off, or no longer has it. No other model sees, so images are turned away. Pick another model here.", { model: v })));
+ // a custom provider's model nothing says takes images isn't offered: say
+ // where it is marked, by the editor's own words (nexnull on Discord)
+ const notMarked = s.visionNotMarked || [];
+ if (notMarked.length && v !== "off") who.append(el("div", "sub vision-not-marked", t("Models of {providers} aren’t listed until marked in their provider’s {names} › {images}",
+ { providers: notMarked.join(", "), names: t("Names & levels"), images: t("Accepts images") })));
// a routing group (no provider of its own) goes with the others, as in
// an agent's picker, not in a group of its own with its own rail button
const opt = (x) => ({ value: x.id, label: x.name || x.id, note: x.providerName, icon: x.icon, group: x.provider ? x.providerName : ROUTING_GROUPS, ref: x.id });
diff --git a/internal/gui/assets/i18n.js b/internal/gui/assets/i18n.js
index 3bb5b575d..9f3787063 100644
--- a/internal/gui/assets/i18n.js
+++ b/internal/gui/assets/i18n.js
@@ -2189,6 +2189,7 @@ const I18N = {
"{id} is called {name}": "{id} 已改名为 {name}",
"{id} has its own name again": "{id} 已恢复默认名称",
"Accepts images": "支持图片输入",
+ "Models of {providers} aren’t listed until marked in their provider’s {names} › {images}": "{providers} 的模型需在供应商的「{names}」›「{images}」中勾选后才会列出",
"Whether agents are told {id} can see images": "是否告诉 Agent {id} 能看图片",
"{id} accepts images": "{id} 支持图片输入",
"{id} does not accept images": "{id} 不支持图片输入",
@@ -6033,6 +6034,7 @@ const I18N = {
"{id} is called {name}": "{id} 已改名為 {name}",
"{id} has its own name again": "{id} 已恢復預設名稱",
"Accepts images": "支援圖片輸入",
+ "Models of {providers} aren’t listed until marked in their provider’s {names} › {images}": "{providers} 的模型需在供應商的「{names}」›「{images}」中勾選後才會列出",
"Whether agents are told {id} can see images": "是否告訴 Agent {id} 能看圖片",
"{id} accepts images": "{id} 支援圖片輸入",
"{id} does not accept images": "{id} 不支援圖片輸入",
@@ -9896,6 +9898,7 @@ const I18N = {
"{id} is called {name}": "{id} の名前を {name} にしました",
"{id} has its own name again": "{id} は元の名前に戻りました",
"Accepts images": "画像入力に対応",
+ "Models of {providers} aren’t listed until marked in their provider’s {names} › {images}": "{providers} のモデルは、プロバイダの「{names}」›「{images}」にチェックを入れると表示されます",
"Whether agents are told {id} can see images": "{id} が画像を扱えることをエージェントに伝えるかどうか",
"{id} accepts images": "{id} は画像入力に対応しています",
"{id} does not accept images": "{id} は画像入力に対応していません",
@@ -13769,6 +13772,7 @@ const I18N = {
"{id} is called {name}": "{id} heißt jetzt {name}",
"{id} has its own name again": "{id} trägt wieder seinen eigenen Namen",
"Accepts images": "Akzeptiert Bilder",
+ "Models of {providers} aren’t listed until marked in their provider’s {names} › {images}": "Modelle von {providers} erscheinen erst, wenn sie in „{names}“ › „{images}“ ihres Anbieters markiert sind",
"Whether agents are told {id} can see images": "Ob Agenten mitgeteilt wird, dass {id} Bilder sehen kann",
"{id} accepts images": "{id} akzeptiert Bilder",
"{id} does not accept images": "{id} akzeptiert keine Bilder",
diff --git a/internal/gui/tests/vision-not-marked.test.cjs b/internal/gui/tests/vision-not-marked.test.cjs
new file mode 100644
index 000000000..9a9b8dac6
--- /dev/null
+++ b/internal/gui/tests/vision-not-marked.test.cjs
@@ -0,0 +1,103 @@
+// Run with Node's test runner and Playwright on the module path; see README.md.
+// nexnull on Discord: a custom provider's model that nobody has said takes
+// images is not among Image recognition's models, and nothing said why or
+// where to change it. Under the row a line now names those providers and
+// says the model is marked in its provider's Names & levels › Accepts
+// images, in the editor's own words. None such, or Image recognition off,
+// no line. Every language; wide and at a phone's width, nothing running
+// off to the side; no backend, the API is faked here.
+const assert = require("node:assert/strict");
+const fs = require("node:fs/promises");
+const path = require("node:path");
+const { test } = require("node:test");
+const { chromium, webkit } = require("playwright");
+
+const assets = path.resolve(__dirname, "../assets");
+
+function settingsPayload(lang, over) {
+ return {
+ theme: "light", lang, tray: "panel", quotaLeft: false, currency: "usd", textSize: 100,
+ dock: false, dockWindow: false, proxy: "", redact: false, redactPersonal: false, redactWords: [],
+ codexWarmup: "", claudeWarmup: "", codexWarmAt: "", claudeWarmAt: "", workbuddyCheckin: false, noStats: false,
+ trayUsage: "", trayUsageEvery: 3, vision: "", imageGen: "",
+ version: "0.1.400", dir: "~/.config/magpie", gateway: "http://127.0.0.1:3425",
+ proxyNow: "none", proxySource: "none", login: false,
+ visionModels: [{ id: "codex/gpt-6.1-sol", name: "GPT-6.1 Sol", provider: "codex", providerName: "Codex", icon: "openai" }],
+ visionAuto: "codex/gpt-6.1-sol",
+ imageGenModels: [], workbuddyCheckins: [], lanURLs: [],
+ fx: { rate: 7.2, at: new Date().toISOString(), stale: false },
+ ...over,
+ };
+}
+
+function server(lang, cur) {
+ return async (route) => {
+ const req = route.request(), url = new URL(req.url());
+ const json = (data) => route.fulfill({ json: data });
+ if (url.pathname === "/boot.js") return route.fulfill({ contentType: "text/javascript", body: `window.bootPrefs = {lang:"${lang}",theme:"light",web:true,textSize:100};` });
+ if (url.pathname === "/wails/runtime.js") return route.fulfill({ contentType: "text/javascript", body: "export const Window = {};" });
+ if (url.pathname === "/api/state") return json({ agents: [], profiles: [], settings: { lang, theme: "light", textSize: 100 }, fx: cur.fx });
+ if (url.pathname === "/api/settings") return json(cur);
+ if (url.pathname === "/api/plugins") return json({ plugins: [] });
+ if (url.pathname === "/api/usage/quotas") return json([]);
+ if (url.pathname === "/api/groups") return json({ groups: [], models: [] });
+ if (url.pathname === "/api/window/fit") return route.fulfill({ status: 204 });
+ if (url.pathname.startsWith("/api/")) return json({});
+ const file = path.join(assets, url.pathname === "/" ? "index.html" : url.pathname);
+ const contentType = { ".html": "text/html", ".js": "text/javascript", ".css": "text/css", ".svg": "image/svg+xml", ".png": "image/png" }[path.extname(file)];
+ const body = await fs.readFile(file).catch(() => null);
+ await (body ? route.fulfill({ body, contentType }) : route.fulfill({ status: 404, body: "" }));
+ };
+}
+
+for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium", "webkit"])) {
+ test(engine + ": Image recognition says where a custom provider's model is marked as seeing", async (t) => {
+ assert(["chromium", "webkit"].includes(engine), "BROWSER must be chromium or webkit");
+ const browser = await (engine === "webkit" ? webkit.launch() : chromium.launch({ channel: "chromium" }));
+ t.after(() => browser.close());
+ const open = async (lang, cur, width) => {
+ const context = await browser.newContext({ viewport: { width, height: 760 }, reducedMotion: "reduce" });
+ const page = await context.newPage();
+ page.setDefaultTimeout(5000);
+ page.errors = [];
+ page.on("pageerror", (e) => page.errors.push(e.message));
+ await page.route("**/*", server(lang, cur));
+ await page.goto("http://magpie.test/?view=settings&tab=models");
+ await page.locator("#imagesList .row").nth(1).waitFor();
+ return page;
+ };
+ for (const lang of ["en", "zh", "zh-TW", "ja", "de"]) {
+ for (const width of [1000, 360]) {
+ await t.test(`${lang} at ${width}px: the providers are named, with where to mark a model`, async () => {
+ const page = await open(lang, settingsPayload(lang, { visionNotMarked: ["My Relay", "Local vLLM"] }), width);
+ const tr = (k, vars = {}) => page.evaluate(([k, vars]) => t(k, vars), [k, vars]);
+ const names = await tr("Names & levels"), images = await tr("Accepts images");
+ const line = page.locator("#imagesList .row").nth(0).locator(".vision-not-marked");
+ assert.equal(await line.isVisible(), true);
+ const text = await line.textContent();
+ assert.match(text, /My Relay, Local vLLM/);
+ // the checkbox and the section by the words the editor shows
+ assert.ok(text.includes(names) && text.includes(images), text);
+ if (lang !== "en") assert.ok(!/Names & levels|Accepts images|aren’t listed/.test(text), "untranslated: " + text);
+ if (lang === "zh") assert.ok(text.includes("名称与推理档位") && text.includes("支持图片输入"), text);
+ const fit = await page.evaluate(() => {
+ const l = document.querySelector("#imagesList .vision-not-marked"), row = l.closest(".row").getBoundingClientRect(), r = l.getBoundingClientRect();
+ return { inRow: r.left >= row.left - 1 && r.right <= row.right + 1, scroll: document.documentElement.scrollWidth - document.documentElement.clientWidth,
+ stripe: getComputedStyle(l).borderLeftWidth };
+ });
+ assert.deepEqual(fit, { inRow: true, scroll: 0, stripe: "0px" });
+ assert.deepEqual(page.errors, []);
+ await page.context().close();
+ });
+ }
+ await t.test(`${lang}: none unmarked, or Image recognition off, says nothing`, async () => {
+ for (const over of [{}, { visionNotMarked: ["My Relay"], vision: "off" }]) {
+ const page = await open(lang, settingsPayload(lang, over), 1000);
+ assert.equal(await page.locator("#imagesList .vision-not-marked").count(), 0);
+ assert.deepEqual(page.errors, []);
+ await page.context().close();
+ }
+ });
+ }
+ });
+}
diff --git a/internal/gui/vision_not_marked_test.go b/internal/gui/vision_not_marked_test.go
new file mode 100644
index 000000000..3f7ad98cd
--- /dev/null
+++ b/internal/gui/vision_not_marked_test.go
@@ -0,0 +1,61 @@
+package gui
+
+import (
+ "encoding/json"
+ "net/http/httptest"
+ "path/filepath"
+ "slices"
+ "testing"
+
+ "github.com/yetone/magpie/internal/provider"
+ "github.com/yetone/magpie/internal/settings"
+)
+
+// nexnull on Discord: a custom provider's model nothing says takes images
+// isn't one Image recognition can be given, and Settings is told which
+// providers have such a model so it can say where it is marked. Marked
+// there, it is among the models; marked off, it isn't said again.
+func TestVisionNotMarked(t *testing.T) {
+ h := t.TempDir()
+ t.Setenv("HOME", h)
+ t.Setenv("USERPROFILE", h)
+ t.Setenv("XDG_CONFIG_HOME", filepath.Join(h, ".config"))
+ t.Setenv("XDG_CACHE_HOME", filepath.Join(h, ".cache"))
+ if err := provider.Save(provider.Provider{ID: "relay", Name: "My Relay", Key: "k", Chat: "http://127.0.0.1:1/v1", Models: []string{"house-model"}}); err != nil {
+ t.Fatal(err)
+ }
+ srv := Handler(nil, nil)
+ get := func() (unmarked, vision []string) {
+ t.Helper()
+ rec := httptest.NewRecorder()
+ r := httptest.NewRequest("GET", "/api/settings", nil)
+ r.RemoteAddr = "127.0.0.1:50000"
+ srv.ServeHTTP(rec, r)
+ var out struct {
+ VisionNotMarked []string `json:"visionNotMarked"`
+ VisionModels []struct {
+ ID string `json:"id"`
+ } `json:"visionModels"`
+ }
+ if err := json.Unmarshal(rec.Body.Bytes(), &out); err != nil {
+ t.Fatalf("%d %s", rec.Code, rec.Body)
+ }
+ for _, m := range out.VisionModels {
+ vision = append(vision, m.ID)
+ }
+ return out.VisionNotMarked, vision
+ }
+ if u, v := get(); !slices.Equal(u, []string{"My Relay"}) || slices.Contains(v, "relay/house-model") {
+ t.Fatalf("not marked: told %q, models %q", u, v)
+ }
+ for _, said := range []bool{true, false} {
+ s := settings.Load()
+ s.ModelImages = map[string]bool{"relay/house-model": said}
+ if err := settings.Save(s); err != nil {
+ t.Fatal(err)
+ }
+ if u, v := get(); len(u) != 0 || slices.Contains(v, "relay/house-model") != said {
+ t.Fatalf("marked %v: told %q, models %q", said, u, v)
+ }
+ }
+}