first commit

This commit is contained in:
ersterDetektiv
2026-09-25 06:47:14 +02:00
commit 6f198c3d51
9 changed files with 1100 additions and 0 deletions
+139
View File
@@ -0,0 +1,139 @@
# Thorsten Voice Assistant
Modularer, lokaler Sprachassistent auf Basis von Piper TTS + llama.cpp.
## Architektur
```
input_helper.py
│
│ data/llm_input.json
▼
llm_module.py (Qwen2.5-0.5B via llama-cpp-python)
│
│ data/tts_input.json
▼
tts_module.py (Thorsten Emotional Voice via Piper)
│
▼
data/output.wav
```
### JSON-Formate
**llm_input.json** (Helper → LLM):
```json
{
"request": "Was ist die Hauptstadt von Frankreich?",
"type": "query",
"emotion": "neutral",
"autoplay": true,
"history": []
}
```
**tts_input.json** (LLM → TTS):
```json
{
"text": "Die Hauptstadt von Frankreich ist Paris.",
"emotion": "neutral",
"speaker_id": 4,
"output_file": "data/output.wav",
"autoplay": true
}
```
### Verfügbare Emotionen
| Name | Speaker ID |
|------|-----------|
| amused | 0 |
| angry | 1 |
| disgusted | 2 |
| drunk | 3 |
| **neutral** | **4** |
| sleepy | 5 |
| surprised | 6 |
| whisper | 7 |
---
## Einrichtung
```bash
# 1. Virtual Environment aktivieren
source ~/.venv/bin/activate
# 2. Modell herunterladen (einmalig, ~400 MB)
python download_model.py
```
---
## Verwendung
### Interaktiver Modus (Entwicklung)
```bash
source ~/.venv/bin/activate
python input_helper.py
```
Terminalbefehle im interaktiven Modus:
- `:emotion drunk` – Emotion wechseln
- `:history` – Gesprächsverlauf anzeigen
- `:clear` – Verlauf löschen
- `exit` – Beenden
### Einmaliger Aufruf
```bash
python input_helper.py "Was ist das Wetter heute?"
python input_helper.py "Guten Morgen" --emotion amused
python input_helper.py "Leise Nachricht" --emotion whisper --no-play
```
### Module direkt aufrufen
```bash
# Nur LLM (mit JSON-Datei)
python llm_module.py data/llm_input.json
# Nur TTS (mit JSON-Datei)
python tts_module.py data/tts_input.json
# TTS mit Pipe
echo '{"text":"Hallo Welt","emotion":"neutral"}' | python tts_module.py
```
---
## Dateien
| Datei | Beschreibung |
|-------|-------------|
| `input_helper.py` | Terminal-Eingabe → JSON → LLM → TTS |
| `llm_module.py` | LLM-Verarbeitung mit Qwen GGUF |
| `tts_module.py` | Text-to-Speech mit Thorsten Emotional |
| `download_model.py` | Lädt Qwen-Modell herunter |
| `thorsten.py` | (Alt) Ursprüngliches Test-Script |
| `models/` | GGUF-Modelle |
| `data/` | JSON-Austausch-Dateien & Audio-Output |
---
## Erweiterung (zukünftige Module)
Das System ist modular aufgebaut. Weitere Module können einfach eingeklinkt werden:
```
STT-Modul (Mikrofon → Text)
│
▼
input_helper.py / eigener JSON-Producer
│
▼
Router-Modul (query vs. command)
├── llm_module.py (für Antworten)
└── command_module.py (für Smart-Home etc.)
│
▼
tts_module.py
```