From abb91124a4372b0efe5ab1b7aa25859c635d30eb Mon Sep 17 00:00:00 2001
From: zhaoqingang <zhaoqg0118@163.com>
Date: 星期四, 10 四月 2025 13:49:37 +0800
Subject: [PATCH] merge

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

diff --git a/app/api/chat.py b/app/api/chat.py
index 241815a..d4b6dae 100644
--- a/app/api/chat.py
+++ b/app/api/chat.py
@@ -71,11 +71,12 @@
                     chat_history = message.get('chatHistory', [])
                     message["role"] = "user"
                     if len(chat_history) == 0:
+                        print("----------------------", token)
                         chat_history = await ragflow_service.get_session_history(token, chat_id)
                         if len(chat_history) == 0:
                             chat_history = await ragflow_service.set_session(token, agent_id,
                                                                              message, chat_id, True)
-                            # print("chat_history------------------------", chat_history)
+                            print("chat_history------------------------", chat_history)
                             if len(chat_history) == 0:
                                 result = {"message": "鍐呴儴閿欒锛氬垱寤轰細璇濆け璐�", "type": "close"}
                                 await websocket.send_json(result)
@@ -325,7 +326,7 @@
         # token = get_dify_token(db, current_user.id)
         try:
             async def forward_to_dify():
-                if agent.type == "imageTalk":
+                if chat_type == "imageTalk":
                     token = DfTokenDao(db).get_token_by_id(IMAGE_TO_TEXT)
                     if not token:
                         await websocket.send_json({"message": "Invalid token", "type": "error"})
@@ -431,7 +432,7 @@
                                 result = {"message": f"鍐呴儴閿欒锛� {e2}", "type": "close"}
                                 await websocket.send_json(result)
                                 print(f"Error process message of ragflow: {e2}")
-                elif agent.type == "reportWorkflow":
+                elif chat_type == "reportWorkflow":
 
                     while True:
                         receive_message = await websocket.receive_json()

--
Gitblit v1.8.0