Skip to content

Commit a1bc569

Browse files
committed
fix: update Vertex AI embedder UI to match provider settings
- Remove API Key field from Vertex AI embedder configuration - Change all input fields to plain text (not password type) - Use consistent field labels from providers section - Update validation to remove API key requirement
1 parent 8bf8326 commit a1bc569

File tree

1 file changed

+34
-57
lines changed

1 file changed

+34
-57
lines changed

webview-ui/src/components/chat/CodeIndexPopover.tsx

Lines changed: 34 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,6 @@ interface LocalCodeIndexSettings {
6969
codebaseIndexOpenAiCompatibleApiKey?: string
7070
codebaseIndexGeminiApiKey?: string
7171
codebaseIndexMistralApiKey?: string
72-
codebaseIndexVertexApiKey?: string
7372
codebaseIndexVertexJsonCredentials?: string
7473
codebaseIndexVertexKeyFile?: string
7574
codebaseIndexVertexProjectId?: string
@@ -144,7 +143,6 @@ const createValidationSchema = (provider: EmbedderProvider, t: any) => {
144143
return baseSchema
145144
.extend({
146145
// At least one auth method is required
147-
codebaseIndexVertexApiKey: z.string().optional(),
148146
codebaseIndexVertexJsonCredentials: z.string().optional(),
149147
codebaseIndexVertexKeyFile: z.string().optional(),
150148
codebaseIndexVertexProjectId: z
@@ -157,16 +155,10 @@ const createValidationSchema = (provider: EmbedderProvider, t: any) => {
157155
.string()
158156
.min(1, t("settings:codeIndex.validation.modelSelectionRequired")),
159157
})
160-
.refine(
161-
(data) =>
162-
data.codebaseIndexVertexApiKey ||
163-
data.codebaseIndexVertexJsonCredentials ||
164-
data.codebaseIndexVertexKeyFile,
165-
{
166-
message: t("settings:codeIndex.validation.vertexAuthRequired"),
167-
path: ["codebaseIndexVertexApiKey"],
168-
},
169-
)
158+
.refine((data) => data.codebaseIndexVertexJsonCredentials || data.codebaseIndexVertexKeyFile, {
159+
message: t("settings:codeIndex.validation.vertexAuthRequired"),
160+
path: ["codebaseIndexVertexJsonCredentials"],
161+
})
170162

171163
default:
172164
return baseSchema
@@ -212,7 +204,6 @@ export const CodeIndexPopover: React.FC<CodeIndexPopoverProps> = ({
212204
codebaseIndexOpenAiCompatibleApiKey: "",
213205
codebaseIndexGeminiApiKey: "",
214206
codebaseIndexMistralApiKey: "",
215-
codebaseIndexVertexApiKey: "",
216207
codebaseIndexVertexJsonCredentials: "",
217208
codebaseIndexVertexKeyFile: "",
218209
codebaseIndexVertexProjectId: "",
@@ -251,7 +242,6 @@ export const CodeIndexPopover: React.FC<CodeIndexPopoverProps> = ({
251242
codebaseIndexOpenAiCompatibleApiKey: "",
252243
codebaseIndexGeminiApiKey: "",
253244
codebaseIndexMistralApiKey: "",
254-
codebaseIndexVertexApiKey: "",
255245
codebaseIndexVertexJsonCredentials: "",
256246
codebaseIndexVertexKeyFile: "",
257247
codebaseIndexVertexProjectId: codebaseIndexConfig.codebaseIndexVertexProjectId || "",
@@ -350,9 +340,6 @@ export const CodeIndexPopover: React.FC<CodeIndexPopoverProps> = ({
350340
if (!prev.codebaseIndexMistralApiKey || prev.codebaseIndexMistralApiKey === SECRET_PLACEHOLDER) {
351341
updated.codebaseIndexMistralApiKey = secretStatus.hasMistralApiKey ? SECRET_PLACEHOLDER : ""
352342
}
353-
if (!prev.codebaseIndexVertexApiKey || prev.codebaseIndexVertexApiKey === SECRET_PLACEHOLDER) {
354-
updated.codebaseIndexVertexApiKey = secretStatus.hasVertexApiKey ? SECRET_PLACEHOLDER : ""
355-
}
356343
if (
357344
!prev.codebaseIndexVertexJsonCredentials ||
358345
prev.codebaseIndexVertexJsonCredentials === SECRET_PLACEHOLDER
@@ -437,7 +424,6 @@ export const CodeIndexPopover: React.FC<CodeIndexPopoverProps> = ({
437424
key === "codebaseIndexOpenAiCompatibleApiKey" ||
438425
key === "codebaseIndexGeminiApiKey" ||
439426
key === "codebaseIndexMistralApiKey" ||
440-
key === "codebaseIndexVertexApiKey" ||
441427
key === "codebaseIndexVertexJsonCredentials" ||
442428
key === "codebaseIndexVertexKeyFile"
443429
) {
@@ -1081,53 +1067,44 @@ export const CodeIndexPopover: React.FC<CodeIndexPopoverProps> = ({
10811067

10821068
{currentSettings.codebaseIndexEmbedderProvider === "vertex" && (
10831069
<>
1084-
<div className="space-y-2">
1085-
<label className="text-sm font-medium">
1086-
{t("settings:codeIndex.vertexAuthMethodLabel")}
1087-
</label>
1088-
<p className="text-xs text-vscode-descriptionForeground mb-2">
1089-
{t("settings:codeIndex.vertexAuthMethodDescription")}
1090-
</p>
1070+
<div className="text-sm text-vscode-descriptionForeground">
1071+
<div>{t("settings:providers.googleCloudSetup.title")}</div>
1072+
<div>
1073+
<VSCodeLink
1074+
href="https://cloud.google.com/vertex-ai/generative-ai/docs/partner-models/use-claude#before_you_begin"
1075+
className="text-sm">
1076+
{t("settings:providers.googleCloudSetup.step1")}
1077+
</VSCodeLink>
1078+
</div>
1079+
<div>
1080+
<VSCodeLink
1081+
href="https://cloud.google.com/docs/authentication/provide-credentials-adc#google-idp"
1082+
className="text-sm">
1083+
{t("settings:providers.googleCloudSetup.step2")}
1084+
</VSCodeLink>
1085+
</div>
1086+
<div>
1087+
<VSCodeLink
1088+
href="https://developers.google.com/workspace/guides/create-credentials?hl=en#service-account"
1089+
className="text-sm">
1090+
{t("settings:providers.googleCloudSetup.step3")}
1091+
</VSCodeLink>
1092+
</div>
10911093
</div>
10921094

10931095
<div className="space-y-2">
10941096
<label className="text-sm font-medium">
1095-
{t("settings:codeIndex.vertexApiKeyLabel")}
1097+
{t("settings:providers.googleCloudCredentials")}
10961098
</label>
10971099
<VSCodeTextField
1098-
type="password"
1099-
value={currentSettings.codebaseIndexVertexApiKey || ""}
1100-
onInput={(e: any) =>
1101-
updateSetting("codebaseIndexVertexApiKey", e.target.value)
1102-
}
1103-
placeholder={t("settings:codeIndex.vertexApiKeyPlaceholder")}
1104-
className={cn("w-full", {
1105-
"border-red-500": formErrors.codebaseIndexVertexApiKey,
1106-
})}
1107-
/>
1108-
{formErrors.codebaseIndexVertexApiKey && (
1109-
<p className="text-xs text-vscode-errorForeground mt-1 mb-0">
1110-
{formErrors.codebaseIndexVertexApiKey}
1111-
</p>
1112-
)}
1113-
</div>
1114-
1115-
<div className="space-y-2">
1116-
<label className="text-sm font-medium">
1117-
{t("settings:codeIndex.vertexJsonCredentialsLabel")}
1118-
</label>
1119-
<VSCodeTextField
1120-
type="password"
11211100
value={currentSettings.codebaseIndexVertexJsonCredentials || ""}
11221101
onInput={(e: any) =>
11231102
updateSetting(
11241103
"codebaseIndexVertexJsonCredentials",
11251104
e.target.value,
11261105
)
11271106
}
1128-
placeholder={t(
1129-
"settings:codeIndex.vertexJsonCredentialsPlaceholder",
1130-
)}
1107+
placeholder={t("settings:placeholders.credentialsJson")}
11311108
className={cn("w-full", {
11321109
"border-red-500": formErrors.codebaseIndexVertexJsonCredentials,
11331110
})}
@@ -1141,14 +1118,14 @@ export const CodeIndexPopover: React.FC<CodeIndexPopoverProps> = ({
11411118

11421119
<div className="space-y-2">
11431120
<label className="text-sm font-medium">
1144-
{t("settings:codeIndex.vertexKeyFileLabel")}
1121+
{t("settings:providers.googleCloudKeyFile")}
11451122
</label>
11461123
<VSCodeTextField
11471124
value={currentSettings.codebaseIndexVertexKeyFile || ""}
11481125
onInput={(e: any) =>
11491126
updateSetting("codebaseIndexVertexKeyFile", e.target.value)
11501127
}
1151-
placeholder={t("settings:codeIndex.vertexKeyFilePlaceholder")}
1128+
placeholder={t("settings:placeholders.keyFilePath")}
11521129
className={cn("w-full", {
11531130
"border-red-500": formErrors.codebaseIndexVertexKeyFile,
11541131
})}
@@ -1162,14 +1139,14 @@ export const CodeIndexPopover: React.FC<CodeIndexPopoverProps> = ({
11621139

11631140
<div className="space-y-2">
11641141
<label className="text-sm font-medium">
1165-
{t("settings:codeIndex.vertexProjectIdLabel")}
1142+
{t("settings:providers.googleCloudProjectId")}
11661143
</label>
11671144
<VSCodeTextField
11681145
value={currentSettings.codebaseIndexVertexProjectId || ""}
11691146
onInput={(e: any) =>
11701147
updateSetting("codebaseIndexVertexProjectId", e.target.value)
11711148
}
1172-
placeholder={t("settings:codeIndex.vertexProjectIdPlaceholder")}
1149+
placeholder={t("settings:placeholders.projectId")}
11731150
className={cn("w-full", {
11741151
"border-red-500": formErrors.codebaseIndexVertexProjectId,
11751152
})}
@@ -1183,7 +1160,7 @@ export const CodeIndexPopover: React.FC<CodeIndexPopoverProps> = ({
11831160

11841161
<div className="space-y-2">
11851162
<label className="text-sm font-medium">
1186-
{t("settings:codeIndex.vertexLocationLabel")}
1163+
{t("settings:providers.googleCloudRegion")}
11871164
</label>
11881165
<VSCodeTextField
11891166
value={currentSettings.codebaseIndexVertexLocation || ""}

0 commit comments

Comments
 (0)