Files
ARIA-AGENT/xtts/llm-adapter/README.md
T
duffyduckandClaude Opus 4.8 98c78af7ad feat(local-llm): B0 — Gamebox llama.cpp + RVS-Adapter (Provider-Seite)
Plan B, Phase B0 (Provider): lokales Qwen3-8B auf der Gamebox, angebunden
per RVS wie f5tts/whisper (kein IP-Pflegen, nur URL+Token).

- xtts/llm-adapter/: RVS-Client (spiegelt whisper-bridge: TLS+ws-Fallback,
  Reconnect-Backoff), nimmt llm_request, ruft llama.cpp /v1/chat/completions
  lokal, antwortet llm_response (korreliert per requestId). Nicht-streamend
  in B0; llm_partial fuer B2 reserviert.
- xtts/docker-compose.yml: neue Services `llama` (llama.cpp server-cuda,
  GGUF via ./models, OpenAI-API auf :8081) + `llm-adapter`.
- rvs/server.js: ALLOWED_TYPES += llm_request/llm_response/llm_partial.
- GGUF (mehrere GB) via .gitignore aus dem Repo; xtts/models/ mit .gitkeep.

Topologie-Hinweis: Gamebox@home, ARIA@RZ -> Bounce ueber Internet ist
unvermeidbar (Voice macht's schon so); Router faellt bei Nichterreichbarkeit
per Escalation auf Claude zurueck. Consumer-Seite (Bridge-Relay + Brain-
Client + Router) kommt als naechstes.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-11 09:43:46 +02:00

65 lines
2.1 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# Local-LLM-Adapter (Gamebox) — Plan B, Phase B0
Bringt ein lokales, schnelles LLM (Qwen3 8B) auf die Gamebox und haengt es
per RVS an ARIA — fuer die einfachen ~80 % der Turns (<1 s), waehrend Claude
das Tiefen-Hirn bleibt. Siehe `docs/plan-local-llm-router.md` im Repo-Root.
## Zwei Container (in `xtts/docker-compose.yml`)
- **`llama`** — `llama.cpp`-Server (CUDA), serviert das GGUF OpenAI-kompatibel
auf `:8081`, nur im Compose-Netz.
- **`llm-adapter`** — verbindet sich per Token an den RVS (wie f5tts/whisper),
nimmt `llm_request` entgegen, ruft `llama` lokal, antwortet `llm_response`.
## Modell besorgen (einmalig)
GGUF nach `xtts/models/` legen. Empfohlen: **Qwen3 8B, Q4_K_M**.
```bash
mkdir -p xtts/models
# z.B. von Hugging Face (huggingface-cli oder Browser-Download):
# Suche: "Qwen3-8B-GGUF" -> Datei qwen3-8b-q4_k_m.gguf
# Datei ablegen als:
# xtts/models/qwen3-8b-q4_k_m.gguf
```
Anderer Dateiname? In der `.env` der Gamebox setzen:
```
LLM_GGUF=dein-modell.gguf
LLM_CTX=8192 # Kontextfenster (kleiner = weniger VRAM)
```
Mistral statt Qwen testen (A/B): einfach ein Mistral-Small-3-GGUF ablegen und
`LLM_GGUF` umstellen — Ein-Datei-Wechsel, kein Code.
## Start (auf der Gamebox)
```bash
cd xtts
docker compose up -d --build llama llm-adapter
docker logs -f aria-llm-adapter # "RVS verbunden — llm-adapter online"
```
## Standalone-Test (ohne ARIA), direkt gegen llama.cpp
```bash
curl http://localhost:8081/v1/chat/completions -H "Content-Type: application/json" -d '{
"messages":[{"role":"system","content":"Du bist ARIA."},
{"role":"user","content":"sag kurz hallo"}],
"max_tokens":64
}'
```
## VRAM-Hinweis (RTX 3060, 12 GB)
whisper-small (~12) + f5tts (~12) + qwen3-8b-q4 (~6) ≈ 910 GB. Passt, aber
knapp. Bei OOM: `LLM_CTX` reduzieren, `-ngl` senken (weniger Layer auf GPU),
oder kleineres Quant (Q4_K_S / IQ4_XS).
## Nachrichten-Kontrakt (RVS)
- `llm_request``{ requestId, messages:[{role,content}], max_tokens?, temperature?, stop? }`
- `llm_response``{ requestId, ok, content, error?, model, elapsedMs }`
- `llm_partial` — reserviert fuer B2 (Token-Streaming), noch ungenutzt.