zhangqian
2024-10-15 cbb634f9c133c726a00faf8199ba8954e18d4b05
app/api/agent.py
@@ -26,15 +26,8 @@
@router.get("/list", response_model=ResponseList)
async def agent_list(db: Session = Depends(get_db)):
    agents = db.query(AgentModel).all()
    result = [
        {
            "id": item.id,
            "name": item.name,
            "agent_type": item.agent_type
        }
        for item in agents
    ]
    agents = db.query(AgentModel).order_by(AgentModel.sort.asc()).all()
    result = [item.to_dict() for item in agents]
    return ResponseList(code=200, msg="", data=result)
@@ -64,4 +57,3 @@
    else:
        return ResponseList(code=200, msg="Unsupported agent type")