feat: settings web UI (models / STT / TTS speed / language / LLM instructions)
Adds /settings (served by the bridge) to change the LLM model (from installed Ollama models), Whisper model, TTS engine + MeloTTS speed, output language, agentic max-turns, thinking mode, and free-form LLM instructions — live, with a 'apply' that restarts the bridge + TTS worker. Settings persist to the runtime config JSON; engine reads output_language + llm_instructions and the TTS worker reads melo_speed from it. Bridge port publishable for access.
This commit is contained in:
@@ -36,7 +36,26 @@ from http.server import BaseHTTPRequestHandler, ThreadingHTTPServer
|
||||
HOST = os.environ.get("MELO_WORKER_HOST", "127.0.0.1")
|
||||
PORT = int(os.environ.get("MELO_WORKER_PORT", "8770"))
|
||||
LANGUAGE = os.environ.get("MELO_LANGUAGE", "KR")
|
||||
SPEED = float(os.environ.get("MELO_SPEED", "1.5"))
|
||||
|
||||
|
||||
def _resolve_speed() -> float:
|
||||
"""Speaking rate: the settings-UI value (runtime config JSON) wins, else the
|
||||
MELO_SPEED env, else 1.5. Read at startup; the settings UI restarts this
|
||||
worker on apply so a new value takes effect."""
|
||||
try:
|
||||
cp = os.environ.get("JARVIS_CONFIG_PATH", "/app/config/jarvis.json")
|
||||
v = json.loads(open(cp, encoding="utf-8").read()).get("melo_speed")
|
||||
if v is not None:
|
||||
return float(v)
|
||||
except Exception:
|
||||
pass
|
||||
try:
|
||||
return float(os.environ.get("MELO_SPEED", "1.5"))
|
||||
except ValueError:
|
||||
return 1.5
|
||||
|
||||
|
||||
SPEED = _resolve_speed()
|
||||
DEVICE = os.environ.get("MELO_DEVICE", "cpu")
|
||||
|
||||
# Model + speaker id are loaded once, guarded by a lock because MeloTTS
|
||||
|
||||
Reference in New Issue
Block a user