feat(2.0): DELETE /api/models/{id} (Eintrag + Gruppen-Mitgliedschaft entfernen)

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Hitonabi
2026-06-25 12:41:58 +02:00
parent fc0153d0de
commit db1f62227b
2 changed files with 21 additions and 0 deletions
+14
View File
@@ -186,3 +186,17 @@ def set_group(group: str, members: list[str], swap: bool = False, persist: bool
def list_groups() -> dict:
return read_config().get("groups") or {}
def delete_model(model_id: str) -> bool:
"""Entfernt einen Modell-Eintrag aus der config.yaml (und aus allen Gruppen)."""
cfg = read_config()
models = cfg.get("models") or {}
if model_id not in models:
return False
del models[model_id]
for g in (cfg.get("groups") or {}).values():
if isinstance(g, dict) and model_id in (g.get("members") or []):
g["members"] = [m for m in g["members"] if m != model_id]
write_config(cfg)
return True