传入群信息,用于记录群的总结次数
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)}")
|
||||
|
||||
Reference in New Issue
Block a user