From 8b76adc96e05acd43ae2e10fe38875d2ee810177 Mon Sep 17 00:00:00 2001 From: Hitonabi Date: Sat, 20 Jun 2026 22:30:40 +0200 Subject: [PATCH] Feinschliff Phase 2: Dashboard Redesign, RAM Check, Accordions --- routers/models.py | 25 +++++++++ static/css/components.css | 17 +++++++ static/index.html | 30 ++++++++--- static/js/core/ui.js | 1 + static/js/main.js | 27 +++++++--- static/js/panels/cookbook.js | 86 ++++++++++++++++++++++++------- static/js/panels/guides.js | 99 ++++++++++++++++++++++-------------- static/js/panels/models.js | 79 +++++++++++++++++++++++----- static/js/panels/overview.js | 99 +++++++++++++++++++++++++++--------- static/js/panels/server.js | 14 +++-- 10 files changed, 358 insertions(+), 119 deletions(-) diff --git a/routers/models.py b/routers/models.py index 990485d..58b46dc 100644 --- a/routers/models.py +++ b/routers/models.py @@ -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" diff --git a/static/css/components.css b/static/css/components.css index f40bd60..a300dfc 100644 --- a/static/css/components.css +++ b/static/css/components.css @@ -140,3 +140,20 @@ button:disabled{opacity:.5;cursor:not-allowed} opacity:0;transition:.25s;pointer-events:none;max-width:90vw;z-index:50} .toast.show{opacity:1} .toast.err{border-color:var(--err);color:#ffb4ae} + +/* ---- Accordion (Guides) ---- */ +.guide-acc { border-bottom: 1px solid var(--line); } +.guide-acc:last-child { border-bottom: none; } +.guide-acc summary { + padding: 16px 20px; + font-weight: 600; + cursor: pointer; + list-style: none; + display: flex; + justify-content: space-between; + align-items: center; +} +.guide-acc summary::-webkit-details-marker { display: none; } +.guide-acc summary::after { content: "▼"; font-size: 10px; color: var(--mut); transition: transform 0.2s; } +.guide-acc[open] summary::after { transform: rotate(180deg); } +.guide-acc .acc-body { padding: 0 20px 20px 20px; } diff --git a/static/index.html b/static/index.html index c453ea4..a4b3fe0 100644 --- a/static/index.html +++ b/static/index.html @@ -22,7 +22,7 @@
- +
@@ -31,11 +31,7 @@
verbinde… - Aktiv: - Modelle - Jobs0 - --:-- - + Kein Modell geladen
@@ -46,7 +42,13 @@
-
+ +
+ +
+
+
+