From 5bc6dd6c7516e7914e1aac45543e52cde62b0796 Mon Sep 17 00:00:00 2001 From: zhaoqingang <zhaoqg0118@163.com> Date: 星期五, 22 十一月 2024 11:29:07 +0800 Subject: [PATCH] 下载word --- app/api/agent.py | 7 +++++-- 1 files changed, 5 insertions(+), 2 deletions(-) diff --git a/app/api/agent.py b/app/api/agent.py index 4e410d4..fe6e6c0 100644 --- a/app/api/agent.py +++ b/app/api/agent.py @@ -60,7 +60,7 @@ elif agent.agent_type == AgentType.BASIC: offset = (page - 1) * limit - records = db.query(SessionModel).filter(SessionModel.agent_id == agent_id).offset(offset).limit(limit).all() + records = db.query(SessionModel).filter(SessionModel.agent_id == agent_id, SessionModel.tenant_id==current_user.id).offset(offset).limit(limit).all() result = [item.to_dict() for item in records] return ResponseList(code=200, msg="", data=result) @@ -105,7 +105,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)) - if agent.agent_type == AgentType.BISHENG: + elif agent.agent_type == AgentType.BISHENG: bisheng_service = BishengService(base_url=settings.sgb_base_url) try: token = get_bisheng_token(db, current_user.id) @@ -139,6 +139,9 @@ return JSONResponse(status_code=200, content={"code": 200, "data": combined_logs}) except Exception as e: raise HTTPException(status_code=500, detail=str(e)) + elif agent.agent_type == AgentType.BASIC: + session = db.query(SessionModel).filter(SessionModel.id == conversation_id).first() + return JSONResponse(status_code=200, content={"code": 200, "data": session.log_to_json() if session else {}}) else: return JSONResponse(status_code=200, content={"code": 200, "log": "Unsupported agent type"}) -- Gitblit v1.8.0