传入群信息,用于记录群的总结次数
This commit is contained in:
@@ -8,7 +8,7 @@ from message_summary.compress_chat_data import compress_chat_data
|
||||
from message_summary.markdown_to_image import convert_md_str_to_image
|
||||
|
||||
|
||||
def message_summary_dify(content):
|
||||
def message_summary_dify(content, sender: str = None):
|
||||
"""
|
||||
使用Dify API生成群聊消息总结
|
||||
|
||||
@@ -27,13 +27,14 @@ def message_summary_dify(content):
|
||||
print(f"压缩内容成功:{len(content_compress)}--{len(content)}")
|
||||
except Exception as e:
|
||||
print(f"压缩内容失败:{e}")
|
||||
|
||||
# 准备请求数据
|
||||
data = {
|
||||
"inputs": {},
|
||||
"query": f"请根据以下群聊记录生成一份精华总结:\n\n{content_compress}",
|
||||
"response_mode": "blocking", # 使用阻塞模式,直接获取完整响应
|
||||
"conversation_id": "",
|
||||
"user": "message_summary_bot",
|
||||
"user": sender if sender is not None else "message_summary_bot",
|
||||
"files": [] # 不包含文件
|
||||
}
|
||||
|
||||
@@ -473,5 +474,5 @@ if __name__ == '__main__':
|
||||
2025-03-14 14:30:12,Jyunere,[捂脸]
|
||||
2025-03-14 14:30:15,Jyunere,别这样啊。
|
||||
"""
|
||||
msg = compress_chat_data(content,5)
|
||||
msg = compress_chat_data(content, 5)
|
||||
print(f"{msg}\n {len(msg)},{len(content)}")
|
||||
|
||||
2
robot.py
2
robot.py
@@ -640,7 +640,7 @@ class Robot(Job):
|
||||
if self.gbm.get_group_permission(sender, Feature.SUMMARY_CAPABILITY) == PermissionStatus.ENABLED:
|
||||
self.LOG.info(f"群: {sender} 消息总结开始执行!")
|
||||
content = self.message_storage.get_messages(sender, self.allContacts)
|
||||
summary, spath = message_summary_dify(content)
|
||||
summary, spath = message_summary_dify(content, self.allContacts.get(sender, sender))
|
||||
# self.send_text_msg(summary, sender)
|
||||
self.wcf.send_file(spath, sender)
|
||||
else:
|
||||
|
||||
Reference in New Issue
Block a user