A local-first multi-agent app development platform, built on PenguinHarness
feat(web): 官方模型的接入地址与三档价格在配置对话框里只读
lmliheng34757951d252
diff --git a/changelog/unreleased/2026-10-07-official-model-fields-locked.md b/changelog/unreleased/2026-10-07-official-model-fields-locked.mdnew file mode 100644index 00000000..96cb0705--- /dev/null+++ b/changelog/unreleased/2026-10-07-official-model-fields-locked.md@@ -0,0 +1,32 @@+# Web: a built-in model's endpoint and prices are read-only in its config dialog++- **Date:** 2026-10-07+- **Type:** feature+- **Scope:** `web`++[中文版](2026-10-07-official-model-fields-locked.zh.md)++The model config dialog let a built-in model's 自定义 base URL and its three price fields (cache+read / cache write / output) be typed over. Both belong to the built-in catalog: the entry ships+with the endpoint and the list price, and 同步预置 writes the catalog's own numbers back onto a row+whose stored ones have fallen behind. A retyped endpoint was the entry's credential — every later+turn went to whatever had been pasted there, with nothing in the app saying the row was no longer+the catalog's model.++Both now render read-only on a catalog row, with a line under the base URL field naming the reason+and the supported way out: 移到自定义分组 makes the row the user's own, and the two fields become+editable there. The lock follows the group actually selected — moving the row out of its group+unlocks them, retyping the id onto another catalog model keeps them locked, and retyping it off the+catalog unlocks them. Everything else on such a row stays editable: the API key, the context window,+the output cap, fast mode and the display name.++An official row is exempt from the base-URL-required rule: the field cannot be typed into, so+requiring it could only leave a row unsaveable, and the endpoint it asks for is the one the catalog+already states.++## Web++- `features/models/models-page.tsx`: the dialog's `official` rule (the current reference is in the+ catalog) disables the base URL input and the three price inputs, and explains the lock under the+ base URL field and in the fields' hover title.+- `lib/strings.ts` / `lib/strings-en.ts`: `models.officialLockedHint`.diff --git a/changelog/unreleased/2026-10-07-official-model-fields-locked.zh.md b/changelog/unreleased/2026-10-07-official-model-fields-locked.zh.mdnew file mode 100644index 00000000..e5d9b36d--- /dev/null+++ b/changelog/unreleased/2026-10-07-official-model-fields-locked.zh.md@@ -0,0 +1,27 @@+# Web:内置模型(官方模型)的接入地址与三档价格在配置对话框里只读++- **Date:** 2026-10-07+- **Type:** feature+- **Scope:** `web`++[English](2026-10-07-official-model-fields-locked.md)++模型配置对话框原先允许覆盖内置模型的「自定义 base URL」和三档价格(缓存命中 / 缓存未命中 /+输出)。这两样都属于内置目录:条目本身就带着接入点和牌价,「同步预置」也会把目录的数字写回+到落后了的行上。而被改写的接入点就是这一行的凭据 —— 之后的每一次请求都发到粘贴进去的那个+地址,界面上却没有任何地方说这一行已经不是目录里的那个模型了。++现在,目录认得的行上这两个字段只读,base URL 字段下面有一行写明原因和正规的出路:「移到自定义+分组」之后这一行就是用户自己的了,两个字段随之可改。锁跟着**当前选中的分组**走 —— 把行移出原来的+分组就解锁,把 id 改成目录里的另一个模型仍然锁着(那已经是另一个模型),改成目录外的 id 则解锁。+同一行上的其它东西照旧可改:API key、上下文窗口、输出上限、快速模式、显示名。++官方行同时豁免「必须填写 base URL」这条校验:字段根本打不进字,要求它只会让这一行永远存不下去,+而它要的那个地址正是目录已经写明的那个。++## Web++- `features/models/models-page.tsx`:对话框新增 `official` 判据(当前这一对 `(provider, modelId)`+ 命中内置目录),据此把 base URL 输入框与三个价格输入框置为只读,并在 base URL 字段下方与这几个+ 字段的 hover title 里说明原因。+- `lib/strings.ts` / `lib/strings-en.ts`:新增 `models.officialLockedHint`。diff --git a/packages/web/src/features/models/models-page.tsx b/packages/web/src/features/models/models-page.tsxindex 174d0cd6..1c902109 100644--- a/packages/web/src/features/models/models-page.tsx+++ b/packages/web/src/features/models/models-page.tsx@@ -2530,6 +2530,20 @@ function ModelDialog({const visionInFlight = useRef<Promise<void> | null>(null);const isNew = row === null;const preset = row !== null && isPreset(row);+ /**+ * Whether this row is still the catalog's own: a built-in model, in the group the catalog+ * keeps it in, under the id the catalog knows. Its endpoint and its three prices belong to+ * the catalog — the entry ships with both and 「同步预置」 maintains them — so this dialog+ * shows them read-only (per owner, 2026-10-07). A row repointed at a proxy is no longer the+ * catalog's model, and the deliberate way to build one is to move this row into a custom+ * group first — which is exactly what unlocks the two fields here, because the check reads+ * the CURRENT reference rather than the identity as loaded (isPreset): moving the row out of+ * its group unlocks them, an id retyped onto another catalog model keeps them locked (it is+ * that model now), and an id retyped off the catalog unlocks them (that row is the user's+ * own). A hand-added row in a vendor group is never a catalog row either — no id there means+ * the lock, and none of those rows has one.+ */+ const official = catalogEntryFor(form.provider, form.modelId.trim()) !== undefined;/** The loaded row's running promotion, explained under the price fields. */const promotion = fractionOff(row?.discount);@@ -2798,7 +2812,12 @@ function ModelDialog({form.clientType.trim().toLowerCase().includes("openai") ||form.provider === "custom" ||providerInfo(form.provider) === undefined;- const baseUrlRequired = form.provider === PENGUIN_GO_PROVIDER_ID || (!preset && openAiLike);+ // An official row is exempt whatever the group would otherwise require: the field is+ // read-only there, so requiring it could only mark a row unsaveable over a value nobody can+ // type — and the endpoint it asks for is the one the catalog already states (a Penguin Go row+ // arrives with the relay's).+ const baseUrlRequired =+ !official && (form.provider === PENGUIN_GO_PROVIDER_ID || (!preset && openAiLike));// Custom-like groups (custom + user-defined) pick among AgentHub's generic protocol// clients: the base URL field's suffix becomes the protocol picker there, unless the// entry carries a legacy vendor-pinned client_type — that keeps the read-only note below@@ -3394,7 +3413,7 @@ function ModelDialog({aria-label={S.models.baseUrl}required={baseUrlRequired}value={form.baseUrl}- disabled={!canEdit}+ disabled={!canEdit || official}invalid={Boolean(fieldErrors.baseUrl)}// Editing the URL retires the previous run's verdict: it described the old// endpoint, and leaving it up would keep asserting a result for a URL that is@@ -3416,8 +3435,11 @@ function ModelDialog({paddingRight: `calc(${displayWidthCh(suffixLabel)}ch + ${showProtocolPicker ? "2.25rem" : "1.25rem"})`,}}// The read-only suffix is hover-transparent (pointer-events-none), so the- // explanation rides on the input's title; the picker carries its own.- title={S.models.baseUrlSuffixTitle}+ // explanation rides on the input's title; the picker carries its own. On an+ // official row that title is the lock note instead: the suffix it would explain+ // is still shown (the row does route that way), but what the reader needs to know+ // is why the field will not take an edit.+ title={official ? S.models.officialLockedHint : S.models.baseUrlSuffixTitle}placeholder={preset ? S.models.baseUrlHint : "https://…"}/>{showProtocolPicker ? (@@ -3437,6 +3459,16 @@ function ModelDialog({)}</div>{fieldErrors.baseUrl && <FieldError>{fieldErrors.baseUrl}</FieldError>}+ {/* Why the field above (and the price row below) will not take an edit — one line for+ both, since the lock is one rule. It is shown rather than left to the greyed+ control alone: a read-only field with no reason reads as a broken one, and the way+ out (`moveToCustomGroup`, the same action the card offers) is the half of the+ answer a reader cannot guess. */}+ {official && (+ <p className="mt-1 text-xs text-gray-400 dark:text-gray-500">+ {S.models.officialLockedHint}+ </p>+ )}{/* No detection verdict is rendered here (per maintainer): a result must not takeup room in the form. Both outcomes are toasts, and where the protocol ENDED UPis already visible in the suffix above, which is the thing that actually holds@@ -3514,7 +3546,10 @@ function ModelDialog({size="sm"value={value}inputMode="decimal"- disabled={!canEdit}+ // Official rows keep the catalog's list price (see `official`); the value stays+ // visible, the hover title says why it cannot be typed over.+ disabled={!canEdit || official}+ title={official ? S.models.officialLockedHint : undefined}error={fieldErrors[key]}onChange={(e) => set({ [key]: decimalOnly(e.target.value) })}className="text-right font-mono"diff --git a/packages/web/src/lib/strings-en.ts b/packages/web/src/lib/strings-en.tsindex 9184a673..1b94b00e 100644--- a/packages/web/src/lib/strings-en.ts+++ b/packages/web/src/lib/strings-en.ts@@ -1611,6 +1611,14 @@ export const en: Strings = {baseUrlHint: "Leave empty to use the provider default",baseUrlSuffixTitle:"The client appends the protocol path shown at the field's right edge to the base URL",+ /**+ * Note under a built-in model's read-only base URL / price fields (and their hover title):+ * both belong to the built-in catalog, which ships and maintains them, so this dialog does+ * not let the user rewrite them — with the way out named, since the wish behind such an+ * edit (my own endpoint) is legitimate and has a supported route.+ */+ officialLockedHint:+ "Built-in model: the catalog fixes the endpoint and the three prices, so they cannot be changed here. To point it at your own endpoint, move the row to a custom group first",baseUrlRequired: "A base URL is required",contextWindowDefaultHint: (n: number): string => `Defaults to ${n} if empty`,confirmDeleteTitle: "Delete model",diff --git a/packages/web/src/lib/strings.ts b/packages/web/src/lib/strings.tsindex cb89bc6b..753b993a 100644--- a/packages/web/src/lib/strings.ts+++ b/packages/web/src/lib/strings.ts@@ -1660,6 +1660,14 @@ export const zh = {baseUrlHint: "留空使用厂商默认地址",/** Hover title for the base URL field: explains the in-field suffix (the protocol path the client appends to the base URL); for custom groups that suffix is also the protocol picker. */baseUrlSuffixTitle: "客户端会在 base URL 后追加字段右侧的协议路径",+ /**+ * Note under a built-in model's read-only base URL / price fields (and their hover title):+ * both belong to the built-in catalog, which ships and maintains them, so this dialog does+ * not let the user rewrite them — with the way out named, since the wish behind such an+ * edit (my own endpoint) is legitimate and has a supported route.+ */+ officialLockedHint:+ "官方内置模型:接入地址与三档价格由内置目录固定,不能在此修改;要用自己的接入点,先把这一行「移到自定义分组」",baseUrlRequired: "必须填写 base URL",contextWindowDefaultHint: (n: number): string => `留空按 ${n} 计`,confirmDeleteTitle: "删除模型",