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:
parent
e5eeb90341
commit
3001537aa7
2 changed files with 6 additions and 6 deletions
|
|
@ -135,7 +135,7 @@ class ChatService:
|
||||||
if model_override is not None:
|
if model_override is not None:
|
||||||
data["model_override"] = model_override
|
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(
|
response = await client.post(
|
||||||
f"{self.base_url}/api/chat/execute",
|
f"{self.base_url}/api/chat/execute",
|
||||||
json=data,
|
json=data,
|
||||||
|
|
|
||||||
|
|
@ -3,12 +3,12 @@ import { getApiUrl } from '@/lib/config'
|
||||||
|
|
||||||
// API client with runtime-configurable base URL
|
// API client with runtime-configurable base URL
|
||||||
// The base URL is fetched from the API config endpoint on first request
|
// 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
|
// Timeout increased to 10 minutes (600000ms = 600s) to accommodate slow LLM operations
|
||||||
// (transformations, insights generation) especially on slower hardware (Ollama, LM Studio)
|
// (transformations, insights generation, chat) especially on slower hardware (Ollama, LM Studio)
|
||||||
// Note: Frontend uses milliseconds (300000ms), backend uses seconds (300s) - both equal 5 minutes
|
// Note: Frontend uses milliseconds, backend uses seconds
|
||||||
// To configure: Set API_CLIENT_TIMEOUT=600 in .env for 10 minutes (600s = 600000ms)
|
// Local LLMs can take several minutes for complex questions with large contexts
|
||||||
export const apiClient = axios.create({
|
export const apiClient = axios.create({
|
||||||
timeout: 300000, // 300 seconds = 5 minutes
|
timeout: 600000, // 600 seconds = 10 minutes
|
||||||
headers: {
|
headers: {
|
||||||
'Content-Type': 'application/json',
|
'Content-Type': 'application/json',
|
||||||
},
|
},
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue