fix: update OLLAMA_API_URL to correct endpoint and enable follow_redirects in HTTP client
This commit is contained in:
+2
-2
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user