Feinschliff Phase 2: Dashboard Redesign, RAM Check, Accordions

This commit is contained in:
Hitonabi
2026-06-20 22:30:40 +02:00
parent e3be7fbfb5
commit 8b76adc96e
10 changed files with 358 additions and 119 deletions
+25
View File
@@ -43,6 +43,11 @@ class ChatReq(BaseModel):
message: str
class UpdateReq(BaseModel):
alias: str
ctx: int
# ---------------------------------------------------------------------------
# Endpoints
# ---------------------------------------------------------------------------
@@ -144,6 +149,26 @@ def register(req: RegisterReq):
"note": "In config.yaml geschrieben. llama-swap mit -watch-config laedt automatisch neu."}
@router.post("/update_model")
def update_model(req: UpdateReq):
cfg = read_config()
if req.alias not in cfg.get("models", {}):
raise HTTPException(404, "Modell nicht gefunden")
spec = cfg["models"][req.alias]
cmd = str(spec.get("cmd", ""))
# Replace or add context size
if re.search(r'-(?:c|-ctx-size)\s+\d+', cmd):
cmd = re.sub(r'-(?:c|-ctx-size)\s+\d+', f'-c {req.ctx}', cmd)
else:
cmd = cmd.strip() + f" -c {req.ctx}\n"
cfg["models"][req.alias]["cmd"] = LiteralScalarString(cmd)
write_config(cfg)
return {"ok": True}
@router.post("/unload")
def unload(model: str | None = None):
path = f"/api/models/unload/{model}" if model else "/api/models/unload"