zhangqian
2024-10-16 fb37a87e565fe998becb322ff9d344d3b7aa8e14
app/api/agent.py
@@ -1,3 +1,5 @@
import uuid
from fastapi import Depends, APIRouter, Query, HTTPException
from pydantic import BaseModel
from sqlalchemy.orm import Session
@@ -57,3 +59,12 @@
    else:
        return ResponseList(code=200, msg="Unsupported agent type")
@router.get("/get-chat-id/{agent_id}", response_model=Response)
async def agent_list(agent_id: str, db: Session = Depends(get_db)):
    agent = db.query(AgentModel).filter(AgentModel.id == agent_id).first()
    if not agent:
        return Response(code=404, msg="Agent not found")
    return Response(code=200, msg="", data={"chat_id": uuid.uuid4().hex})