simplify Athena runtime and centralize MCP management

This commit is contained in:
Mikei386
2026-08-26 09:57:38 +02:00
parent 104c9904a5
commit ab671a6396
31 changed files with 918 additions and 419 deletions
+9 -3
View File
@@ -99,6 +99,9 @@ class Handler(BaseHTTPRequestHandler):
self.send_header("Connection", "close")
self.end_headers()
model = body.get("model")
delay = body.get("mock_stream_delay", 0.05)
if not isinstance(delay, (int, float)) or delay < 0 or delay > 10:
delay = 0.05
for tok in ["Mock-", "Streaming", "-Antwort", f" ({model})"]:
chunk = {
"id": "chatcmpl-mock",
@@ -109,9 +112,12 @@ class Handler(BaseHTTPRequestHandler):
}
self.wfile.write(f"data: {json.dumps(chunk)}\n\n".encode())
self.wfile.flush()
time.sleep(0.05)
self.wfile.write(b"data: [DONE]\n\n")
self.wfile.flush()
time.sleep(delay)
try:
self.wfile.write(b"data: [DONE]\n\n")
self.wfile.flush()
except (BrokenPipeError, ConnectionResetError):
pass
def _json(self, code: int, payload: dict) -> None:
body = json.dumps(payload).encode()