From 3001537aa793402d8e0a7c32999c3d512f6cd619 Mon Sep 17 00:00:00 2001 From: LUIS NOVO Date: Sun, 14 Dec 2025 11:31:03 -0300 Subject: [PATCH] fix: increase timeout for Ollama and local LLM operations MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Users with Ollama reported timeout errors on notebook chat while the backend was still processing. The answer would appear after refresh. - Frontend axios timeout: 5 min → 10 min - Backend chat service timeout: 2 min → 10 min Local LLMs can take several minutes for complex questions with large contexts, especially on slower hardware. --- api/chat_service.py | 2 +- frontend/src/lib/api/client.ts | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/api/chat_service.py b/api/chat_service.py index 2d02dcf..3a6cbb1 100644 --- a/api/chat_service.py +++ b/api/chat_service.py @@ -135,7 +135,7 @@ class ChatService: if model_override is not None: data["model_override"] = model_override - async with httpx.AsyncClient(timeout=120.0) as client: # Longer timeout for chat + async with httpx.AsyncClient(timeout=600.0) as client: # 10 min timeout for Ollama/local LLMs response = await client.post( f"{self.base_url}/api/chat/execute", json=data, diff --git a/frontend/src/lib/api/client.ts b/frontend/src/lib/api/client.ts index 8599b74..43b33b8 100644 --- a/frontend/src/lib/api/client.ts +++ b/frontend/src/lib/api/client.ts @@ -3,12 +3,12 @@ import { getApiUrl } from '@/lib/config' // API client with runtime-configurable base URL // The base URL is fetched from the API config endpoint on first request -// Timeout increased to 5 minutes (300000ms = 300s) to accommodate slow LLM operations -// (transformations, insights generation) especially on slower hardware (Ollama, LM Studio) -// Note: Frontend uses milliseconds (300000ms), backend uses seconds (300s) - both equal 5 minutes -// To configure: Set API_CLIENT_TIMEOUT=600 in .env for 10 minutes (600s = 600000ms) +// Timeout increased to 10 minutes (600000ms = 600s) to accommodate slow LLM operations +// (transformations, insights generation, chat) especially on slower hardware (Ollama, LM Studio) +// Note: Frontend uses milliseconds, backend uses seconds +// Local LLMs can take several minutes for complex questions with large contexts export const apiClient = axios.create({ - timeout: 300000, // 300 seconds = 5 minutes + timeout: 600000, // 600 seconds = 10 minutes headers: { 'Content-Type': 'application/json', },