Merge remote-tracking branch 'origin/master'

This commit is contained in:
liuwei
2025-02-17 08:53:59 +08:00
2 changed files with 4 additions and 5 deletions

View File

@@ -49,16 +49,15 @@ def get_messages(group_id, all_contacts: dict):
# 生成Redis key
key = f"{group_id}:summary_time"
last_summary_time = r.get(key)
current_time = datetime.now()
current_date = current_time.strftime('%Y-%m-%d %H:%M:%S')
if last_summary_time is None:
# 获取当前时间并计算8小时前的时间
current_time = datetime.now()
eight_hours_ago = current_time - timedelta(hours=8)
# 转换为数据库中存储的时间格式 (假设timestamp是DATETIME类型)
last_summary_time = eight_hours_ago.strftime('%Y-%m-%d %H:%M:%S')
current_date = current_time.strftime('%Y-%m-%d %H:%M:%S')
r.set(key, current_date)
r.set(key, current_date)
with connection.cursor() as cursor:
# 执行查询获取最近8小时的消息

View File

@@ -19,7 +19,7 @@ def message_summary(content):
authorization = "46a5674a-e978-491b-a810-5d54605f2c36" # 请替换为真实的Authorization token
url = 'http://127.0.0.1:8080/v1/chat/completions'
prompt = ('你是一个聊天记录总结助手,请使用如下格式进行聊天记录整理:'
prompt = ('你是一个聊天记录总结助手,请使用如下格式进行聊天记录整理(如果存在多个主题则每个主题分开显示相关的参与者时间点,内容摘要)'
'[聊天主题] ☆☆☆'
'参与者:[列出参与者名字]'
'时间点:[开始时间] - [结束时间]'