mirror of
https://github.com/xinnan-tech/xiaozhi-esp32-server.git
synced 2026-11-27 04:49:47 +01:00
update: 修复Dify对接未过滤全量数据问题
This commit is contained in:
parent
c76f28824c
commit
6284a74a6e
1 changed files with 4 additions and 2 deletions
|
|
@ -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:
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue