From ae88193c5153aa04226a8307e1294a9c75d312bb Mon Sep 17 00:00:00 2001
From: zhaoqingang <zhaoqg0118@163.com>
Date: 星期三, 18 十二月 2024 18:30:03 +0800
Subject: [PATCH] add dialog sss
---
app/api/agent.py | 15 +++++++++------
1 files changed, 9 insertions(+), 6 deletions(-)
diff --git a/app/api/agent.py b/app/api/agent.py
index 98ee2cb..6270da4 100644
--- a/app/api/agent.py
+++ b/app/api/agent.py
@@ -35,25 +35,28 @@
limit: int = Query(1000, ge=1, le=1000),
db: Session = Depends(get_db),
current_user: UserModel = Depends(get_current_user)):
+ print(111)
agent = db.query(AgentModel).filter(AgentModel.id == agent_id).first()
if not agent:
return ResponseList(code=404, msg="Agent not found")
if agent.agent_type == AgentType.RAGFLOW:
+ print(222)
ragflow_service = RagflowService(base_url=settings.fwr_base_url)
try:
- token = get_ragflow_token(db, current_user.id)
+ token = await get_ragflow_token(db, current_user.id)
result = await ragflow_service.get_chat_sessions(token, agent_id)
if not result:
result = await get_session_history(db, current_user.id, agent_id)
except Exception as e:
+ print(e)
raise HTTPException(status_code=500, detail=str(e))
return ResponseList(code=200, msg="", data=result)
elif agent.agent_type == AgentType.BISHENG:
bisheng_service = BishengService(base_url=settings.sgb_base_url)
try:
- token = get_bisheng_token(db, current_user.id)
+ token = await get_bisheng_token(db, current_user.id)
result = await bisheng_service.get_chat_sessions(token, agent_id, page, limit)
except Exception as e:
raise HTTPException(status_code=500, detail=str(e))
@@ -84,7 +87,7 @@
if agent.agent_type == AgentType.RAGFLOW:
ragflow_service = RagflowService(base_url=settings.fwr_base_url)
try:
- token = get_ragflow_token(db, current_user.id)
+ token = await get_ragflow_token(db, current_user.id)
result = await ragflow_service.get_session_log(token, conversation_id)
if 'session_log' in result and 'reference' in result:
combined_logs = []
@@ -118,7 +121,7 @@
is_join = True
bisheng_service = BishengService(base_url=settings.sgb_base_url)
try:
- token = get_bisheng_token(db, current_user.id)
+ token = await get_bisheng_token(db, current_user.id)
result = await bisheng_service.get_session_log(token, agent_id, conversation_id)
combined_logs = []
last_question = None
@@ -143,14 +146,14 @@
elif 'report_name' in message_json:
message = message_json['report_name']
- except json.JSONDecodeError:
+ except Exception as e:
pass # 闈� JSON 瀛楃涓诧紝缁х画浣跨敤鍘熷 message
if session.get('files') and isinstance(session.get('files'), str):
try:
files = json.loads(session.get('files'))
process_files(files, agent_id)
- except json.JSONDecodeError:
+ except Exception as e:
pass # 闈� JSON 瀛楃涓诧紝缁х画浣跨敤鍘熷 message
# 妫�鏌� message 鏄惁涓� None
--
Gitblit v1.8.0