Skip to content

Commit a824557

Browse files
authored
fix: Fix Hugging Face provider setup not transitioning from welcome view (#6173)
fix: add Hugging Face API key to SECRET_STATE_KEYS and fix validation - Added huggingFaceApiKey to SECRET_STATE_KEYS array to ensure it's properly handled as a secret - Fixed validateModelsAndKeysProvided to check for huggingFaceModelId when validating Hugging Face provider - This fixes the issue where the welcome view wouldn't transition to chat view after configuring Hugging Face
1 parent 1e17b3b commit a824557

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

packages/types/src/global-settings.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,7 @@ export const SECRET_STATE_KEYS = [
183183
"codebaseIndexOpenAiCompatibleApiKey",
184184
"codebaseIndexGeminiApiKey",
185185
"codebaseIndexMistralApiKey",
186+
"huggingFaceApiKey",
186187
] as const satisfies readonly (keyof ProviderSettings)[]
187188
export type SecretState = Pick<ProviderSettings, (typeof SECRET_STATE_KEYS)[number]>
188189

webview-ui/src/utils/validate.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,14 @@ function validateModelsAndKeysProvided(apiConfiguration: ProviderSettings): stri
102102
return i18next.t("settings:validation.modelSelector")
103103
}
104104
break
105+
case "huggingface":
106+
if (!apiConfiguration.huggingFaceApiKey) {
107+
return i18next.t("settings:validation.apiKey")
108+
}
109+
if (!apiConfiguration.huggingFaceModelId) {
110+
return i18next.t("settings:validation.modelId")
111+
}
112+
break
105113
}
106114

107115
return undefined
@@ -166,6 +174,8 @@ function getModelIdForProvider(apiConfiguration: ProviderSettings, provider: str
166174
case "vscode-lm":
167175
// vsCodeLmModelSelector is an object, not a string
168176
return apiConfiguration.vsCodeLmModelSelector?.id
177+
case "huggingface":
178+
return apiConfiguration.huggingFaceModelId
169179
default:
170180
return apiConfiguration.apiModelId
171181
}

0 commit comments

Comments
 (0)