refactor(providers): the UI, the connection test and the routes read the record's fields

Step 5 of the provider refactor plan. Provider names gave way to the
record's credential and sdk fields in: hasCredentials (one rule per
credential kind), the connection test (an Object.hasOwn check first, then a
credential switch; EdgeOne's site endpoint and cookie forwarding follow
credential none), the chat route (the on-site function and the single-system
rule for the OpenAI SDK), the credentials form (which fields to show, the
optional-key label, the base URL hint from the record), the picker (the note
from the record), the logo (icon and logo fields), the settings dialog (test
blocker, error hints, EdgeOne origin), the admin panel (fixedCredentials),
chatRequestUrl (sdk), the model list (sdk aihubmix) and the zod schema
(Object.hasOwn instead of 'in'). The eight provider-specific dictionary
entries moved into the record as four-language objects; needAzure became a
generic needUrl.

Two intended behavior changes: the connection test answers 400 'Invalid
provider' for an unknown name whether or not a key is sent (before: 400
'API key is required' without a key, 200 with an error text with one); and
Azure has no placeholder default URL any more, so a new Azure entry starts
with an empty URL and the generic 'needs a URL' rule applies. The e2e
Azure test seeds no URL and expects the new wording. Out-of-layer
provider-name checks: 44 before, 6 after (the admin panel's fixed-variable
branches for Bedrock, Vertex AI and Ollama, kept on purpose). Behavior
snapshot unchanged.
This commit is contained in:
dayuan.jiang
2026-10-12 21:17:51 +09:00
parent e0a196dded
commit f811242568
22 changed files with 303 additions and 266 deletions
+8 -2
View File
@@ -429,8 +429,7 @@ const defs = {
group: "cloud",
envPrefix: "AZURE",
resourceNameEnv: "AZURE_RESOURCE_NAME",
// A placeholder, not a real resource; the form treats it as unset
defaultBaseUrl: "https://your-resource.openai.azure.com/openai",
// No default: the URL names the user's own resource
sdkKnowsEndpoint: true,
ownRequestPath: true,
optionsOpen: true,
@@ -440,6 +439,13 @@ const defs = {
ja: "キーとリソース URL",
"zh-Hant": "Key 和資源位址",
},
baseUrlHint: {
en: "Your Azure OpenAI resource's URL, https://<resource>.openai.azure.com/openai",
zh: "Azure OpenAI 资源的地址,形如 https://<资源名>.openai.azure.com/openai",
ja: "Azure OpenAI リソースの URL。例: https://<リソース名>.openai.azure.com/openai",
"zh-Hant":
"Azure OpenAI 資源的位址,形如 https://<資源名稱>.openai.azure.com/openai",
},
// Deployment names in the user's resource
models: [
"gpt-5.5",