From 3ce698c5fe3bc013371b51f6c13d01f32611f9a3 Mon Sep 17 00:00:00 2001 From: kaitranntt Date: Thu, 22 Jan 2026 15:02:49 -0500 Subject: [PATCH] fix(ollama): align property naming and descriptions - Change CLI noApiKey to requiresApiKey to match UI convention - Set apiKey='ollama' instead of empty string for local Ollama - Align ollama-cloud descriptions between CLI/UI - Keep https://ollama.com endpoint for direct API access --- src/api/services/provider-presets.ts | 10 +++++----- src/commands/api-command.ts | 12 +++++++----- ui/src/lib/provider-presets.ts | 2 +- 3 files changed, 13 insertions(+), 11 deletions(-) diff --git a/src/api/services/provider-presets.ts b/src/api/services/provider-presets.ts index 0a518e3b..d055e4a8 100644 --- a/src/api/services/provider-presets.ts +++ b/src/api/services/provider-presets.ts @@ -17,8 +17,8 @@ export interface ProviderPreset { apiKeyPlaceholder: string; apiKeyHint: string; category: PresetCategory; - /** Set to true for local providers that don't need API key */ - noApiKey?: boolean; + /** Set to false for local providers that don't need API key (default: true) */ + requiresApiKey?: boolean; /** Additional env vars for thinking mode, etc. */ extraEnv?: Record; /** Enable always thinking mode */ @@ -48,14 +48,14 @@ export const PROVIDER_PRESETS: ProviderPreset[] = [ { id: 'ollama', name: 'Ollama (Local)', - description: 'Local open-source models via Ollama (32K+ context recommended)', + description: 'Local open-source models via Ollama (32K+ context)', baseUrl: 'http://localhost:11434', defaultProfileName: 'ollama', defaultModel: 'qwen3-coder', apiKeyPlaceholder: 'ollama', apiKeyHint: 'Install Ollama from ollama.com - no API key needed for local', category: 'recommended', - noApiKey: true, + requiresApiKey: false, }, // Alternative providers { @@ -148,7 +148,7 @@ export const PROVIDER_PRESETS: ProviderPreset[] = [ { id: 'ollama-cloud', name: 'Ollama Cloud', - description: 'Ollama.com cloud models (glm-4.7:cloud, qwen3-coder:480b)', + description: 'Ollama cloud models via direct API (glm-4.7:cloud, minimax-m2.1:cloud)', baseUrl: 'https://ollama.com', defaultProfileName: 'ollama-cloud', defaultModel: 'glm-4.7:cloud', diff --git a/src/commands/api-command.ts b/src/commands/api-command.ts index 41706a30..2e740ba6 100644 --- a/src/commands/api-command.ts +++ b/src/commands/api-command.ts @@ -181,16 +181,18 @@ async function handleCreate(args: string[]): Promise { console.log(dim('Note: For OpenRouter, ANTHROPIC_API_KEY should be empty.')); } - // Step 3: API Key (skip if preset has noApiKey flag) + // Step 3: API Key (skip if preset has requiresApiKey: false) let apiKey = parsedArgs.apiKey; - if (preset?.noApiKey) { + if (preset?.requiresApiKey === false) { // Preset doesn't require API key (e.g., local Ollama) if (parsedArgs.apiKey) { - console.log(dim('Note: API key ignored for local Ollama (not required)')); + console.log(dim('Note: Using provided API key for local Ollama (optional)')); + apiKey = parsedArgs.apiKey; + } else { + console.log(info('No API key required for local Ollama')); + apiKey = 'ollama'; // Placeholder token matching template } - 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); diff --git a/ui/src/lib/provider-presets.ts b/ui/src/lib/provider-presets.ts index 4b900e4a..67c3f3ba 100644 --- a/ui/src/lib/provider-presets.ts +++ b/ui/src/lib/provider-presets.ts @@ -155,7 +155,7 @@ export const PROVIDER_PRESETS: ProviderPreset[] = [ { id: 'ollama-cloud', name: 'Ollama Cloud', - description: 'Ollama.com cloud models (glm-4.7:cloud, qwen3-coder:480b)', + description: 'Ollama cloud models via direct API (glm-4.7:cloud, minimax-m2.1:cloud)', baseUrl: 'https://ollama.com', defaultProfileName: 'ollama-cloud', badge: 'Cloud',