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
This commit is contained in:
kaitranntt
2026-01-22 15:02:49 -05:00
parent 2cb77f2dfd
commit 3ce698c5fe
3 changed files with 13 additions and 11 deletions
+5 -5
View File
@@ -17,8 +17,8 @@ export interface ProviderPreset {
apiKeyPlaceholder: string; apiKeyPlaceholder: string;
apiKeyHint: string; apiKeyHint: string;
category: PresetCategory; category: PresetCategory;
/** Set to true for local providers that don't need API key */ /** Set to false for local providers that don't need API key (default: true) */
noApiKey?: boolean; requiresApiKey?: boolean;
/** Additional env vars for thinking mode, etc. */ /** Additional env vars for thinking mode, etc. */
extraEnv?: Record<string, string>; extraEnv?: Record<string, string>;
/** Enable always thinking mode */ /** Enable always thinking mode */
@@ -48,14 +48,14 @@ export const PROVIDER_PRESETS: ProviderPreset[] = [
{ {
id: 'ollama', id: 'ollama',
name: 'Ollama (Local)', 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', baseUrl: 'http://localhost:11434',
defaultProfileName: 'ollama', defaultProfileName: 'ollama',
defaultModel: 'qwen3-coder', defaultModel: 'qwen3-coder',
apiKeyPlaceholder: 'ollama', apiKeyPlaceholder: 'ollama',
apiKeyHint: 'Install Ollama from ollama.com - no API key needed for local', apiKeyHint: 'Install Ollama from ollama.com - no API key needed for local',
category: 'recommended', category: 'recommended',
noApiKey: true, requiresApiKey: false,
}, },
// Alternative providers // Alternative providers
{ {
@@ -148,7 +148,7 @@ export const PROVIDER_PRESETS: ProviderPreset[] = [
{ {
id: 'ollama-cloud', id: 'ollama-cloud',
name: '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', baseUrl: 'https://ollama.com',
defaultProfileName: 'ollama-cloud', defaultProfileName: 'ollama-cloud',
defaultModel: 'glm-4.7:cloud', defaultModel: 'glm-4.7:cloud',
+7 -5
View File
@@ -181,16 +181,18 @@ async function handleCreate(args: string[]): Promise<void> {
console.log(dim('Note: For OpenRouter, ANTHROPIC_API_KEY should be empty.')); 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; let apiKey = parsedArgs.apiKey;
if (preset?.noApiKey) { if (preset?.requiresApiKey === false) {
// Preset doesn't require API key (e.g., local Ollama) // Preset doesn't require API key (e.g., local Ollama)
if (parsedArgs.apiKey) { 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) { } else if (!apiKey) {
const keyPrompt = preset?.apiKeyHint ? `API Key (${preset.apiKeyHint})` : 'API Key'; const keyPrompt = preset?.apiKeyHint ? `API Key (${preset.apiKeyHint})` : 'API Key';
apiKey = await InteractivePrompt.password(keyPrompt); apiKey = await InteractivePrompt.password(keyPrompt);
+1 -1
View File
@@ -155,7 +155,7 @@ export const PROVIDER_PRESETS: ProviderPreset[] = [
{ {
id: 'ollama-cloud', id: 'ollama-cloud',
name: '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', baseUrl: 'https://ollama.com',
defaultProfileName: 'ollama-cloud', defaultProfileName: 'ollama-cloud',
badge: 'Cloud', badge: 'Cloud',