Feat: Frontend-Overhaul E — Lane-Editor, Routing-Policy (hot-reload) & Latenz-Karte

Teil 1: VoiceLatencyCard auf dem Dashboard (GET /api/voice/metrics, C2) —
zeigt STT/Vision/Chat-TTFB/TTS mit p50/p95/last + count.

Teil 2: UI-editierbare Routing-Policy. Neuer routing_policy.py (hot-reload JSON
unter MODELS_DIR/mc2-routing.json, Env=Defaults, atomarer Write, Validierung).
router_logic, gateway_proxy und gateway.routing_summary lesen jetzt live via
load_policy(); routing_summary ist lane-bewusst (chat/coding statt altem auto).
Neue Endpoints GET/PUT /api/routing/policy.

Teil 3: LaneEditor.tsx als ZONE im Cockpit (chat/coding-Aliase + Schwellen +
fast_no_think, Speichern/Default-je-Feld); Gateway-Node zeigt die Lanes.

Verifiziert: npm run build (tsc strict) clean, FastAPI TestClient (GET/PUT,
Validierung, Persistenz, Hot-reload durch die API), venv-Smoke (Routing).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Hitonabi
2026-06-29 18:58:17 +02:00
parent 3611defe5d
commit 9e432dbd2d
15 changed files with 876 additions and 367 deletions
+21 -5
View File
@@ -6,20 +6,36 @@ LiteLLM-Dienst nötig (baut auf Python 3.14 nicht); bleibt später austauschbar.
from config import PORT
from services.llamaswap import engine_reachable
from services.router_logic import FAST, HEAVY, HEAVY_CHARS
from services.routing_policy import load_policy
def routing_summary() -> dict:
p = load_policy()
coding_default = p["coder_lite"] or p["coder"]
return {
"mode": "builtin",
"endpoint": f":{PORT}/v1 (OpenAI-kompatibel)",
# Virtuelle Lanes, die Clients/IDEs als „Modell" wählen (Router pickt das echte Alias).
"lanes": [
{
"name": "chat",
"aka": "auto",
"target": f"{p['fast']}{p['heavy']} (nach Komplexität)",
"threshold_chars": p["heavy_chars"],
},
{
"name": "coding",
"target": f"{coding_default}{p['coder']} (Eskalation)",
"escalate_chars": p["coding_escalate_chars"],
},
],
# Rückwärtskompatible Flach-Liste (alte UI/Clients).
"routes": [
{"name": "auto", "target": f"{FAST}{HEAVY} (nach Komplexität)"},
{"name": FAST, "target": "llama-swap-Alias 'fast'"},
{"name": HEAVY, "target": "llama-swap-Alias 'heavy'"},
{"name": "chat", "target": f"{p['fast']}{p['heavy']} (nach Komplexität)"},
{"name": "coding", "target": f"{coding_default}{p['coder']} (Eskalation)"},
{"name": "<alias>", "target": "llama-swap-Passthrough (lädt bei Bedarf)"},
],
"heavy_threshold_chars": HEAVY_CHARS,
"heavy_threshold_chars": p["heavy_chars"],
"fallbacks": [],
"context_window_fallbacks": [],
}