From 2a0379b65338f9b8976961cc0eaa51b57d611c69 Mon Sep 17 00:00:00 2001 From: Mabe Date: Sun, 21 Jun 2026 17:36:12 +0200 Subject: [PATCH] fix: update OLLAMA_API_URL to correct endpoint and enable follow_redirects in HTTP client --- backend/app/main.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/backend/app/main.py b/backend/app/main.py index e1d5733..daeb9dc 100644 --- a/backend/app/main.py +++ b/backend/app/main.py @@ -11,7 +11,7 @@ from app.auth import get_discovery, settings, validate_token from app.schemas import AuthCallbackRequest, AuthConfigResponse, ChatRequest OLLAMA_API_KEY = os.getenv("OLLAMA_API_KEY") -OLLAMA_API_URL = os.getenv("OLLAMA_API_URL", "https://api.ollama.com/v1/chat/completions") +OLLAMA_API_URL = os.getenv("OLLAMA_API_URL", "https://ollama.com/v1/chat/completions") if not OLLAMA_API_KEY: raise RuntimeError("Environment variable OLLAMA_API_KEY is required") @@ -44,7 +44,7 @@ async def event_stream(request: ChatRequest) -> AsyncGenerator[str, None]: "Accept": "text/event-stream", } - async with httpx.AsyncClient(timeout=None) as client: + async with httpx.AsyncClient(timeout=None, follow_redirects=True) as client: async with client.stream("POST", OLLAMA_API_URL, json=payload, headers=headers) as response: if response.status_code >= 400: text = await response.aread()