File tree Expand file tree Collapse file tree 1 file changed +16
-19
lines changed
Expand file tree Collapse file tree 1 file changed +16
-19
lines changed Original file line number Diff line number Diff line change 11import { ApiConfiguration } from "../shared/api"
2+ import { SECRET_KEYS } from "./globalState"
23
34export function checkExistKey ( config : ApiConfiguration | undefined ) {
4- return config
5- ? [
6- config . apiKey ,
7- config . glamaApiKey ,
8- config . openRouterApiKey ,
9- config . awsRegion ,
10- config . vertexProjectId ,
11- config . openAiApiKey ,
12- config . ollamaModelId ,
13- config . lmStudioModelId ,
14- config . geminiApiKey ,
15- config . openAiNativeApiKey ,
16- config . deepSeekApiKey ,
17- config . mistralApiKey ,
18- config . vsCodeLmModelSelector ,
19- config . requestyApiKey ,
20- config . unboundApiKey ,
21- ] . some ( ( key ) => key !== undefined )
22- : false
5+ if ( ! config ) return false
6+
7+ // Check all secret keys from the centralized SECRET_KEYS array
8+ const hasSecretKey = SECRET_KEYS . some ( ( key ) => config [ key as keyof ApiConfiguration ] !== undefined )
9+
10+ // Check additional non-secret configuration properties
11+ const hasOtherConfig = [
12+ config . awsRegion ,
13+ config . vertexProjectId ,
14+ config . ollamaModelId ,
15+ config . lmStudioModelId ,
16+ config . vsCodeLmModelSelector ,
17+ ] . some ( ( value ) => value !== undefined )
18+
19+ return hasSecretKey || hasOtherConfig
2320}
You can’t perform that action at this time.
0 commit comments