Skip to content

Commit 93d86cb

Browse files
Minor UI changes to watsonx AI
1 parent f2a5804 commit 93d86cb

File tree

1 file changed

+45
-50
lines changed

1 file changed

+45
-50
lines changed

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

Lines changed: 45 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -113,12 +113,9 @@ export const WatsonxAI = ({
113113
useEffect(() => {
114114
const handleMessage = (event: MessageEvent<ExtensionMessage>) => {
115115
const message = event.data
116-
console.log("Received message:", message.type, message)
117-
118116
if (message.type === "singleRouterModelFetchResponse" && !message.success) {
119117
const providerName = message.values?.provider as RouterName
120118
if (providerName === "watsonx") {
121-
console.log("Received error response for watsonx:", message.error)
122119
watsonxErrorJustReceived.current = true
123120
setRefreshStatus("error")
124121
setRefreshError(message.error)
@@ -127,7 +124,6 @@ export const WatsonxAI = ({
127124
setWatsonxModels(message.watsonxModels ?? {})
128125
if (refreshStatus === "loading") {
129126
if (!watsonxErrorJustReceived.current) {
130-
console.log("Setting refresh status to success")
131127
setRefreshStatus("success")
132128
} else {
133129
watsonxErrorJustReceived.current = false
@@ -151,7 +147,6 @@ export const WatsonxAI = ({
151147
)
152148

153149
const handleRefreshModels = useCallback(() => {
154-
console.log("Refresh models clicked")
155150
setRefreshStatus("loading")
156151
setRefreshError(undefined)
157152
watsonxErrorJustReceived.current = false
@@ -202,7 +197,6 @@ export const WatsonxAI = ({
202197
}
203198
}
204199

205-
console.log("Sending requestWatsonxModels message")
206200
vscode.postMessage({
207201
type: "requestWatsonxModels",
208202
values: {
@@ -323,53 +317,54 @@ export const WatsonxAI = ({
323317
<label className="block font-medium mb-1">Username</label>
324318
</VSCodeTextField>
325319
</div>
326-
</>
327-
)}
328-
329-
<div className="w-full mb-1">
330-
<label className="block font-medium mb-1">Authentication Type</label>
331-
<Select
332-
value={apiConfiguration.watsonxAuthType}
333-
onValueChange={(value) => handleAuthTypeChange(value as "apiKey" | "password")}>
334-
<SelectTrigger className="w-full">
335-
<SelectValue placeholder="Select authentication type" />
336-
</SelectTrigger>
337-
<SelectContent>
338-
<SelectItem value="apiKey">API Key</SelectItem>
339-
<SelectItem value="password">Password</SelectItem>
340-
</SelectContent>
341-
</Select>
342-
</div>
343320

344-
{apiConfiguration.watsonxAuthType === "apiKey" ? (
345-
<div className="w-full mb-1">
346-
<VSCodeTextField
347-
value={apiConfiguration?.watsonxApiKey || ""}
348-
type="password"
349-
onInput={handleInputChange("watsonxApiKey")}
350-
placeholder="API Key"
351-
className="w-full">
352-
<label className="block font-medium mb-1">API Key</label>
353-
</VSCodeTextField>
354-
<div className="text-sm text-vscode-descriptionForeground mt-1">
355-
{t("settings:providers.apiKeyStorageNotice")}
356-
</div>
357-
</div>
358-
) : (
359-
<div className="w-full mb-1">
360-
<VSCodeTextField
361-
value={apiConfiguration.watsonxPassword}
362-
type="password"
363-
onInput={handleInputChange("watsonxPassword")}
364-
placeholder="Password"
365-
className="w-full">
366-
<label className="block font-medium mb-1">Password</label>
367-
</VSCodeTextField>
368-
<div className="text-sm text-vscode-descriptionForeground mt-1">
369-
{t("settings:providers.passwordStorageNotice")}
321+
<div className="w-full mb-1">
322+
<label className="block font-medium mb-1">Authentication Type</label>
323+
<Select
324+
value={apiConfiguration.watsonxAuthType}
325+
onValueChange={(value) => handleAuthTypeChange(value as "apiKey" | "password")}>
326+
<SelectTrigger className="w-full">
327+
<SelectValue placeholder="Select authentication type" />
328+
</SelectTrigger>
329+
<SelectContent>
330+
<SelectItem value="apiKey">API Key</SelectItem>
331+
<SelectItem value="password">Password</SelectItem>
332+
</SelectContent>
333+
</Select>
370334
</div>
371-
</div>
335+
336+
{apiConfiguration.watsonxAuthType === "apiKey" ? (
337+
<div className="w-full mb-1">
338+
<VSCodeTextField
339+
value={apiConfiguration?.watsonxApiKey || ""}
340+
type="password"
341+
onInput={handleInputChange("watsonxApiKey")}
342+
placeholder="API Key"
343+
className="w-full">
344+
<label className="block font-medium mb-1">API Key</label>
345+
</VSCodeTextField>
346+
<div className="text-sm text-vscode-descriptionForeground mt-1">
347+
{t("settings:providers.apiKeyStorageNotice")}
348+
</div>
349+
</div>
350+
) : (
351+
<div className="w-full mb-1">
352+
<VSCodeTextField
353+
value={apiConfiguration.watsonxPassword}
354+
type="password"
355+
onInput={handleInputChange("watsonxPassword")}
356+
placeholder="Password"
357+
className="w-full">
358+
<label className="block font-medium mb-1">Password</label>
359+
</VSCodeTextField>
360+
<div className="text-sm text-vscode-descriptionForeground mt-1">
361+
{t("settings:providers.passwordStorageNotice")}
362+
</div>
363+
</div>
364+
)}
365+
</>
372366
)}
367+
373368
<div className="w-full mb-1">
374369
<Button
375370
variant="outline"

0 commit comments

Comments
 (0)