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()