mirror of
https://github.com/tiennm99/ccs.git
synced 2026-07-16 20:17:45 +00:00
fix(api): skip API key prompt for local Ollama preset
Local Ollama doesn't require an API key, but the CLI was still prompting for one. This adds a `requiresApiKey` property to provider presets to control whether the API key step is required. - Add `requiresApiKey` property to ProviderPreset interface - Set `requiresApiKey: false` for local Ollama (no key needed) - Set `requiresApiKey: true` for OpenRouter and Ollama Cloud - Skip API key prompt and show info message when not required Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -181,9 +181,15 @@ async function handleCreate(args: string[]): Promise<void> {
|
||||
console.log(dim('Note: For OpenRouter, ANTHROPIC_API_KEY should be empty.'));
|
||||
}
|
||||
|
||||
// Step 3: API Key
|
||||
// Step 3: API Key (skip if preset doesn't require one)
|
||||
let apiKey = parsedArgs.apiKey;
|
||||
if (!apiKey) {
|
||||
const requiresApiKey = preset?.requiresApiKey !== false;
|
||||
|
||||
if (!requiresApiKey) {
|
||||
// Preset doesn't require API key (e.g., local Ollama)
|
||||
console.log(info('No API key required for local Ollama'));
|
||||
apiKey = ''; // Empty string for local providers
|
||||
} else if (!apiKey) {
|
||||
const keyPrompt = preset?.apiKeyHint ? `API Key (${preset.apiKeyHint})` : 'API Key';
|
||||
apiKey = await InteractivePrompt.password(keyPrompt);
|
||||
if (!apiKey) {
|
||||
|
||||
Reference in New Issue
Block a user