()
| 86814 | if (provider === "test" /* TEST */) { |
| 86815 | return false; |
| 86816 | } |
| 86817 | const hasRequiredConfig = MODEL_REQUIRED_PROVIDERS.includes( |
| 86818 | provider |
| 86819 | ) ? Boolean(config8.OCO_MODEL) : Boolean(config8.OCO_API_KEY); |
| 86820 | return !hasGlobalConfig && !hasRequiredConfig; |
| 86821 | } |
| 86822 | async function promptForMissingApiKey() { |
| 86823 | const config8 = getConfig(); |
| 86824 | const provider = config8.OCO_AI_PROVIDER || "openai" /* OPENAI */; |
| 86825 | if (NO_API_KEY_PROVIDERS.includes(provider)) { |
| 86826 | return true; |
| 86827 | } |
| 86828 | if (config8.OCO_API_KEY) { |
| 86829 | return true; |
| 86830 | } |
| 86831 | console.log( |
| 86832 | source_default.yellow(` |
| 86833 | API key missing for ${provider}. Let's set it up. |
| 86834 | `) |
| 86835 | ); |
| 86836 | const apiKey = await getApiKey(provider); |
| 86837 | if (hD2(apiKey)) { |
| 86838 | return false; |
| 86839 | } |
| 86840 | const existingConfig = getGlobalConfig(); |
| 86841 | setGlobalConfig({ |
| 86842 | ...existingConfig, |
| 86843 | OCO_API_KEY: apiKey |
| 86844 | }); |
no test coverage detected
searching dependent graphs…