From 034da2b693dc75c7c65fea8d656507afa699e96f Mon Sep 17 00:00:00 2001 From: yetone Date: Tue, 29 Sep 2026 10:04:30 +0800 Subject: [PATCH] =?UTF-8?q?providers:=20one=20that=20only=20draws=20images?= =?UTF-8?q?=20says=20how=20many=20image=20models=20it=20has,=20not=20"no?= =?UTF-8?q?=20models=20exposed"=20(#124:=20=E4=BE=9B=E5=BA=94=E5=95=86?= =?UTF-8?q?=E9=87=8C=E9=9D=A2img=E6=A8=A1=E5=9E=8B=E8=AF=BB=E4=B8=8D?= =?UTF-8?q?=E5=87=BA=E6=9D=A5=EF=BC=8C=E5=8F=AA=E6=9C=89=E5=9C=A8=E8=AE=BE?= =?UTF-8?q?=E7=BD=AE=E9=87=8C=E9=9D=A2=E5=8F=AF=E4=BB=A5=E7=9C=8B=E5=88=B0?= =?UTF-8?q?)=20=E2=80=94=20an=20image=20model=20isn't=20one=20an=20agent?= =?UTF-8?q?=20picks,=20so=20a=20provider=20whose=20list=20had=20only=20ima?= =?UTF-8?q?ge=20models=20read=20"no=20models=20exposed"=20under=20Provider?= =?UTF-8?q?s=20although=20Settings=20=E2=86=92=20Image=20generation=20drew?= =?UTF-8?q?=20with=20them.=20Its=20row=20now=20reads=202=20image=20models.?= =?UTF-8?q?=20Checked=20in=20a=20sandbox=20magpie=20web=20with=20a=20custo?= =?UTF-8?q?m=20provider=20whose=20/v1/models=20lists=20gpt-image-1=20and?= =?UTF-8?q?=20flux-1-schnell?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- internal/gui/assets/app.js | 4 +++- internal/gui/assets/i18n.js | 2 ++ internal/gui/providers.go | 2 ++ 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/internal/gui/assets/app.js b/internal/gui/assets/app.js index 1b4abc6de..1ac2b58c5 100644 --- a/internal/gui/assets/app.js +++ b/internal/gui/assets/app.js @@ -1529,7 +1529,9 @@ function renderProviders() { if (p.sponsored) name.append(el("span", "badge", t("sponsored"))); if (p.off) name.append(el("span", "badge off", t("Switched off"))); const n = p.models.filter((m) => m.on).length; - const models = n ? t(n === 1 ? "{n} model" : "{n} models", { n }) : t("no models exposed"); + // a provider that only draws images (Settings → Image generation) says so + const models = n ? t(n === 1 ? "{n} model" : "{n} models", { n }) + : p.draws ? t(p.draws === 1 ? "{n} image model" : "{n} image models", { n: p.draws }) : t("no models exposed"); who.append(name, el("div", "sub", (p.account ? t("signed in as {user}", { user: p.account.user }) : p.host) + " · " + models)); const using = p.agents.filter((a) => a.current); const uses = el("div", "uses"); diff --git a/internal/gui/assets/i18n.js b/internal/gui/assets/i18n.js index dec460f68..2b8987f7c 100644 --- a/internal/gui/assets/i18n.js +++ b/internal/gui/assets/i18n.js @@ -206,6 +206,8 @@ const I18N = { "free: it doesn't use the plan's credits": "免费:不消耗套餐积分", "{n} model": "{n} 个模型", "{n} models": "{n} 个模型", + "{n} image model": "{n} 个图像模型", + "{n} image models": "{n} 个图像模型", "no models exposed": "未暴露模型", "signed in as {user}": "已登录 {user}", "{name} · {model} — click to change": "{name} · {model} — 点击更改", diff --git a/internal/gui/providers.go b/internal/gui/providers.go index 079ed2f59..e730ff242 100644 --- a/internal/gui/providers.go +++ b/internal/gui/providers.go @@ -70,6 +70,7 @@ type providerJSON struct { Affinity string `json:"affinity"` // how long a conversation stays with who answered it Models []modelJSON `json:"models"` // everything the vendor lists, exposed ones flagged Exposed int `json:"exposed"` // how many reach the agents + Draws int `json:"draws,omitempty"` // how many of its models draw images (gateway.Drawers) Unlisted bool `json:"unlisted"` // its models serve only through routing groups Off bool `json:"off"` // switched off: kept, but agents get none of its models Contexts map[string]int `json:"contexts,omitempty"` // the windows the user set, "*" for all its models @@ -259,6 +260,7 @@ func providerInfo(p provider.Provider, agents []agentUse) providerJSON { } } out.Exposed = len(exposed) + out.Draws = len(gateway.Drawers(p)) if t, ok := p.Fetched(); ok { out.Fetched = ago(t) }