diff --git a/__pycache__/chat.cpython-314.pyc b/__pycache__/chat.cpython-314.pyc index 290f5b9..49ac2a7 100644 Binary files a/__pycache__/chat.cpython-314.pyc and b/__pycache__/chat.cpython-314.pyc differ diff --git a/__pycache__/tui.cpython-314.pyc b/__pycache__/tui.cpython-314.pyc deleted file mode 100644 index aad3f6b..0000000 Binary files a/__pycache__/tui.cpython-314.pyc and /dev/null differ diff --git a/chat.md b/chat.md index 3596579..0eb4a48 100644 --- a/chat.md +++ b/chat.md @@ -6,4 +6,8 @@ Nutze nur dann Beispiele, wenn du gefragt wirst. Wenn möglich, antworte in etwa [assistant] Verstanden. +[user] +Kleiner Test, funktionierst du? +[assistant] +Offensichtlich. diff --git a/chat.py b/chat.py index d21a3f0..bf77595 100644 --- a/chat.py +++ b/chat.py @@ -17,6 +17,7 @@ Die Datei ist die einzige Quelle der Wahrheit. Dieses Modul stellt die Bausteine bereit, die auch das TUel (tui.py) verwendet. """ +import os import re import sys from pathlib import Path @@ -24,9 +25,10 @@ from typing import Iterator from openai import OpenAI -BASE_URL = "http://127.0.0.1:8000/v1" +BASE_URL = "http://192.168.161.4:9161/v1" MODEL = "glm-5.2-colibri" MAX_TOKENS = 1024 +API_KEY = os.environ.get("COLIBRI_API_KEY", "not-needed") HEADER_RE = re.compile(r"^\[(system|assistant|user)\]\s*$", re.IGNORECASE) TRAILING_EMPTY_RE = re.compile(r"\n*\[(?:system|assistant|user)\][ \t]*\s*$", re.IGNORECASE) @@ -35,10 +37,11 @@ _client: OpenAI | None = None def client() -> OpenAI: - """Lazy angelegter OpenAI-Client (lokaler Endpunkt, API-Key beliebig).""" + """Lazy angelegter OpenAI-Client. Key aus COLIBRI_API_KEY, sonst Dummy + (der lokale Endpunkt braucht keinen).""" global _client if _client is None: - _client = OpenAI(base_url=BASE_URL, api_key="not-needed") + _client = OpenAI(base_url=BASE_URL, api_key=API_KEY) return _client