mirror of
https://github.com/RooVetGit/Roo-Code.git
synced 2026-10-08 03:07:53 +00:00
Refactor checkExistKey to use centralized SECRET_KEYS array
This commit is contained in:
parent
381b07849a
commit
167229fa73
1 changed files with 16 additions and 19 deletions
|
|
@ -1,23 +1,20 @@
|
|||
import { ApiConfiguration } from "../shared/api"
|
||||
import { SECRET_KEYS } from "./globalState"
|
||||
|
||||
export function checkExistKey(config: ApiConfiguration | undefined) {
|
||||
return config
|
||||
? [
|
||||
config.apiKey,
|
||||
config.glamaApiKey,
|
||||
config.openRouterApiKey,
|
||||
config.awsRegion,
|
||||
config.vertexProjectId,
|
||||
config.openAiApiKey,
|
||||
config.ollamaModelId,
|
||||
config.lmStudioModelId,
|
||||
config.geminiApiKey,
|
||||
config.openAiNativeApiKey,
|
||||
config.deepSeekApiKey,
|
||||
config.mistralApiKey,
|
||||
config.vsCodeLmModelSelector,
|
||||
config.requestyApiKey,
|
||||
config.unboundApiKey,
|
||||
].some((key) => key !== undefined)
|
||||
: false
|
||||
if (!config) return false
|
||||
|
||||
// Check all secret keys from the centralized SECRET_KEYS array
|
||||
const hasSecretKey = SECRET_KEYS.some((key) => config[key as keyof ApiConfiguration] !== undefined)
|
||||
|
||||
// Check additional non-secret configuration properties
|
||||
const hasOtherConfig = [
|
||||
config.awsRegion,
|
||||
config.vertexProjectId,
|
||||
config.ollamaModelId,
|
||||
config.lmStudioModelId,
|
||||
config.vsCodeLmModelSelector,
|
||||
].some((value) => value !== undefined)
|
||||
|
||||
return hasSecretKey || hasOtherConfig
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue