feat(stt): assistant vocal Jarvis — client pipx + STT-server in-cluster (#4)

* feat(stt): cadrage + squelette assistant vocal Jarvis

Conception validée du projet STT — assistant vocal/HUD du homelab Funk :
- HUD web sur-mesure + STT/TTS local (faster-whisper + Piper)
- Packaging commande pipx (stt), démarrage auto systemd --user
- Cerveau 3 modes + auto-détection LAN : hermes / local-direct / claude-direct
- Mémoire 3 tiers : SQLite local + Qdrant s01 + GitHub (distillée, versionnée)

Réutilise tools/hermes-voice, LiteLLM, Hermes Agent. Squelette + doc admin/ia/stt.md,
implémentation par phases (roadmap dans le doc).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013FmcxGsyXZXogiAHQLjnZT

* feat(stt): phase 1-2 — commande, backend vocal, routeur cerveau, HUD MVP

- cli.py : commande `stt` (--setup, --mode, --no-tts)
- config.py : défauts embarqués + ~/.config/stt/stt.toml
- voice/engine.py : refactor de hermes-voice en classe avec callbacks d'état
- brain/router.py : 3 modes (hermes SSH / local LiteLLM / claude API) + auto-détection LAN
- server/app.py : HTTP statique (HUD) + websocket (états → HUD)
- memory/store.py : tier local SQLite (Qdrant + sync GitHub = phase 4)
- hud/index.html : HUD MVP (visualiseur d'état + conversation)

Vérifié hors-LAN : py_compile, --help, config, routeur (→ claude), mémoire SQLite.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013FmcxGsyXZXogiAHQLjnZT

* fix(stt): embarquer le HUD dans le package (404 après pipx install)

Le HUD était à la racine du projet (stt/hud/) donc absent du package installé
par pipx → HTTP 404 sur /. Déplacé dans le package (stt/stt/hud/) + package-data,
HUD_DIR ajusté. Vérifié : le wheel contient bien stt/hud/index.html.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013FmcxGsyXZXogiAHQLjnZT

* refactor(stt): pivot client-serveur — STT-server in-cluster + client pipx

Sépare STT en deux :
- stt/client/ : commande `stt` (pipx), voix locale (Whisper/Piper) + HUD ; envoie
  le texte au serveur via api.py (ServerClient → POST /v1/ask). URL serveur paramétrable,
  pas de cerveau local (suppression du routeur 3 modes).
- stt/server/ : STT-server FastAPI (conteneur), /healthz + /v1/ask → LiteLLM (Qwen3/Claude).

Déploiement cluster :
- k8s/apps/stt/ : Deployment, Service, IngressRoute (stt.lab.local), litellm-ext
  (Service + Endpoints → 192.168.10.1:4000 pour joindre LiteLLM hors cluster)
- k8s/apps-of-apps/apps/stt.yaml : Application ArgoCD (depuis main)
- .github/workflows/build-stt-server.yml : build/push image → ghcr.io/alkatrazz24/funk-stt-server

Inférence/chat seulement (outils Hermes 'agir sur Funk' = phase ultérieure, API :8080 à spécifier).
Vérifié : py_compile client+serveur, YAML manifests, ServerClient.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013FmcxGsyXZXogiAHQLjnZT

---------

Co-authored-by: Claude <noreply@anthropic.com>
This commit is contained in:
ALI YESILKAYA 2026-06-17 12:08:58 +02:00 committed by GitHub
parent 22d40023e1
commit e390ddef12
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
34 changed files with 1378 additions and 0 deletions

77
stt/client/stt/config.py Normal file
View file

@ -0,0 +1,77 @@
"""Configuration du client STT.
Défauts embarqués (robuste pour pipx). `stt --setup` les écrit dans
~/.config/stt/stt.toml ; au lancement on fusionne le fichier utilisateur par-dessus.
Le client ne contient PLUS le cerveau : il envoie le texte au STT-server (URL paramétrable).
"""
from __future__ import annotations
import tomllib
from pathlib import Path
from typing import Any
CONFIG_DIR = Path.home() / ".config" / "stt"
CONFIG_PATH = CONFIG_DIR / "stt.toml"
DATA_DIR = Path.home() / ".local" / "share" / "stt"
DEFAULT_CONFIG: dict[str, Any] = {
"server": {
# STT-server (in-cluster) — joignable via Traefik / wildcard *.lab.local
"url": "http://stt.lab.local",
"timeout_sec": 90,
},
"voice": {
"wake_word": "hermes",
"whisper_model": "large-v3",
"piper_voice": "fr_FR-upmc-medium",
"language": "fr",
"silence_sec": 1.2,
"min_speech_sec": 0.6,
"chat_timeout_sec": 60,
},
"ui": {
"theme": "arc-reactor",
"avatar": "default",
"kiosk": True,
"ws_host": "127.0.0.1",
"ws_port": 9300,
"http_port": 9301,
},
"memory": {
# cache local de conversation (brut, gitignoré) — la vraie mémoire est côté serveur
"enabled": True,
"local_db": str(DATA_DIR / "memory.sqlite"),
},
}
def _deep_merge(base: dict, over: dict) -> dict:
out = dict(base)
for k, v in over.items():
if isinstance(v, dict) and isinstance(out.get(k), dict):
out[k] = _deep_merge(out[k], v)
else:
out[k] = v
return out
def load_config() -> dict[str, Any]:
if CONFIG_PATH.exists():
with CONFIG_PATH.open("rb") as f:
user = tomllib.load(f)
return _deep_merge(DEFAULT_CONFIG, user)
return DEFAULT_CONFIG
def write_default_config(force: bool = False) -> Path:
import tomli_w
CONFIG_DIR.mkdir(parents=True, exist_ok=True)
DATA_DIR.mkdir(parents=True, exist_ok=True)
if CONFIG_PATH.exists() and not force:
return CONFIG_PATH
with CONFIG_PATH.open("wb") as f:
tomli_w.dump(DEFAULT_CONFIG, f)
return CONFIG_PATH