fix: increase timeout for Ollama and local LLM operations

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.
This commit is contained in:
LUIS NOVO 2025-12-14 11:31:03 -03:00
parent e5eeb90341
commit 3001537aa7
2 changed files with 6 additions and 6 deletions

View file

@ -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,

View file

@ -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',
},