fix: 性能优化,CPU 密集型计算(统计和分析)已卸载到各线程池,避免阻塞事件循环

feat: 存储路径规范化:PDF 报告现在存储在 data/plugin_data/astrbot_plugin_qq_group_daily_analysis/reports
This commit is contained in:
SXP-Simon
2026-01-07 00:28:35 +08:00
committed by Helian Nuits
parent 4297bf4f99
commit 9a09e56f13
2 changed files with 19 additions and 5 deletions
+7 -2
View File
@@ -3,6 +3,7 @@
包含消息分析和其他通用功能
"""
import asyncio
from astrbot.api import logger
from ...src.analysis.llm_analyzer import LLMAnalyzer
@@ -49,10 +50,14 @@ class MessageAnalyzer:
"""完整的消息分析流程"""
try:
# 基础统计
statistics = self.message_handler.calculate_statistics(messages)
statistics = await asyncio.to_thread(
self.message_handler.calculate_statistics, messages
)
# 用户分析
user_analysis = self.user_analyzer.analyze_users(messages)
user_analysis = await asyncio.to_thread(
self.user_analyzer.analyze_users, messages
)
# 获取活跃用户列表 - 使用get_top_users方法,limit从配置中读取
max_user_titles = self.config_manager.get_max_user_titles()