WIP: tunning

This commit is contained in:
2025-05-03 19:21:12 +01:00
parent 302dd7e965
commit afeaeba313
3 changed files with 17 additions and 9 deletions

View File

@@ -86,9 +86,14 @@ async def main() -> None:
}
headers = {"Authorization": f"Bearer {AI_HANDLER_TOKEN}"}
async with httpx.AsyncClient() as http:
resp = await http.post(f"{AI_HANDLER_URL}/api/v1/message", json=payload, headers=headers)
resp.raise_for_status()
data = resp.json()
try:
resp = await http.post(f"{AI_HANDLER_URL}/api/v1/message", json=payload, headers=headers)
resp.raise_for_status()
data = resp.json()
except httpx.HTTPStatusError as e:
logger.error(f"HTTP error: {e.response.status_code} - {e.response.text}")
except Exception:
logger.exception("Error while calling AI handler")
if data.get("reply"):
client.send_message(event["room_id"], data["reply"])