feat: llm-proxy - switch d'instance llama.cpp transparent + UI :3017

- Route virtuelle :3012 -> instance active (8080 Q4_K_M / 8081 IQ4_XS), etat persiste
- Alias modele qwen3.8-27b : reecriture id reel <-> alias (v1/models, chat, completions,
  embeddings, streaming SSE) -> switch transparent pour tous les harnais
- UI de gestion :3017 (statut, Activer, Tester) en page unique sans dependance ajoutee
- Fail-fast 503 (20s) si instance active arreteee, sans spam WOL
This commit is contained in:
Effi Server
2026-09-19 12:09:02 +00:00
parent cbcf349f39
commit 5fc23a562d
7 changed files with 421 additions and 41 deletions
+46 -19
View File
@@ -28,18 +28,19 @@ Effi est un assistant IA personnel **100% auto-hébergé**, avec mémoire persis
│ EFFI SERVER (192.168.1.27) │ │ FOLZO-CORP (192.168.1.11) │
│ │ │ │
│ ┌──────────────┐ ┌────────────────┐ │ │ ┌──────────────┐ ┌──────────────┐ │
│ │ Open WebUI │ │ llm-proxy │ │ │ │ llama.cpp │ │ Ollama │ │
│ │ Port 3000 │ │ :3011 Ollama │ │ │ │ Port 8080 │ │ Port 11434 │ │
│ └──────────────┘ │ :3012 llama.cpp│ │ │ │ (modèle │ │ (vision, │ │
│ ┌──────────────┐ │ :3015 STT │ │ │ │ principal) │ │ embeddings) │ │
│ │ Qdrant │ │ :3016 TTS │ │ │ └──────────────┘ └──────────────┘ │
│ │ Port 6333 │ │ + Wake-on-LAN │ │ │ │
│ └──────────────┘ └────────────────┘ │ │ ┌──────────────┐ ┌──────────────┐ │
│ │ Open WebUI │ │ llm-proxy │ │ │ │ llama.cpp A │ │ Ollama │ │
│ │ Port 3000 │ │ :3011 Ollama │ │ │ │ :8080 │ │ :11434 │ │
│ └──────────────┘ │ :3012 llama.cpp│ │ │ │ (Q4_K_M) │ │ (vision, │ │
│ ┌──────────────┐ │ :3015 STT │ │ │ └──────────────┘ │ embeddings) │ │
│ │ Qdrant │ │ :3016 TTS │ │ │ ┌──────────────┐ └──────────────┘ │
│ │ Port 6333 │ │ :3017 UI switch│ │ │ │ llama.cpp B │ │
│ └──────────────┘ │ + Wake-on-LAN │ │ │ │ :8081 │ │
│ └────────────────┘ │ │ │ (IQ4_XS) │ │
│ │ │ └──────────────┘ │
│ │ │ ┌──────────────┐ ┌──────────────┐ │
│ │ │ │ ComfyUI │ │ effi-stt │ │
│ ┌──────────────┐ ┌──────────────┐ │ │ │ Port 8188 │ │ Port 8200 │ │
│ │ n8n │ │ openedai │ │ │ │ Image/Audio │ │ Whisper STT │ │
│ │ Port 5678 │ │ TTS :8100 │ │ │ └──────────────┘ └──────────────┘ │
│ └──────────────┘ └──────────────┘ │ │ │
│ │ │ │ :8188 │ │ :8200 │ │
│ │ │ └──────────────┘ └──────────────┘ │
└───────────────────────────────────────┘ └─────────────────────────────────────────┘
```
@@ -53,7 +54,8 @@ Effi est un assistant IA personnel **100% auto-hébergé**, avec mémoire persis
| Service | Port | Image | Rôle | RAM/VRAM | Auto-unload |
|---------|------|-------|------|----------|-------------|
| **llama.cpp** | 8080 | Native | LLM principal (qwen3.8-27b) | ~28GB | Démarré au boot |
| **llama.cpp A** | 8080 | Native | LLM principal — qwen3.8-27b **Q4_K_M** (17,5GB) | ~28GB | Démarré au boot |
| **llama.cpp B** | 8081 | Native | LLM alternatif — qwen3.8-27b **IQ4_XS** (14,2GB) | ~24GB | Démarré au boot |
| **Ollama** | 11434 | Native | LLM vision + embeddings | ~4-6GB | 5min après dernier usage |
| **ComfyUI** | 8188 | `yanwk/comfyui-boot:rocm` | Image + Audio generation | 18GB shm | ✅ après 10min idle |
| **effi-stt** | 8200 | Build local | Whisper STT | ~20MB | ✅ après 5min idle |
@@ -67,7 +69,7 @@ Effi est un assistant IA personnel **100% auto-hébergé**, avec mémoire persis
| **Open WebUI** | 3000 | `ghcr.io/open-webui/open-webui:main` | Interface IA |
| **Qdrant** | 6333 | `qdrant/qdrant:latest` | Vector DB (RAG) |
| **n8n** | 5678 | `docker.n8n.io/n8nio/n8n:latest` | Automatisation |
| **llm-proxy** | 3011/3012/3015/3016 | Build local | Proxy unique + Wake-on-LAN |
| **llm-proxy** | 3011/3012/3015/3016/3017 | Build local | Proxy unique + Wake-on-LAN + UI switch |
| **openedai-speech** | 8100 | `ghcr.io/matatonic/openedai-speech` | TTS |
| **beszel-agent** | - | `henrygd/beszel-agent:latest` | Monitoring |
@@ -83,16 +85,34 @@ Effi est un assistant IA personnel **100% auto-hébergé**, avec mémoire persis
### 💬 Chat IA
- **Interface**: Open WebUI
- **LLM principal**: llama.cpp (qwen3.8-27b) via `llm-proxy:3012`
- **LLM principal**: llama.cpp (`qwen3.8-27b`) via `llm-proxy:3012`
- **Switch d'instance** : 2 instances llama.cpp (8080 Q4_K_M, 8081 IQ4_XS), bascule via l'UI du proxy sans toucher aux configs
- **LLM vision / embeddings**: Ollama via `llm-proxy:3011`
- **Wake-on-LAN automatique**: le proxy réveille la station GPU si elle est éteinte
### 🔌 llm-proxy — Proxy unique + Wake-on-LAN
- **4 routes** : Ollama (`:3011`), llama.cpp (`:3012`), STT (`:3015`), TTS (`:3016`)
### 🔌 llm-proxy — Proxy unique + Wake-on-LAN + UI switch
- **5 routes** : Ollama (`:3011`), llama.cpp (`:3012`), STT (`:3015`), TTS (`:3016`), UI de gestion (`:3017`)
- **Route virtuelle `:3012`** : pointe vers l'instance llama.cpp active (8080 ou 8081), choix persisté dans `llm-proxy/state/active.json`
- **Alias modèle** : les harnais envoient toujours `qwen3.8-27b` ; le proxy réécrit l'id réel dans les 2 sens (requêtes, `/v1/models`, streaming SSE) → le switch est invisible pour OpenWebUI/OpenFox/Hermes
- **Wake-on-LAN** : si le PC est éteint, envoie 3 paquets magic (MAC `04:D9:F5:D1:EC:DF`) puis attend le service
- **Anti-spam WOL** : un seul réveil en cours à la fois, pas de re-envoi pendant l'attente
- **Fail-fast** : PC up mais instance cible éteinte → 503 après 20s (pas de WOL)
- **API OpenAI-compatible** : `/v1/models` et `/v1/chat/completions` sur les routes LLM
- **Streaming** : passthrough des réponses SSE
- **Streaming** : passthrough des réponses SSE (alias réécrit par ligne)
- **UI `:3017`** : statut des 2 instances, bouton *Activer* (persisté), bouton *Tester* (latence + réponse)
#### Switcher entre les 2 versions de qwen3.8
1. Sur le PC : démarrer l'instance voulue (et arrêter l'autre — une seule tient dans la VRAM)
2. Ouvrir http://192.168.1.27:3017 → *Tester* pour vérifier que l'instance répond → *Activer*
3. Terminé : `:3012` sert désormais la nouvelle instance, zéro changement de config côté harnais
```bash
# Alternative sans UI
curl -X POST http://192.168.1.27:3017/api/activate -d '{"real":"qwen3.8-27b"}' # instance A (8080)
curl -X POST http://192.168.1.27:3017/api/activate -d '{"real":"qwen3.8-27b-iq4xs"}' # instance B (8081)
curl http://192.168.1.27:3017/api/status
```
### 🎤 Pipeline Vocal
- **STT**: Whisper large-v3 via effi-stt (CPU, déchargement auto)
@@ -186,9 +206,10 @@ python3 scripts/beszel_client.py --system folzocorp --check stats
```
effi/
├── llm-proxy/ # Proxy unique + Wake-on-LAN
├── llm-proxy/ # Proxy unique + Wake-on-LAN + UI switch
│ ├── app.py
│ └── Dockerfile
│ ├── Dockerfile
│ └── state/ # Persistance instance active (active.json)
│
├── beszel/ # Configuration Beszel
│ ├── docker-compose-hub.yml # Hub (Synology)
@@ -234,6 +255,12 @@ effi/
## 📝 Historique
**Septembre 2026** - Switch d'instance llama.cpp
- 2 instances llama.cpp sur folzo-Corp (8080 Q4_K_M, 8081 IQ4_XS)
- Route virtuelle `:3012` + alias modèle `qwen3.8-27b` : switch transparent, zéro re-config harnais
- UI de gestion `:3017` (statut, Activer, Tester)
- Fail-fast 503 (20s) quand l'instance active est éteinte, sans spam WOL
**Août 2026** - Simplification : proxy unique + Wake-on-LAN
### llm-proxy ✅