zhaoqingang 1 жил өмнө
parent
commit
9600159f8c
2 өөрчлөгдсөн 3 нэмэгдсэн , 3 устгасан
  1. 2 2
      app/api/agent.py
  2. 1 1
      app/api/chat.py

+ 2 - 2
app/api/agent.py

@@ -143,14 +143,14 @@ async def session_log(agent_id: str, conversation_id: str, db: Session = Depends
                         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

+ 1 - 1
app/api/chat.py

@@ -484,7 +484,7 @@ async def handle_client(websocket: WebSocket,
                                             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",