Made changes to suit Openwebui

This commit is contained in:
Iyeoluwa Akinrinola
2025-05-09 16:47:30 +01:00
parent ac98999507
commit 9535052645
14 changed files with 93 additions and 330 deletions
+7 -2
View File
@@ -212,12 +212,17 @@ class ModelService:
# Make the API call to Ollama
try:
# Prepare headers with API key
headers = {"Content-Type": "application/json"}
if self.openwebui_api_key:
headers["Authorization"] = f"Bearer {self.openwebui_api_key}"
# Ollama API endpoint is /api/chat or /api/generate
response = requests.post(
f"{self.ollama_api_url}/api/generate",
headers={"Content-Type": "application/json"},
headers=headers,
json=request_json,
timeout=30
timeout=60
)
response.raise_for_status()