6758bbfbd9
- agent.set_agent_brain(model_id): vergibt 'hermes'-Alias, tauscht das Modell in die residente brains-Gruppe (altes Hirn raus, fast/vision bleiben) und zeigt die Hermes-Config darauf (+ Gateway-Restart). Behebt: AgentView-Switch hielt das neue Hirn nicht warm. - POST /api/agent/brain/set. - Cockpit Agent-Hirn-Karte: Button "Hirn wechseln" + Modal mit allen installierten Modellen (Groesse/Params/Rolle/Tools), aktuelles markiert; Hinweis zugunsten Hermes (Tool-Calling). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
45 lines
1.1 KiB
Python
45 lines
1.1 KiB
Python
"""Agent-Endpoint: Hermes-Status + WebUI-Link (MC verlinkt nur, betreibt nicht)."""
|
|
|
|
from fastapi import APIRouter
|
|
from pydantic import BaseModel
|
|
|
|
from fastapi import HTTPException
|
|
|
|
from services.agent import agent_status, hermes_brain_info, set_agent_brain, update_brain_model
|
|
|
|
router = APIRouter(prefix="/api")
|
|
|
|
|
|
class BrainReq(BaseModel):
|
|
model: str
|
|
|
|
|
|
class SetBrainReq(BaseModel):
|
|
model_id: str
|
|
|
|
|
|
@router.get("/agent/status")
|
|
def status() -> dict:
|
|
return agent_status()
|
|
|
|
|
|
@router.get("/agent/brain")
|
|
def brain_info() -> dict:
|
|
"""Aktuelles Agent-Hirn (hermes) + bestes NousResearch-Hermes-Update."""
|
|
return hermes_brain_info()
|
|
|
|
|
|
@router.post("/agent/brain/set")
|
|
def set_brain(body: SetBrainReq) -> dict:
|
|
"""Setzt ein installiertes Modell als Agent-Hirn (Alias + warm-Gruppe + Config)."""
|
|
res = set_agent_brain(body.model_id)
|
|
if not res.get("ok"):
|
|
raise HTTPException(400, res.get("reason", "Fehler beim Setzen des Agent-Hirns"))
|
|
return res
|
|
|
|
|
|
@router.post("/agent/brain")
|
|
def set_brain_model(body: BrainReq) -> dict:
|
|
ok = update_brain_model(body.model)
|
|
return {"ok": ok}
|