cff3f0b1a8
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>
29 lines
869 B
Python
29 lines
869 B
Python
"""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}
|