Feat: Hermes Voice Client (Wake Word + STT + Vision + TTS)

Windows-Desktop-Script: Energy VAD + Whisper Wake Detection,
faster-whisper STT, mss Screen Capture, MC2 Vision/Chat API,
Edge TTS Ausgabe, pystray System Tray. Kein Account nötig —
Wake Word frei konfigurierbar via WAKE_WORDS in config.py.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Hitonabi
2026-06-26 22:02:52 +02:00
parent 9b68db9e82
commit e19831f7d5
9 changed files with 539 additions and 0 deletions
+45
View File
@@ -0,0 +1,45 @@
import httpx
from config import (
MC2_BASE_URL, CHAT_MODEL, VISION_MODEL,
MAX_RESPONSE_TOKENS, REQUEST_TIMEOUT, SYSTEM_PROMPT,
SCREENSHOT_ON_QUERY,
)
def ask(text: str, screenshot_b64: str | None = None) -> str:
"""Schickt Text (+ optionalen Screenshot) an MC2 und gibt die Antwort zurück."""
use_vision = screenshot_b64 is not None and SCREENSHOT_ON_QUERY
model = VISION_MODEL if use_vision else CHAT_MODEL
if use_vision:
user_content = [
{"type": "text", "text": text},
{"type": "image_url", "image_url": {
"url": f"data:image/jpeg;base64,{screenshot_b64}"
}},
]
else:
user_content = text
payload = {
"model": model,
"messages": [
{"role": "system", "content": SYSTEM_PROMPT},
{"role": "user", "content": user_content},
],
"max_tokens": MAX_RESPONSE_TOKENS,
"stream": False,
}
try:
with httpx.Client(timeout=REQUEST_TIMEOUT) as client:
response = client.post(
f"{MC2_BASE_URL}/chat/completions",
json=payload,
)
response.raise_for_status()
return response.json()["choices"][0]["message"]["content"].strip()
except httpx.TimeoutException:
return "Entschuldigung, die Antwort hat zu lange gedauert."
except Exception as e:
return f"Verbindungsfehler: {e}"