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;
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<string, string>;
/** 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',
+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.'));
}
// 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);
+1 -1
View File
@@ -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',