From 06ae5295b359b99e57756953513f22914a3a62cb Mon Sep 17 00:00:00 2001 From: rcourtman Date: Mon, 15 Dec 2025 10:03:15 +0000 Subject: [PATCH] fix(ai): send Ollama URL when using default localhost address The form pre-fills the Ollama URL field with http://localhost:11434 but compared it against that same default value to detect changes. This meant users configuring Ollama with the default URL never actually saved it. Also shows actual backend error messages instead of generic "Failed to update" when toggling the AI enable switch. Related to #847 --- frontend-modern/src/components/Settings/AISettings.tsx | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/frontend-modern/src/components/Settings/AISettings.tsx b/frontend-modern/src/components/Settings/AISettings.tsx index 3765484..18130cc 100644 --- a/frontend-modern/src/components/Settings/AISettings.tsx +++ b/frontend-modern/src/components/Settings/AISettings.tsx @@ -297,8 +297,9 @@ export const AISettings: Component = () => { if (form.deepseekApiKey.trim()) { payload.deepseek_api_key = form.deepseekApiKey.trim(); } - // Always include Ollama URL changes - if (form.ollamaBaseUrl !== (settings()?.ollama_base_url || 'http://localhost:11434')) { + // Always include Ollama URL if it has a value and differs from what's saved + // Compare against actual saved value (empty string if not set), not a prefilled default + if (form.ollamaBaseUrl.trim() && form.ollamaBaseUrl.trim() !== (settings()?.ollama_base_url || '')) { payload.ollama_base_url = form.ollamaBaseUrl.trim(); } if (form.openaiBaseUrl !== (settings()?.openai_base_url || '')) { @@ -454,7 +455,8 @@ export const AISettings: Component = () => { // Revert on failure setForm('enabled', !newValue); logger.error('[AISettings] Failed to toggle AI:', error); - notificationStore.error('Failed to update AI setting'); + const message = error instanceof Error ? error.message : 'Failed to update AI setting'; + notificationStore.error(message); } }} disabled={loading() || saving()}