fix: remove requirement for api key for ollama (#546)
Fixes #540 # Skip API key validation for Ollama provider ## Description This PR modifies the CLI to not require an API key when using Ollama as the provider ## Changes - Modified the validation logic to skip API key checks for these providers - Updated the README to clarify that Ollama doesn't require an API key
This commit is contained in:
@@ -254,7 +254,11 @@ const imagePaths = cli.flags.image;
|
|||||||
const provider = cli.flags.provider ?? config.provider ?? "openai";
|
const provider = cli.flags.provider ?? config.provider ?? "openai";
|
||||||
const apiKey = getApiKey(provider);
|
const apiKey = getApiKey(provider);
|
||||||
|
|
||||||
if (!apiKey) {
|
// Set of providers that don't require API keys
|
||||||
|
const NO_API_KEY_REQUIRED = new Set(["ollama"]);
|
||||||
|
|
||||||
|
// Skip API key validation for providers that don't require an API key
|
||||||
|
if (!apiKey && !NO_API_KEY_REQUIRED.has(provider.toLowerCase())) {
|
||||||
// eslint-disable-next-line no-console
|
// eslint-disable-next-line no-console
|
||||||
console.error(
|
console.error(
|
||||||
`\n${chalk.red(`Missing ${provider} API key.`)}\n\n` +
|
`\n${chalk.red(`Missing ${provider} API key.`)}\n\n` +
|
||||||
|
|||||||
Reference in New Issue
Block a user