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).
This commit is contained in:
yetone
2026-11-15 05:59:25 +08:00
parent f038695208
commit a2a49c204f
+2 -1
View File
@@ -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."));