From a2a49c204f7f4a3d7fb45bed06e689391ed77bfd Mon Sep 17 00:00:00 2001 From: yetone Date: Sun, 15 Nov 2026 05:59:25 +0800 Subject: [PATCH] providers: a curl pasted into a keyed provider's Base URL takes no key unseen again (#6424) 2bb201162 (env lines pasted into a key box) rewrote the editor's paste reader and dropped `&& key.isConnected` from its key line. A provider whose keys are in its Accounts has no key box on the page, so a curl command pasted into its Base URL put the curl's key into the draft unseen, and Save sent it as the provider's key. key-box-once has said so since 2bb201162 ("no key saved over the first"), and was filed as "red on origin/main" in #6424 two days ago. Run on mote, at origin/main b754cb095 + this change: - key-box-once at 2bb201162's parent: 10/10 ok (chromium); at 2bb201162: 0/10. With this change: 20/20, both engines, every language, 900 and 420px. - provider-curl-paste, provider-env-paste (the key box paste and the Add sheet still take the key), key-page, i18n-keys: 94/94 in all. - go test -tags nogui -run TestCoreScriptBudget ./internal/gui: ok. Broken by hand: the line without the guard is origin/main, red above. Not tried: the full GUI suite (#6709 is the open list of its reds). Fixes #6424 (key-box-once; its other two files are not touched here). --- internal/gui/assets/app.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/internal/gui/assets/app.js b/internal/gui/assets/app.js index 1782e4b7d..f97eaaf7b 100644 --- a/internal/gui/assets/app.js +++ b/internal/gui/assets/app.js @@ -9766,7 +9766,8 @@ function drawEditor(p, presetID) { took.push(t("Base URL") + " (" + t(API_NAMES[api]) + ")"); } } - if (c.key) { key.value = draft.key = c.key; countKeys(); took.push(t("API key")); } + // no key box when keys are Accounts: none taken unseen + if (c.key && key.isConnected) { key.value = draft.key = c.key; countKeys(); took.push(t("API key")); } if (curlModel && c.model) { curlModel(c.model); took.push(t("model {model}", { model: c.model })); } if (took.length) notes.push(env ? t("Filled in from the pasted text: {what}.", { what: took.join(" · ") }) : t("Filled in from the curl command: {what}.", { what: took.join(" · ") })); if (curlBase && !c.api) notes.push(t("Its URL isn't an address ending in /chat/completions, /messages or /responses: type the base URL."));