From 9600159f8c4f9062ec439e848a8f1b302399bd2d Mon Sep 17 00:00:00 2001
From: zhaoqingang <zhaoqg0118@163.com>
Date: 星期二, 03 十二月 2024 14:01:33 +0800
Subject: [PATCH] 历史会话异常问题

---
 app/api/chat.py  |    2 +-
 app/api/agent.py |    4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/app/api/agent.py b/app/api/agent.py
index 98ee2cb..22ce8ef 100644
--- a/app/api/agent.py
+++ b/app/api/agent.py
@@ -143,14 +143,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
diff --git a/app/api/chat.py b/app/api/chat.py
index 468f617..2cfbf20 100644
--- a/app/api/chat.py
+++ b/app/api/chat.py
@@ -484,7 +484,7 @@
                                             else:
                                                 message = answer.get("error", "")
 
-                                            result = {"message": message, "type": "close", "download_url": download_url}
+                                            result = {"message": message, "type": "message", "download_url": download_url}
                                             try:
                                                 SessionService(db).update_session(chat_id,
                                                                                   message={"role": "assistant",

--
Gitblit v1.8.0