feat: add pluginized member context profiling

This commit is contained in:
liuwei
2026-04-02 11:49:20 +08:00
parent 848e7b5ab9
commit ce1708677f
11 changed files with 916 additions and 4 deletions

View File

@@ -43,6 +43,23 @@ class MessageStorageDB(BaseDBOperator):
params = (hours_ago, group_id, min_content_length)
return self.execute_query(sql, params) or []
def get_member_recent_messages(self, group_id: str, wxid: str, days: int = 30, limit: int = 200) -> List[Dict]:
"""获取指定群成员近期消息"""
sql = """
SELECT timestamp, sender, content, message_type
FROM messages
WHERE timestamp >= DATE_SUB(NOW(), INTERVAL %s DAY)
AND group_id = %s
AND sender = %s
AND message_type IN (1, 49)
AND CHAR_LENGTH(content) BETWEEN 2 AND 500
AND content NOT LIKE '/%%'
ORDER BY timestamp DESC
LIMIT %s
"""
results = self.execute_query(sql, (days, group_id, wxid, limit)) or []
return list(reversed(results))
def get_message_count_by_date(self, date: str) -> List[Dict]:
"""获取指定日期的消息统计"""
sql = """