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

Commit 63074dd

Browse files
committed
feat: add Azure provider UI component and translations
1 parent 821bec2 commit 63074dd

5 files changed

Lines changed: 104 additions & 0 deletions

File tree

webview-ui/src/components/settings/ApiOptions.tsx

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ import {
7373

7474
import {
7575
Anthropic,
76+
Azure,
7677
Baseten,
7778
Bedrock,
7879
Cerebras,
@@ -557,6 +558,14 @@ const ApiOptions = ({
557558
/>
558559
)}
559560

561+
{selectedProvider === "azure" && (
562+
<Azure
563+
apiConfiguration={apiConfiguration}
564+
setApiConfigurationField={setApiConfigurationField}
565+
simplifySettings={fromWelcomeView}
566+
/>
567+
)}
568+
560569
{selectedProvider === "openai-codex" && (
561570
<OpenAICodex
562571
apiConfiguration={apiConfiguration}

webview-ui/src/components/settings/constants.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ export const PROVIDERS = [
5050
{ value: "openrouter", label: "OpenRouter", proxy: false },
5151
{ value: "deepinfra", label: "DeepInfra", proxy: false },
5252
{ value: "anthropic", label: "Anthropic", proxy: false },
53+
{ value: "azure", label: "Azure OpenAI", proxy: false },
5354
{ value: "cerebras", label: "Cerebras", proxy: false },
5455
{ value: "gemini", label: "Google Gemini", proxy: false },
5556
{ value: "doubao", label: "Doubao", proxy: false },
Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
import { useCallback } from "react"
2+
import { VSCodeTextField } from "@vscode/webview-ui-toolkit/react"
3+
4+
import { type ProviderSettings, azureOpenAiDefaultApiVersion } from "@roo-code/types"
5+
6+
import { useAppTranslation } from "@src/i18n/TranslationContext"
7+
import { VSCodeButtonLink } from "@src/components/common/VSCodeButtonLink"
8+
9+
import { inputEventTransform } from "../transforms"
10+
11+
type AzureProps = {
12+
apiConfiguration: ProviderSettings
13+
setApiConfigurationField: (field: keyof ProviderSettings, value: ProviderSettings[keyof ProviderSettings]) => void
14+
simplifySettings?: boolean
15+
}
16+
17+
export const Azure = ({ apiConfiguration, setApiConfigurationField }: AzureProps) => {
18+
const { t } = useAppTranslation()
19+
20+
const handleInputChange = useCallback(
21+
<K extends keyof ProviderSettings, E>(
22+
field: K,
23+
transform: (event: E) => ProviderSettings[K] = inputEventTransform,
24+
) =>
25+
(event: E | Event) => {
26+
setApiConfigurationField(field, transform(event as E))
27+
},
28+
[setApiConfigurationField],
29+
)
30+
31+
return (
32+
<>
33+
<VSCodeTextField
34+
value={apiConfiguration?.azureResourceName || ""}
35+
onInput={handleInputChange("azureResourceName")}
36+
placeholder={t("settings:placeholders.azureResourceName")}
37+
className="w-full">
38+
<label className="block font-medium mb-1">{t("settings:providers.azureResourceName")}</label>
39+
</VSCodeTextField>
40+
<div className="text-sm text-vscode-descriptionForeground -mt-2">
41+
{t("settings:providers.azureResourceNameDescription")}
42+
</div>
43+
<VSCodeTextField
44+
value={apiConfiguration?.azureDeploymentName || ""}
45+
onInput={handleInputChange("azureDeploymentName")}
46+
placeholder={t("settings:placeholders.azureDeploymentName")}
47+
className="w-full">
48+
<label className="block font-medium mb-1">{t("settings:providers.azureDeploymentName")}</label>
49+
</VSCodeTextField>
50+
<div className="text-sm text-vscode-descriptionForeground -mt-2">
51+
{t("settings:providers.azureDeploymentNameDescription")}
52+
</div>
53+
<VSCodeTextField
54+
value={apiConfiguration?.azureApiKey || ""}
55+
type="password"
56+
onInput={handleInputChange("azureApiKey")}
57+
placeholder={t("settings:placeholders.apiKey")}
58+
className="w-full">
59+
<label className="block font-medium mb-1">{t("settings:providers.azureApiKey")}</label>
60+
</VSCodeTextField>
61+
<div className="text-sm text-vscode-descriptionForeground -mt-2">
62+
{t("settings:providers.apiKeyStorageNotice")}
63+
</div>
64+
<VSCodeTextField
65+
value={apiConfiguration?.azureApiVersion || ""}
66+
onInput={handleInputChange("azureApiVersion")}
67+
placeholder={`Default: ${azureOpenAiDefaultApiVersion}`}
68+
className="w-full">
69+
<label className="block font-medium mb-1">{t("settings:providers.azureApiVersion")}</label>
70+
</VSCodeTextField>
71+
<div className="text-sm text-vscode-descriptionForeground -mt-2">
72+
{t("settings:providers.azureApiVersionDescription")}
73+
</div>
74+
{!apiConfiguration?.azureApiKey && (
75+
<VSCodeButtonLink
76+
href="https://azure.microsoft.com/en-us/products/ai-services/openai-service"
77+
appearance="secondary">
78+
{t("settings:providers.getAzureApiKey")}
79+
</VSCodeButtonLink>
80+
)}
81+
</>
82+
)
83+
}

webview-ui/src/components/settings/providers/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
export { Anthropic } from "./Anthropic"
2+
export { Azure } from "./Azure"
23
export { Bedrock } from "./Bedrock"
34
export { Cerebras } from "./Cerebras"
45
export { Chutes } from "./Chutes"

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

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -404,6 +404,14 @@
404404
"getBasetenApiKey": "Get Baseten API Key",
405405
"cerebrasApiKey": "Cerebras API Key",
406406
"getCerebrasApiKey": "Get Cerebras API Key",
407+
"azureResourceName": "Azure Resource Name",
408+
"azureResourceNameDescription": "The name of your Azure OpenAI resource (e.g., 'my-openai-resource').",
409+
"azureDeploymentName": "Azure Deployment Name",
410+
"azureDeploymentNameDescription": "The name of your model deployment within the resource.",
411+
"azureApiKey": "Azure API Key",
412+
"getAzureApiKey": "Get Azure OpenAI Access",
413+
"azureApiVersion": "Azure API Version",
414+
"azureApiVersionDescription": "The API version to use (e.g., '2024-10-21'). Leave empty for the default.",
407415
"chutesApiKey": "Chutes API Key",
408416
"getChutesApiKey": "Get Chutes API Key",
409417
"fireworksApiKey": "Fireworks API Key",
@@ -998,6 +1006,8 @@
9981006
"projectId": "Enter Project ID...",
9991007
"customArn": "Enter ARN (e.g. arn:aws:bedrock:us-east-1:123456789012:foundation-model/my-model)",
10001008
"baseUrl": "Enter base URL...",
1009+
"azureResourceName": "e.g. my-openai-resource",
1010+
"azureDeploymentName": "e.g. gpt-4o",
10011011
"modelId": {
10021012
"lmStudio": "e.g. meta-llama-3.1-8b-instruct",
10031013
"lmStudioDraft": "e.g. lmstudio-community/llama-3.2-1b-instruct",

0 commit comments

Comments
 (0)