diff --git a/src/core/config.py b/src/core/config.py index 32955cb..e1398f2 100644 --- a/src/core/config.py +++ b/src/core/config.py @@ -6,6 +6,7 @@ import sys from astrbot.api import AstrBotConfig, logger +from astrbot.core.utils.astrbot_path import get_astrbot_data_path class ConfigManager: @@ -139,9 +140,17 @@ class ConfigManager: def get_pdf_output_dir(self) -> str: """获取PDF输出目录""" - return self.config.get( - "pdf_output_dir", "data/plugins/astrbot-qq-group-daily-analysis/reports" - ) + try: + plugin_name = "astrbot_plugin_qq_group_daily_analysis" + data_path = get_astrbot_data_path() + default_path = data_path / "plugin_data" / plugin_name / "reports" + return self.config.get("pdf_output_dir", str(default_path)) + except Exception: + # Fallback for older versions or import errors + return self.config.get( + "pdf_output_dir", + "data/plugins/astrbot_plugin_qq_group_daily_analysis/reports", + ) def get_bot_qq_ids(self) -> list: """获取bot QQ号列表""" diff --git a/src/utils/helpers.py b/src/utils/helpers.py index e0fb3f0..1c175b4 100644 --- a/src/utils/helpers.py +++ b/src/utils/helpers.py @@ -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()