fix: only suggest model upgrades for active roles on dashboard
This commit is contained in:
@@ -57,15 +57,24 @@ def _engine_update_available() -> bool:
|
|||||||
|
|
||||||
|
|
||||||
def model_upgrades() -> list[dict]:
|
def model_upgrades() -> list[dict]:
|
||||||
"""Dynamisch: je discover-Kategorie das empfohlene Modell, das NOCH NICHT installiert ist
|
"""Dynamisch: je discover-Kategorie das empfohlene Modell, das NOCH NICHT installiert ist,
|
||||||
|
aber NUR wenn für diese Rolle bereits irgendein Modell konfiguriert ist.
|
||||||
→ Upgrade-Vorschlag für diese Rolle. Self-updating (kein Hardcode wie v1)."""
|
→ Upgrade-Vorschlag für diese Rolle. Self-updating (kein Hardcode wie v1)."""
|
||||||
disc = discover.safe_discover(_ram_gb())
|
disc = discover.safe_discover(_ram_gb())
|
||||||
if not disc:
|
if not disc:
|
||||||
return []
|
return []
|
||||||
|
|
||||||
|
installed = llamaswap.list_models()
|
||||||
|
active_roles = {m["role"] for m in installed if m.get("role")}
|
||||||
|
|
||||||
cmds = " ".join(str(s.get("cmd", "")).lower()
|
cmds = " ".join(str(s.get("cmd", "")).lower()
|
||||||
for s in (llamaswap.read_config().get("models") or {}).values())
|
for s in (llamaswap.read_config().get("models") or {}).values())
|
||||||
out = []
|
out = []
|
||||||
for c in disc.get("categories", []):
|
for c in disc.get("categories", []):
|
||||||
|
role = c["role"]
|
||||||
|
if role not in active_roles:
|
||||||
|
continue
|
||||||
|
|
||||||
rec = c.get("recommended")
|
rec = c.get("recommended")
|
||||||
if not rec:
|
if not rec:
|
||||||
continue
|
continue
|
||||||
@@ -73,7 +82,7 @@ def model_upgrades() -> list[dict]:
|
|||||||
stem = base[:-5] if base.endswith("-gguf") else base
|
stem = base[:-5] if base.endswith("-gguf") else base
|
||||||
if base in cmds or (stem and stem in cmds):
|
if base in cmds or (stem and stem in cmds):
|
||||||
continue
|
continue
|
||||||
out.append({"role": c["role"], "title": c["title"], "repo": rec})
|
out.append({"role": role, "title": c["title"], "repo": rec})
|
||||||
return out
|
return out
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user