mirror of
https://github.com/xinnan-tech/xiaozhi-esp32-server.git
synced 2026-07-27 17:43:55 +08:00
update: 修复Dify对接未过滤全量数据问题
This commit is contained in:
@@ -58,7 +58,8 @@ class LLMProvider(LLMProviderBase):
|
|||||||
self.session_conversation_map[session_id] = (
|
self.session_conversation_map[session_id] = (
|
||||||
conversation_id # 更新映射
|
conversation_id # 更新映射
|
||||||
)
|
)
|
||||||
if event.get("answer"):
|
# 过滤 message_replace 事件,此事件会全量推一次
|
||||||
|
if event.get("event") != "message_replace" and event.get("answer"):
|
||||||
yield event["answer"]
|
yield event["answer"]
|
||||||
elif self.mode == "workflows/run":
|
elif self.mode == "workflows/run":
|
||||||
for line in r.iter_lines():
|
for line in r.iter_lines():
|
||||||
@@ -73,7 +74,8 @@ class LLMProvider(LLMProviderBase):
|
|||||||
for line in r.iter_lines():
|
for line in r.iter_lines():
|
||||||
if line.startswith(b"data: "):
|
if line.startswith(b"data: "):
|
||||||
event = json.loads(line[6:])
|
event = json.loads(line[6:])
|
||||||
if event.get("answer"):
|
# 过滤 message_replace 事件,此事件会全量推一次
|
||||||
|
if event.get("event") != "message_replace" and event.get("answer"):
|
||||||
yield event["answer"]
|
yield event["answer"]
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
|||||||
Reference in New Issue
Block a user