(config: ProviderSettings | undefined)
| 1 | import { SECRET_STATE_KEYS, GLOBAL_SECRET_KEYS, ProviderSettings } from "@roo-code/types" |
| 2 | |
| 3 | export function checkExistKey(config: ProviderSettings | undefined) { |
| 4 | if (!config) { |
| 5 | return false |
| 6 | } |
| 7 | |
| 8 | // Special case for fake-ai, openai-codex, and qwen-code providers which don't need any configuration. |
| 9 | if (config.apiProvider && ["fake-ai", "openai-codex", "qwen-code"].includes(config.apiProvider)) { |
| 10 | return true |
| 11 | } |
| 12 | |
| 13 | // Check all secret keys from the centralized SECRET_STATE_KEYS array. |
| 14 | // Filter out keys that are not part of ProviderSettings (global secrets are stored separately) |
| 15 | const providerSecretKeys = SECRET_STATE_KEYS.filter((key) => !GLOBAL_SECRET_KEYS.includes(key as any)) |
| 16 | const hasSecretKey = providerSecretKeys.some((key) => config[key as keyof ProviderSettings] !== undefined) |
| 17 | |
| 18 | // Check additional non-secret configuration properties |
| 19 | const hasOtherConfig = [ |
| 20 | config.awsRegion, |
| 21 | config.vertexProjectId, |
| 22 | config.ollamaModelId, |
| 23 | config.lmStudioModelId, |
| 24 | config.vsCodeLmModelSelector, |
| 25 | ].some((value) => value !== undefined) |
| 26 | |
| 27 | return hasSecretKey || hasOtherConfig |
| 28 | } |
no outgoing calls
no test coverage detected