From 1ab90de913405b45050e0f732a03004087134fda Mon Sep 17 00:00:00 2001
From: zhaoqingang <zhaoqg0118@163.com>
Date: 星期一, 25 十一月 2024 11:11:04 +0800
Subject: [PATCH] 上传dify文件
---
app/api/chat.py | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/app/api/chat.py b/app/api/chat.py
index 4359eab..483a69a 100644
--- a/app/api/chat.py
+++ b/app/api/chat.py
@@ -314,7 +314,7 @@
except Exception as e:
logger.error(e)
complete_response = ""
- async for rag_response in dify_service.chat(token, chat_id, question, upload_file_id, conversation_id):
+ async for rag_response in dify_service.chat(token, current_user.id, question, upload_file_id, conversation_id):
try:
if rag_response[:5] == "data:":
# 濡傛灉鏄紝鍒欐埅鍙栨帀鍓�5涓瓧绗︼紝骞跺幓闄ら灏剧┖鐧界
@@ -326,7 +326,7 @@
try:
data = json.loads(complete_response)
# data = json_data.get("data")
- if "answer" not in data: # 淇℃伅杩囨护
+ if "answer" not in data or not isinstance(data["answer"], dict): # 淇℃伅杩囨护
continue
else: # 姝e父杈撳嚭
answer = data.get("answer", "")
--
Gitblit v1.8.0