8881d65c8d
- speak() hing weil pygame.time.wait() die asyncio Event-Loop blockierte. Fix: time.sleep(0.05) statt pygame.time.wait() im Playback-Loop. - asyncio.new_event_loop() statt asyncio.run() — thread-sicher, kein "event loop already running" in Worker-Threads. - _speak_lock verhindert parallele TTS-Aufrufe. - Stimme: de-DE-SeraphinaMultilingualNeural als Default (modern, weiblich, multilingual neural). Dropdown in Settings mit allen DE/EN Optionen. - speak()-Signatur: voice + rate als Parameter (statt config-Import). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
40 lines
1015 B
Python
40 lines
1015 B
Python
import json
|
|
from pathlib import Path
|
|
|
|
CONFIG_DIR = Path.home() / ".hermes-voice"
|
|
SETTINGS_FILE = CONFIG_DIR / "settings.json"
|
|
|
|
DEFAULTS = {
|
|
"mc2_url": "http://192.168.178.151:9001/v1",
|
|
"chat_model": "Hermes-4-14B",
|
|
"vision_model": "Qwen3-VL-2B-Instruct",
|
|
"hotkey": "ctrl_r",
|
|
"tts_voice": "de-DE-SeraphinaMultilingualNeural",
|
|
"tts_rate": "+0%",
|
|
"whisper_model": "small",
|
|
"language": "de",
|
|
"screenshot_enabled": True,
|
|
"screenshot_monitor": 1,
|
|
"max_response_tokens": 200,
|
|
"silence_timeout": 1.5,
|
|
}
|
|
|
|
|
|
def load() -> dict:
|
|
CONFIG_DIR.mkdir(exist_ok=True)
|
|
if SETTINGS_FILE.exists():
|
|
try:
|
|
saved = json.loads(SETTINGS_FILE.read_text(encoding="utf-8"))
|
|
return {**DEFAULTS, **saved}
|
|
except Exception:
|
|
pass
|
|
return dict(DEFAULTS)
|
|
|
|
|
|
def save(settings: dict):
|
|
CONFIG_DIR.mkdir(exist_ok=True)
|
|
SETTINGS_FILE.write_text(
|
|
json.dumps(settings, indent=2, ensure_ascii=False),
|
|
encoding="utf-8",
|
|
)
|