Skip to content
This repository was archived by the owner on May 15, 2026. It is now read-only.

Commit 8c31b80

Browse files
committed
refactor(azure): replace resourceName with baseURL and fix translations
1 parent 9a4db8d commit 8c31b80

24 files changed

Lines changed: 89 additions & 88 deletions

File tree

packages/types/src/provider-settings.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -416,7 +416,7 @@ const basetenSchema = apiModelIdProviderModelSchema.extend({
416416

417417
const azureSchema = apiModelIdProviderModelSchema.extend({
418418
azureApiKey: z.string().optional(),
419-
azureResourceName: z.string().optional(),
419+
azureBaseUrl: z.string().optional(),
420420
azureDeploymentName: z.string().optional(),
421421
azureApiVersion: z.string().optional(),
422422
})

src/api/providers/__tests__/azure.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ describe("AzureHandler", () => {
3636
beforeEach(() => {
3737
mockOptions = {
3838
azureApiKey: "test-api-key",
39-
azureResourceName: "test-resource",
39+
azureBaseUrl: "https://test-resource.openai.azure.com/openai",
4040
azureDeploymentName: "gpt-4o",
4141
azureApiVersion: "2024-08-01-preview",
4242
}

src/api/providers/azure.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,13 @@ export class AzureHandler extends BaseProvider implements SingleCompletionHandle
3535
this.options = options
3636

3737
// Create the Azure provider using AI SDK
38-
// The @ai-sdk/azure package uses resourceName-based routing.
38+
// baseURL supports both classic Azure OpenAI resources
39+
// (.openai.azure.com) and newer AI Foundry resources
40+
// (.cognitiveservices.azure.com).
3941
// useDeploymentBasedUrls produces the universally compatible
40-
// /deployments/{id}/{path} URL shape that works on both classic
41-
// Azure OpenAI resources and newer AI Foundry resources.
42+
// /deployments/{id}/{path} URL shape.
4243
this.provider = createAzure({
43-
resourceName: options.azureResourceName ?? "",
44+
baseURL: options.azureBaseUrl ?? "",
4445
apiKey: options.azureApiKey, // Optional — Azure supports managed identity / Entra ID auth
4546
apiVersion: options.azureApiVersion ?? azureOpenAiDefaultApiVersion,
4647
useDeploymentBasedUrls: true,

src/shared/checkExistApiConfig.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@ export function checkExistKey(config: ProviderSettings | undefined) {
1111
}
1212

1313
// Azure supports managed identity / Entra ID auth (no API key needed).
14-
// Consider it configured if resource name or deployment name is set.
14+
// Consider it configured if base URL or deployment name is set.
1515
if (config.apiProvider === "azure") {
16-
return !!(config.azureResourceName || config.azureDeploymentName || config.azureApiKey)
16+
return !!(config.azureBaseUrl || config.azureDeploymentName || config.azureApiKey)
1717
}
1818

1919
// Check all secret keys from the centralized SECRET_STATE_KEYS array.

webview-ui/src/components/settings/providers/Azure.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,14 +30,14 @@ export const Azure = ({ apiConfiguration, setApiConfigurationField }: AzureProps
3030
return (
3131
<>
3232
<VSCodeTextField
33-
value={apiConfiguration?.azureResourceName || ""}
34-
onInput={handleInputChange("azureResourceName")}
35-
placeholder={t("settings:placeholders.azureResourceName")}
33+
value={apiConfiguration?.azureBaseUrl || ""}
34+
onInput={handleInputChange("azureBaseUrl")}
35+
placeholder={t("settings:placeholders.azureBaseUrl")}
3636
className="w-full">
37-
<label className="block font-medium mb-1">{t("settings:providers.azureResourceName")}</label>
37+
<label className="block font-medium mb-1">{t("settings:providers.azureBaseUrl")}</label>
3838
</VSCodeTextField>
3939
<div className="text-sm text-vscode-descriptionForeground -mt-2">
40-
{t("settings:providers.azureResourceNameDescription")}
40+
{t("settings:providers.azureBaseUrlDescription")}
4141
</div>
4242
<VSCodeTextField
4343
value={apiConfiguration?.azureDeploymentName || ""}

webview-ui/src/i18n/locales/ca/settings.json

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

webview-ui/src/i18n/locales/de/settings.json

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

webview-ui/src/i18n/locales/en/settings.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -442,8 +442,8 @@
442442
"getBasetenApiKey": "Get Baseten API Key",
443443
"cerebrasApiKey": "Cerebras API Key",
444444
"getCerebrasApiKey": "Get Cerebras API Key",
445-
"azureResourceName": "Azure Resource Name",
446-
"azureResourceNameDescription": "The name of your Azure OpenAI resource (e.g., 'my-openai-resource').",
445+
"azureBaseUrl": "Base URL",
446+
"azureBaseUrlDescription": "Your Azure OpenAI endpoint URL. Found in the Azure portal under Keys & Endpoint.",
447447
"azureDeploymentName": "Azure Deployment Name",
448448
"azureDeploymentNameDescription": "The name of your model deployment within the resource.",
449449
"azureApiKey": "Azure API Key",
@@ -1022,7 +1022,7 @@
10221022
"modelNotAllowed": "Model '{{model}}' is not allowed for provider '{{provider}}' by your organization",
10231023
"profileInvalid": "This profile contains a provider or model that is not allowed by your organization",
10241024
"qwenCodeOauthPath": "You must provide a valid OAuth credentials path.",
1025-
"azureResourceName": "You must provide an Azure resource name.",
1025+
"azureBaseUrl": "You must provide an Azure base URL.",
10261026
"azureDeploymentName": "You must provide an Azure deployment name."
10271027
},
10281028
"placeholders": {
@@ -1036,7 +1036,7 @@
10361036
"projectId": "Enter Project ID...",
10371037
"customArn": "Enter ARN (e.g. arn:aws:bedrock:us-east-1:123456789012:foundation-model/my-model)",
10381038
"baseUrl": "Enter base URL...",
1039-
"azureResourceName": "e.g. my-openai-resource",
1039+
"azureBaseUrl": "https://your-resource.openai.azure.com/openai",
10401040
"azureDeploymentName": "e.g. gpt-4o",
10411041
"modelId": {
10421042
"lmStudio": "e.g. meta-llama-3.1-8b-instruct",

webview-ui/src/i18n/locales/es/settings.json

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

webview-ui/src/i18n/locales/fr/settings.json

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)