From 9be4808a8d7038e9af6de826f573c66ca38194db Mon Sep 17 00:00:00 2001 From: xuyonghao <898441624@qq.com> Date: 星期三, 22 一月 2025 11:31:16 +0800 Subject: [PATCH] 报表合并webSocket信息格式修改 --- app/api/agent.py | 16 ++++++++++------ 1 files changed, 10 insertions(+), 6 deletions(-) diff --git a/app/api/agent.py b/app/api/agent.py index fb1ad87..0fb5f10 100644 --- a/app/api/agent.py +++ b/app/api/agent.py @@ -81,11 +81,15 @@ @router.get("/{agent_id}/{conversation_id}/session_log") async def session_log(agent_id: str, conversation_id: str, db: Session = Depends(get_db), current_user: UserModel = Depends(get_current_user)): - agent = db.query(AgentModel).filter(AgentModel.id == agent_id).first() + # agent = db.query(AgentModel).filter(AgentModel.id == agent_id).first() + # if not agent: + # return Response(code=404, msg="Agent not found") + agent = db.query(MenuCapacityModel).filter(MenuCapacityModel.chat_id == agent_id).first() if not agent: - return Response(code=404, msg="Agent not found") + return ResponseList(code=404, msg="Agent not found") + agent_type = int(agent.capacity_type) - if agent.agent_type == AgentType.RAGFLOW: + if agent_type == AgentType.RAGFLOW: ragflow_service = RagflowService(base_url=settings.fwr_base_url) try: token = await get_ragflow_token(db, current_user.id) @@ -116,7 +120,7 @@ return JSONResponse(status_code=200, content={"code": 400, "message": "Invalid result structure"}) except Exception as e: raise HTTPException(status_code=500, detail=str(e)) - elif agent.agent_type == AgentType.BISHENG: + elif agent_type == AgentType.BISHENG: is_join = False if agent.name == "鎶ュ憡鐢熸垚": is_join = True @@ -180,7 +184,7 @@ 'answer': answer_str, 'files': files}]}) except Exception as e: raise HTTPException(status_code=500, detail=str(e)) - elif agent.agent_type == AgentType.BASIC: + elif agent_type == AgentType.BASIC: data = [] session = db.query(SessionModel).filter(SessionModel.id == conversation_id).first() if session: @@ -219,7 +223,7 @@ data.append(tmp_data) return JSONResponse(status_code=200, content={"code": 200, "data": data}) - elif agent.agent_type == AgentType.DIFY: + elif agent_type == AgentType.DIFY: data = [] session = db.query(SessionModel).filter(SessionModel.id == conversation_id).first() if session: -- Gitblit v1.8.0