lightning-whisper-mlx returns segments as [start, end, text] lists (not dicts) in some versions, which broke transcribe(). Normalize all three observed shapes: str output, list/tuple segments, dict segments. Also fall back to joining segment texts when top-level text is empty.
Voice-Agent Mac-Worker
Stateless FastAPI-Service auf dem Mac. Macht die schwere Arbeit: Whisper-Transkription und Ollama-Zusammenfassung. Wird vom LXC-Frontend per HTTP angesprochen.
Setup (Apple Silicon)
cd mac-worker
python3.11 -m venv .venv
source .venv/bin/activate
pip install --upgrade pip
pip install -r requirements.txt
cp .env.example .env
# Bei Bedarf .env anpassen
Ollama vorbereiten
# Ollama installieren, falls noch nicht geschehen
brew install ollama
# Modell ziehen
ollama pull llama3.1:8b
# Ollama netzwerkweit erreichbar machen (LaunchAgent)
launchctl setenv OLLAMA_HOST "0.0.0.0:11434"
brew services restart ollama
Whisper-Engine wählen
WHISPER_ENGINE |
Wann nutzen |
|---|---|
mlx |
Apple Silicon — schnellste Option |
faster |
Intel-Mac / Linux / CUDA |
mock |
Testbetrieb ohne echtes Modell |
Worker starten
uvicorn app.main:app --host 0.0.0.0 --port 8080
Health-Check vom LXC:
curl http://<MAC-IP>:8080/health
API-Endpunkte
| Methode | Pfad | Zweck |
|---|---|---|
| GET | /health |
Status + Ollama-Reachability |
| POST | /api/transcribe |
multipart: audio, language → Transkript-JSON |
| POST | /api/summarize |
JSON: transcript, title → Summary-JSON |
| POST | /api/protocol |
JSON: transcript, summary, title → Protokoll-JSON |
| POST | /api/export/docx |
JSON: Protokoll → DOCX-Binary |
Firewall am Mac
# Eingehende Verbindungen auf Port 8080 erlauben (System-Settings > Network > Firewall)
# oder via pf — siehe Apple-Doku.
Der Worker hat keine Authentifizierung — Betrieb nur im internen Netz.