Skip to content

Commit 1a0a8ce

Browse files
localize labels and few minor fixes
1 parent 440ee20 commit 1a0a8ce

File tree

22 files changed

+90
-61
lines changed

22 files changed

+90
-61
lines changed

src/api/providers/fetchers/ibm-watsonx.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -134,12 +134,16 @@ export async function getWatsonxModels(
134134
}
135135
}
136136
} catch (error) {
137-
console.warn("Error fetching models from IBM watsonx API:", error)
138-
return {}
137+
console.error("Error fetching models from IBM watsonx API:", error)
138+
throw new Error(
139+
`Failed to fetch models from IBM watsonx API: ${error instanceof Error ? error.message : "Unknown error"}`,
140+
)
139141
}
140142
return knownModels
141143
} catch (apiError) {
142144
console.error("Error fetching IBM watsonx models:", apiError)
143-
return {}
145+
throw new Error(
146+
`Failed to fetch models from IBM watsonx API: ${apiError instanceof Error ? apiError.message : "Unknown error"}`,
147+
)
144148
}
145149
}

src/core/webview/webviewMessageHandler.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1076,8 +1076,10 @@ export const webviewMessageHandler = async (
10761076
} catch (error) {
10771077
console.error("Failed to fetch IBM watsonx models:", error)
10781078
provider.postMessageToWebview({
1079-
type: "watsonxModels",
1080-
watsonxModels: {},
1079+
type: "singleRouterModelFetchResponse",
1080+
success: false,
1081+
error: "Failed to fetch IBM watsonx models",
1082+
values: { provider: "ibm-watsonx" },
10811083
})
10821084
}
10831085
}

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -274,6 +274,7 @@ const ApiOptions = ({
274274
apiConfiguration?.watsonxAuthType,
275275
apiConfiguration?.watsonxUsername,
276276
apiConfiguration?.watsonxPassword,
277+
apiConfiguration?.watsonxRegion,
277278
customHeaders,
278279
],
279280
)

webview-ui/src/components/settings/providers/ibm-watsonx.tsx

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,7 @@ export const WatsonxAI = ({
256256
<>
257257
{/* Platform Selection */}
258258
<div className="w-full mb-1">
259-
<label className="block font-medium mb-1">Platform</label>
259+
<label className="block font-medium mb-1">{t("settings:providers.watsonx.platform")}</label>
260260
<Select
261261
value={apiConfiguration.watsonxPlatform}
262262
onValueChange={(value) => handlePlatformChange(value as "ibmCloud" | "cloudPak")}>
@@ -273,7 +273,7 @@ export const WatsonxAI = ({
273273
{/* IBM Cloud specific fields */}
274274
{apiConfiguration.watsonxPlatform === "ibmCloud" && (
275275
<div className="w-full mb-1">
276-
<label className="block font-medium mb-1">Region</label>
276+
<label className="block font-medium mb-1">{t("settings:providers.watsonx.region")}</label>
277277
<Select value={selectedRegion} onValueChange={handleRegionSelect}>
278278
<SelectTrigger className="w-full">
279279
<SelectValue placeholder={t("settings:providers.watsonx.region")} />
@@ -303,7 +303,7 @@ export const WatsonxAI = ({
303303
<label className="block font-medium mb-1">URL</label>
304304
</VSCodeTextField>
305305
<div className="text-sm text-vscode-descriptionForeground mt-1">
306-
Enter the full URL of your IBM Cloud Pak for Data instance
306+
{t("settings:providers.watsonx.urlDescription")}
307307
</div>
308308
</div>
309309
)}
@@ -314,7 +314,7 @@ export const WatsonxAI = ({
314314
onInput={handleInputChange("watsonxProjectId")}
315315
placeholder={t("settings:providers.watsonx.projectId")}
316316
className="w-full">
317-
<label className="block font-medium mb-1">Project ID</label>
317+
<label className="block font-medium mb-1">{t("settings:providers.watsonx.projectId")}</label>
318318
</VSCodeTextField>
319319
</div>
320320

@@ -326,7 +326,7 @@ export const WatsonxAI = ({
326326
onInput={handleInputChange("watsonxApiKey")}
327327
placeholder={t("settings:providers.watsonx.apiKey")}
328328
className="w-full">
329-
<label className="block font-medium mb-1">API Key</label>
329+
<label className="block font-medium mb-1">{t("settings:providers.watsonx.apiKey")}</label>
330330
</VSCodeTextField>
331331
<div className="text-sm text-vscode-descriptionForeground mt-1">
332332
{t("settings:providers.apiKeyStorageNotice")}
@@ -342,21 +342,21 @@ export const WatsonxAI = ({
342342
onInput={handleInputChange("watsonxUsername")}
343343
placeholder={t("settings:providers.watsonx.username")}
344344
className="w-full">
345-
<label className="block font-medium mb-1">Username</label>
345+
<label className="block font-medium mb-1">{t("settings:providers.watsonx.username")}</label>
346346
</VSCodeTextField>
347347
</div>
348348

349349
<div className="w-full mb-1">
350-
<label className="block font-medium mb-1">Authentication Type</label>
350+
<label className="block font-medium mb-1">{t("settings:providers.watsonx.authType")}</label>
351351
<Select
352352
value={apiConfiguration.watsonxAuthType}
353353
onValueChange={(value) => handleAuthTypeChange(value as "apiKey" | "password")}>
354354
<SelectTrigger className="w-full">
355355
<SelectValue placeholder={t("settings:providers.watsonx.authType")} />
356356
</SelectTrigger>
357357
<SelectContent>
358-
<SelectItem value="apiKey">API Key</SelectItem>
359-
<SelectItem value="password">Password</SelectItem>
358+
<SelectItem value="apiKey">{t("settings:providers.watsonx.apiKey")}</SelectItem>
359+
<SelectItem value="password">{t("settings:providers.watsonx.password")}</SelectItem>
360360
</SelectContent>
361361
</Select>
362362
</div>
@@ -369,7 +369,9 @@ export const WatsonxAI = ({
369369
onInput={handleInputChange("watsonxApiKey")}
370370
placeholder={t("settings:providers.watsonx.apiKey")}
371371
className="w-full">
372-
<label className="block font-medium mb-1">API Key</label>
372+
<label className="block font-medium mb-1">
373+
{t("settings:providers.watsonx.apiKey")}
374+
</label>
373375
</VSCodeTextField>
374376
<div className="text-sm text-vscode-descriptionForeground mt-1">
375377
{t("settings:providers.apiKeyStorageNotice")}
@@ -383,7 +385,9 @@ export const WatsonxAI = ({
383385
onInput={handleInputChange("watsonxPassword")}
384386
placeholder={t("settings:providers.watsonx.password")}
385387
className="w-full">
386-
<label className="block font-medium mb-1">Password</label>
388+
<label className="block font-medium mb-1">
389+
{t("settings:providers.watsonx.password")}
390+
</label>
387391
</VSCodeTextField>
388392
<div className="text-sm text-vscode-descriptionForeground mt-1">
389393
{t("settings:providers.passwordStorageNotice")}

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

Lines changed: 2 additions & 1 deletion
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: 5 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: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -495,13 +495,14 @@
495495
"maxTokensDescription": "Maximum number of output tokens for Claude Code responses. Default is 8000."
496496
},
497497
"watsonx": {
498-
"platform": "Select a platform",
499-
"region": "Select a region",
498+
"platform": "Platform",
499+
"region": "Region",
500500
"username": "Username",
501501
"password": "Password",
502502
"apiKey": "API Key",
503-
"authType": "Select authentication type",
504-
"projectId": "Project ID"
503+
"authType": "Authentication type",
504+
"projectId": "Project ID",
505+
"urlDescription": "Enter the full URL of your IBM Cloud Pak for Data instance"
505506
}
506507
},
507508
"browser": {

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

Lines changed: 5 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: 5 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/hi/settings.json

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

0 commit comments

Comments
 (0)