记录只采集用户最近的发言。不采集助手的发言。
This commit is contained in:
@@ -264,6 +264,7 @@ class DifyPlugin(MessagePluginInterface):
|
|||||||
# 将历史记录转换为字符串格式
|
# 将历史记录转换为字符串格式
|
||||||
for msg in self.conversations[session_id]:
|
for msg in self.conversations[session_id]:
|
||||||
role = "用户" if msg["role"] == "user" else "助手"
|
role = "用户" if msg["role"] == "user" else "助手"
|
||||||
|
if role == "用户":
|
||||||
history_text += f"{role}: {msg['content']}\n"
|
history_text += f"{role}: {msg['content']}\n"
|
||||||
history_text = history_text.strip()
|
history_text = history_text.strip()
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user