From 656037405d507f304714a0c6c9b76b1e5a5cc0d6 Mon Sep 17 00:00:00 2001 From: Homelab Cursor Date: Mon, 23 Mar 2026 20:50:01 +0100 Subject: [PATCH] mail: Klassifizierung von OpenRouter auf lokales Ollama (qwen2.5:14b) umgestellt --- homelab-ai-bot/core/mail_client.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/homelab-ai-bot/core/mail_client.py b/homelab-ai-bot/core/mail_client.py index 32d031b8..0005a10a 100644 --- a/homelab-ai-bot/core/mail_client.py +++ b/homelab-ai-bot/core/mail_client.py @@ -259,12 +259,14 @@ def classify_mails(mails: list[dict], api_key: str) -> list[dict]: for i, m in enumerate(mails) ) + OLLAMA_URL = "http://100.84.255.83:11434/v1/chat/completions" + OLLAMA_MODEL = "qwen2.5:14b" + try: r = _req.post( - "https://openrouter.ai/api/v1/chat/completions", - headers={"Authorization": f"Bearer {api_key}"}, + OLLAMA_URL, json={ - "model": "openai/gpt-4o-mini", + "model": OLLAMA_MODEL, "messages": [ {"role": "system", "content": CLASSIFY_PROMPT}, {"role": "user", "content": mail_text}, @@ -272,7 +274,7 @@ def classify_mails(mails: list[dict], api_key: str) -> list[dict]: "max_tokens": 2000, "temperature": 0, }, - timeout=60, + timeout=120, ) r.raise_for_status() content = r.json()["choices"][0]["message"]["content"]