Commit Graph
4 Commits
Author SHA1 Message Date
yetone 4e764fc39f i18n: "Endpoint" reads 接口地址 in Chinese, not the machine-translated 终结点 (Pluviophile)
Pluviophile (Discord) said the 终结点 beside /v1/responses in a request's
details reads like machine translation. 终结点 was the zh word for the
"Endpoint" key, used by the Requests tab's details, the Azure OpenAI and
Remote magpie editors' field and the S3 sync form, and by four Azure
strings. All of them now say 接口地址 (the address a request goes to).

Not 端点, which the rest of zh uses for "Endpoints": the Azure editor
shows both labels at once, and with 端点 for both the zh editor had two
labels named the same (the Azure test counted 2). zh-TW had that clash
already ("Endpoint" and "Endpoints" both 端點), so its field is now
端點位址; zh-TW's other wording is unchanged. Azure portal's own blade name,
「密钥和终结点」, stays as Azure writes it.

Tests: azure-endpoint now runs zh-TW too, and its one-label count is what
caught the 端点 clash.

Run on mote at this head, chromium + webkit: i18n-keys, azure-endpoint
(en, zh, zh-TW), usage-ledger-detail, s3-sync, remote-magpie. 44 pass,
8 fail; the same 8 fail at origin/main b2f7818d2 run beside it:
remote-magpie (#4398, red on macOS too, en and zh) and s3-sync in WebKit
(#2448).
Broken by hand: with 端点 for "Endpoint", azure-endpoint zh was red
(label count 2 != 1).
Not tried: the real app's windows; ja and de untouched.
2026-11-02 16:52:37 +08:00
yetone 4c746ab390 gui: Azure OpenAI says its models are the deployments magpie lists with the key (#1995, parkavenue9639)
Adding Azure OpenAI asked only for the endpoint and key. Nothing said that,
once it is saved, magpie asks the resource for its deployments with that
key (Provider.azureModels), so people took the page for one where model ids
must be typed. A saved one whose list hadn't come back yet said "The
vendor's list is empty", the same as one asked and empty.

- The endpoint hint (presets.go) now says magpie asks the resource for its
  deployments with this key once added, and the deployments' names are the
  model ids.
- The add page has a Models row for Azure: nothing to type; a deployment's
  name is typed as a model id only if the list can't be fetched.
- A saved Azure provider with an empty list says it is asking the resource
  with this key while the background fetch runs (providers.fetching, not
  yet fetched, no list error), and after it that no deployments came back,
  with Fetch again or a deployment's name. Every other provider's empty
  text is unchanged.
- New strings in zh, zh-TW, ja and de.

azureModels itself is unchanged.

Run: azure-endpoint.test.cjs (24 pass, Chromium and WebKit, en and zh),
extended with the add page's Models row and four empty-list cases (asking,
asked and none, asked and failed, OpenRouter unchanged). With the old
app.js put back it fails 10 of 12 on Chromium (no .azure-models row, the
generic empty text). With the old i18n.js the zh cases fail (6 of 12).
gui-de, gui-ja, gui-zh-tw, i18n-keys, provider-fetch-again,
provider-picks-stay, add-sheet: 34 pass in each engine. go test -tags nogui
./internal/provider ./internal/gui ok under a sandbox HOME; gofmt -l clean;
GOOS=linux and GOOS=windows go vet -tags nogui on both packages clean.
Not tried against a real Azure resource (no account): only the text
changed, not the fetch.
2026-10-14 04:39:51 +08:00
yetone e03fed7388 gui tests: azure-endpoint measures the endpoint and the key in one frame while the editor opens
azure-endpoint.test.cjs read the two fields' boxes one after the other
while the new editor was still opening, so each read could catch it at a
different height, and "the endpoint above the key" failed in Chromium on a
loaded machine (2 and 3 of 3 runs at load ~130). remote-magpie.test.cjs
had the same check and already reads both in one frame (a998a3636); this
does the same here.

Run: azure-endpoint.test.cjs 5 of 5 green in Chromium and green in WebKit
at the same load.
2026-10-11 15:21:17 +08:00
yetone c35471cf5b provider: Azure OpenAI, asked at the user's own resource on its v1 API with the key in api-key, for Codex, Claude Code and chat clients alike, and brought in from other apps instead of left out — Azure OpenAI had no preset, and importing an Azure entry from Alma was skipped with "magpie doesn't support Azure OpenAI yet". A new Azure OpenAI preset (vendor) has no URL of its own: its editor asks for the resource's endpoint in a field above the key, focused first, with https://<resource>.openai.azure.com as the placeholder and a hint on where the portal shows it and that the model ids are the deployments' names (en and zh); adding without one says "Your resource's endpoint is needed" and sends nothing, and Save refuses one without an endpoint too. Whatever is pasted — the bare endpoint, …/openai, …/openai/v1/, a classic deployment URL with its api-version, a *.cognitiveservices.azure.com or *.services.ai.azure.com host, or only the resource's name — is saved as https://<host>/openai/v1 for both chat completions and Responses. magpie uses the v1 GA API rather than the classic /openai/deployments/<name>/…?api-version= paths: the paths match OpenAI's, the body's model is the deployment's name, and no api-version is needed (the reasoning is in internal/provider/azure.go). The key goes in api-key, never as a Bearer, which Azure takes as an Entra ID token; nothing sends Authorization or x-api-key there. Deployments named after GPT/o/codex models go to Responses first, as OpenAI's do, and others to chat completions. Chat bodies ask max_completion_tokens instead of max_tokens and drop thinking/enable_thinking, both in passthrough and in Claude Code's translated requests, and the Test probe asks max_completion_tokens as well. The model list is the resource's deployments (/openai/deployments?api-version=2022-12-01), falling back to /openai/v1/models, with the key in api-key; when neither answers, the error says to type the deployment names in as model ids. Before a list, no catalog models are offered, since a model the resource hasn't deployed would be turned away. An Alma azure entry, and any imported entry at a resource's host, becomes the preset at its v1 base; an Alma azure entry with no endpoint is skipped as "it has no Azure OpenAI endpoint", and one at a non-Azure host (an API Management gateway) keeps its URL and is still signed with api-key. Adds the lobe-icons Azure icon. Tested in Go against fake resources (httptest): TestAzureRoutes checks that Codex /v1/responses, a chat client's /v1/chat/completions and Claude Code's /v1/messages on both a GPT-named and another deployment reach /openai/v1/responses or /openai/v1/chat/completions with api-key set, no Authorization or x-api-key, the deployment name as the model, max_completion_tokens and no thinking; TestAzureBase covers each pasted form and the hosts that aren't resources; TestAzurePresetSaved covers the endpoint required, both URLs on the v1 base, api-key-only headers, Native, the probe's URL and body, and nothing available before a list; TestAzureModels covers deployments first, the v1 fallback and a refused key's message; TestImportAzure covers Alma rows with an endpoint, with a bare resource name and with none, plus a classic URL from another app. azure-endpoint.test.cjs, in Chromium and WebKit, en and zh, checks the field, placeholder, hint and focus, the warning without an endpoint with nothing sent and the page not scrolled, the endpoint sent as chat and responses with the key, and that OpenAI's editor has no such field. add-sheet and old-webkit pass. go build -tags nogui (and GOOS=linux, GOOS=windows), go vet and go test -tags nogui ./... pass (TestClaudeAccountNamedAsItsLogin failed under load and passes alone). Not tried against a real Azure resource: whether a key still lists deployments with api-version 2022-12-01, whether Azure's Responses API accepts every field Codex sends, Claude models on Azure AI Foundry's Anthropic endpoint (not wired), Entra ID tokens, and API Management custom domains beyond keeping their URL. Not tried in the real Wails window. 2026-09-30 02:17:15 +08:00