feat(2.0): Phase 1 — Engine + Routing (Herzstueck)

Backend-Services: fit/caps/sources (portiert), discover (live HF + Fit +
Caps + ranked recommendation), llama-swap write/register + groups (Ko-
Residenz swap:false), LiteLLM-Gateway-Config + gateway-Service (model:auto +
Fallbacks). Router: discover/fit/register/groups/routing; health zeigt
gateway_reachable. Frontend: Modelle&Routing mit Caps-Chips, Fit-Badges,
Discover-Tab (live), Routing-View.

Lokal verifiziert: Backend-Smoke (alle Endpunkte) + Frontend-Build +
Browser (Shell, Discover, Caps/Fit). Box-Verifikation offen.

Docs: README + docs/STATUS.md (Phasen-Tracker + Resume-Guide).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Hitonabi
2026-06-25 08:01:12 +02:00
parent 1b421e30f9
commit cff3f0b1a8
25 changed files with 1253 additions and 235 deletions
+28
View File
@@ -0,0 +1,28 @@
"""Routing-Endpoints: Gateway-Übersicht (welcher Alias = fast/heavy/…) + Mapping setzen."""
from fastapi import APIRouter, HTTPException
from pydantic import BaseModel
from services import gateway
router = APIRouter(prefix="/api")
@router.get("/routing")
def routing() -> dict:
return {**gateway.routing_summary(), "gateway_reachable": gateway.gateway_reachable()}
class RouteReq(BaseModel):
name: str # Gateway-Modellname, z.B. "fast" / "heavy" / "vision" / "coder"
target_alias: str # llama-swap-Alias, der bedient wird
api_base: str = "http://127.0.0.1:8080/v1"
@router.put("/routing/route")
def set_route(req: RouteReq) -> dict:
try:
gateway.set_route(req.name, req.target_alias, api_base=req.api_base)
except Exception as exc: # noqa: BLE001
raise HTTPException(500, str(exc))
return {"ok": True}