Commit Graph
100 Commits
Author SHA1 Message Date
SXP-Simon 8401283314 style(pre-commit) 2026-02-11 13:33:43 +08:00
SXP-Simon ec3f6b0b45 chore(gitignore) 2026-02-11 13:32:21 +08:00
SXP-Simon d8fc94ad09 [v4.7.3] feat(auto_scheduler): 增量分析问题修复 2026-02-11 13:30:41 +08:00
SXP-Simon 5969f9bad0 fix(_run_initialization): 确保无论是在“Bot 启动”还是“插件热重载”时任务都能准时挂载 2026-02-11 13:21:48 +08:00
SXP-Simon 448aaebdb4 fix: 增量分析话题解析名称 2026-02-11 13:09:51 +08:00
SXP-Simon ced38e6a9e fix: 修复了导致增量分析报告发送失败的几个核心问题:
修复报告分发器初始化错误:
在 AutoScheduler 中,初始化 ReportDispatcher 时漏传了 report_generator,导致在尝试生成报告(图片或文本)时出现 'NoneType' object has no attribute 'generate_image_report' 错误。
已更新 AutoScheduler 的构造函数并正确传递 report_generator。
修复 LLM 分析器在增量模式下的数据结构错误:UserTitleAnalyzer 报错:在增量模式下,用户活动数据被简化存储,导致 UserTitleAnalyzer 找不到 'hours' 键(Error: 'hours')。
补全数据维度:更新了 AnalysisApplicationService 的增量数据转换逻辑,保留了完整的每小时活跃分布 (hours) 和回复数 (reply_count)。
统一字段名:增量模式下使用了 nickname 字段以匹配分析器的预期(之前被错误转为了 name)。
增强容错性:优化了 UserTitleAnalyzer 的逻辑,现在它能安全地处理 hours 缺失或旧版本数据 schema,不再会因为找不到键而崩溃。
修复增量数据合并逻辑:
更新了 IncrementalMergeService,现在它能正确合并多个批次中的每小时发言统计和回复数统计,确保最终生成的报告数据准确。
2026-02-11 12:54:02 +08:00
SXP-Simon e292558965 fix(IncrementalMergeService): main_incremental_status handle error: unsupported operand type(s) for +: 'int' and 'dict' 2026-02-11 12:21:57 +08:00
SXP-Simon 43c42722ec fix: 白名单使用 UMO 无法分析 2026-02-11 00:40:39 +08:00
SXP-Simon fe8ba0c983 fix(extract_token_usage): 修复 token 计量 2026-02-10 23:29:57 +08:00
SXP-Simon 2cd97a73b7 fix(debug): 增加每次增量分析完成后发送的配置,用于调试 2026-02-10 23:16:07 +08:00
SXP-Simon d05205d815 [v4.7.2] feat(话题分析): 话题分析支持用户头像显示 2026-02-10 23:04:06 +08:00
SXP-Simon 9d4b925400 fix: 获取名称逻辑 2026-02-10 23:00:48 +08:00
SXP-Simon 6b231ddf78 fix: 删除 generators.py 中 generate_image_report 里冗余的本地文件读取逻辑 2026-02-10 22:53:51 +08:00
SXP-Simon 2e2dbfc81c fix: 正确显示话题分析头像 2026-02-10 22:43:45 +08:00
SXP-Simon 3154cf1e56 fix(DiscordAdapter): 修复 Base64 图片解码时缺少 import base64 的问题 2026-02-10 22:26:51 +08:00
SXP-Simon 23fcda8283 fix(ReportGenerator): 修正头像缓存路径至 data/plugin_data 以符合 AstrBot 标准 2026-02-10 22:19:47 +08:00
SXP-Simon 9c839ccce4 fix(ReportGenerator): 降低头像分辨率至 40px 以解决渲染器内存溢出(OOM)问题 2026-02-10 22:12:56 +08:00
SXP-Simon 53ea9e3970 fix(RetryManager): 修复重试逻辑中的 Base64 编码崩溃问题
- 增加了对 html_render 返回本地文件路径的处理 (读取为 bytes)
- 增加了对渲染结果的文件头校验,避免处理错误文本
2026-02-10 22:08:46 +08:00
SXP-Simon a449c18dfb fix(Discord&Generator): 修复 Discord 图片发送失败及渲染错误处理
- DiscordAdapter: 增加对 base64:// 协议的支持
- ReportGenerator: 增加图片文件头校验,防止将渲染器的错误文本(Internal Server Error)当作图片发送
2026-02-10 22:04:13 +08:00
SXP-Simon 69b404bb1f fix(ReportGenerator): 增加本地图片转 Base64 逻辑,彻底解决 Docker 环境下 OneBot 无法发送图片的问题 2026-02-10 21:58:39 +08:00
SXP-Simon 7b3d3beb6c fix(OneBot): 修复图片发送失败(rich media error)
- ReportGenerator: 改为返回 Base64 图片数据而非内部 URL,避免 OneBot 无法访问 Docker 内部服务
- OneBotAdapter: 增加对 base64:// 协议头的支持
2026-02-10 21:54:09 +08:00
SXP-Simon 5a81ffea20 refactor(话题分析): 采用 ID-Only Prompt 策略优化头像展示
- TopicAnalyzer: 仅向 LLM 发送 [ID] 而非昵称,减少 Token 并消除歧义
- _conf_schema.json: 更新默认 Prompt,强制要求 LLM 输出 ID 引用
- Logic: 后端负责将 ID 映射回昵称,实现精确的头像关联
2026-02-10 21:25:25 +08:00
SXP-Simon 472c78e622 feat(话题分析): 用户头像引用展示
- TopicAnalyzer: Prompt中包含 [user_id],引导LLM使用ID引用用户
- ReportGenerator: 解析话题详情中的 [uid] 并替换为内联头像HTML
- Templates: 更新所有主题的 topic_item.html 以支持富文本详情展示
- _conf_schema.json: 更新默认 Prompt,指导 LLM 使用 [用户ID] 引用用户
- ReportGenerator: 实现胶囊样式渲染 (头像+昵称),提升视觉体验
2026-02-10 20:57:51 +08:00
SXP-Simon c793858f59 fix(typo) 2026-02-10 20:16:04 +08:00
SXP-Simon 4e0b8fe24b fix(增量分析): 增量分析现已支持按配置开关控制话题/金句分析 2026-02-10 19:58:49 +08:00
SXP-Simon 1e7ecd57c3 fix(conf): 修复增量分析描述 2026-02-10 19:54:36 +08:00
SXP-Simon bf4cfac869 docs: 移除增量分析设计文档中的旧版兼容说明 2026-02-10 18:46:49 +08:00
SXP-Simon ae58ca58df docs: 更新 README 添加增量分析功能说明 2026-02-10 18:43:57 +08:00
SXP-Simon f1f804d2b9 refactor(增量分析): 移除未使用的兼容代码
- 移除 IncrementalStore.migrate_legacy_state (新功能尚未发布,无需迁移)
- 移除 entities/__init__.py 中的 AnalysisResult 别名
2026-02-10 18:25:23 +08:00
SXP-Simon 83b82de2bb refactor(增量分析): 从按天存储改为滑动窗口批次架构
- IncrementalBatch: 独立批次实体,每次增量分析产生一个,按批次独立存储到KV
- IncrementalState: 聚合视图,不再持久化,报告时由merge_batches合并产生
- IncrementalStore: 批次索引+数据KV持久化,支持按时间窗口查询和过期清理
- IncrementalMergeService: 新增merge_batches方法,负责批次合并和话题/金句去重
- AnalysisApplicationService: 增量分析存独立批次,最终报告按窗口查询合并
- AutoScheduler: 报告发送后清理2×窗口外的过期批次
- main.py: /增量状态命令改为滑动窗口查询展示
- 消除天然日期隔离问题,24h图表展示完整数据
2026-02-10 18:15:46 +08:00
SXP-Simon 9aa502f01a refactor(配置): 重构 _conf_schema.json 为 7 组嵌套结构,更新 ConfigManager 适配嵌套配置路径 2026-02-10 16:09:18 +08:00
SXP-Simon c8b0add071 feat(AutoScheduler): 增量分析,初步尝试全天数据覆盖的群分析报告 (#81) 2026-02-10 15:40:46 +08:00
SXP-Simon f8416bb1a8 fix(分析模块): 移除 __init__.py 中不存在的 UserAnalyzer 导入 2026-02-10 15:29:57 +08:00
SXP-Simon e86667e123 docs(增量分析): 添加增量分析功能设计文档 2026-02-10 15:22:55 +08:00
SXP-Simon 8d1cfb24e4 feat(增量分析): 接线增量组件到main.py并添加增量状态命令 2026-02-10 15:21:15 +08:00
SXP-Simon 757f3df092 feat(增量分析): 改造AutoScheduler支持增量调度与传统调度双模式 2026-02-10 15:19:27 +08:00
SXP-Simon bddaf4fef8 feat(增量分析): 扩展AnalysisApplicationService支持增量分析和最终报告生成 2026-02-10 15:06:40 +08:00
SXP-Simon e2a783f529 feat(增量分析): 添加增量LLM并发分析方法和分析器最大数量覆盖机制 2026-02-10 15:00:02 +08:00
SXP-Simon b72cb8510b feat(增量分析): 添加 IncrementalStore 持久化仓储和 IncrementalMergeService 合并服务 2026-02-10 14:54:36 +08:00
SXP-Simon 603fa4be07 feat(增量分析): 添加增量分析配置项
- ConfigManager 新增 11 个增量分析相关的 getter 方法
- _conf_schema.json 新增增量分析配置项定义,包含详细中文描述和提示
- 配置项包括:启用开关、分析间隔、每日上限、消息阈值、话题/金句数量、活跃时段、交错间隔
- 增量模式默认关闭,保持向后兼容
2026-02-10 14:49:25 +08:00
SXP-Simon 834012ab5b feat(增量分析): 创建 IncrementalState 领域实体
- 新增 IncrementalState 数据类,存储群聊一天内的增量分析累积状态
- 支持话题/金句去重合并、小时级统计、用户活跃度跟踪
- 包含 to_dict/from_dict 序列化方法,用于 KV 持久化
- 新增 BatchRecord 批次记录数据类
- 更新领域实体 __init__.py 导出
2026-02-10 14:48:09 +08:00
SXP-Simon 64d768c972 feat: 利用 AstrBot context 尝试实现 telegram 接入 2026-02-09 21:56:31 +08:00
SXP-Simon 6bc9025ff8 docs(多平台): 多平台接入指南 2026-02-09 21:00:14 +08:00
SXP-Simon f8412559ef fix: 分析器和消息处理 2026-02-09 14:15:43 +08:00
SXP-Simon e1ad6c9fc9 fix: 正确的导入各重构模块 2026-02-09 13:08:23 +08:00
SXP-Simon 2005f0633f refactor(DDD): 整理架构 2026-02-09 12:47:43 +08:00
SXP-Simon 0b096351d5 fix(docs): 完善注释 2026-02-09 02:14:43 +08:00
SXP-Simon 80d74577e7 fix(pre-commit): style 2026-02-09 01:39:13 +08:00
SXP-Simon d72833fa2c fix(typo): readme 2026-02-09 00:15:49 +08:00
SXP-Simon 50f601432f [v4.7.0] (dev) 多平台支持,目前是 Onebot 和 Discord 2026-02-08 23:57:36 +08:00
SXP-Simon 88093c4695 fix(AutoScheduler): 强制刷新一次 Bot 实例 2026-02-08 23:55:35 +08:00
SXP-Simon acdb5cc599 fix: Discord 客户端(懒加载) 2026-02-08 23:38:28 +08:00
SXP-Simon e73fd99e26 feat(logger) 2026-02-08 23:28:56 +08:00
SXP-Simon b8ea7adf5a feat: 使用 Adapter 进行规范抽象,优先使用 Adapter 接口,方便后期扩展 2026-02-08 23:18:08 +08:00
SXP-Simon bf09eab53d fix: 历史更新丢失的 max_concurrent_tasks 2026-02-08 22:28:36 +08:00
SXP-Simon efe1c10a24 fix: 删除弃用 bot_qq_id 逻辑,定时分析器兼容多平台 2026-02-08 22:23:05 +08:00
SXP-Simon c2701c4447 Docs: Detailed platform integration guide based on Discord implementation 2026-02-08 22:00:34 +08:00
SXP-Simon 8988afde55 Docs: Update platform integration guide content 2026-02-08 21:56:02 +08:00
SXP-Simon 25a6a261b5 Refactor: Cleanup commented out code in analysis_orchestrator.py 2026-02-08 21:54:34 +08:00
SXP-Simon ec29304069 Refactor: Translate comments and logs to Chinese in application layer 2026-02-08 21:53:49 +08:00
SXP-Simon b9a33926be Refactor: Translate English comments in domain layer to Chinese 2026-02-08 21:51:50 +08:00
SXP-Simon f0ab1e1401 Refactor: Final cleanup of English comments 2026-02-08 21:50:21 +08:00
SXP-Simon 64fdb17b52 Refactor: Translate comments and logs to Chinese in infrastructure layer 2026-02-08 21:49:48 +08:00
SXP-Simon c079c90a38 Refactor: Translate all remaining English comments to Chinese 2026-02-08 21:48:21 +08:00
SXP-Simon aca6937efc fix: 多平台,避免注释误解 2026-02-08 21:46:59 +08:00
SXP-Simon 7c67d1d797 Docs: Update platform integration guide with latest architecture and Chinese content 2026-02-08 21:46:20 +08:00
SXP-Simon d0ffc739b4 Refactor: Translate remaining English logs and comments to Chinese 2026-02-08 21:44:31 +08:00
SXP-Simon ba1bcfd80a Refactor: Translate comments and logs to Chinese in bot_manager.py and config.py 2026-02-08 21:43:27 +08:00
SXP-Simon 5f998b32df Refactor: Fix remaining bot_qq_ids in TopicAnalyzer 2026-02-08 21:42:34 +08:00
SXP-Simon fb481e3c4a Refactor: Decouple platform specific logic - Rename bot_qq_ids to bot_self_ids and generalize methods 2026-02-08 21:42:09 +08:00
SXP-Simon cbfb1cc844 fix(AnalysisConfig): 创建编排器时没有正确配置 max_messages 2026-02-08 21:33:53 +08:00
SXP-Simon 7ea84093da fix(typo) 2026-02-08 21:27:44 +08:00
SXP-Simon 185c5edcfb feat(debug): 调试模式,启用后,会在 plugin_data/debug_data 目录下保存每次分析的平台 API 原始历史消息和 Prompt 原文,用于调试和优化提示词 2026-02-08 21:25:20 +08:00
SXP-Simon bd096679b5 feat: discord 表情支持,和部分调试日志 2026-02-08 21:12:00 +08:00
SXP-Simon ee9c33debf fix: complete the refactoring of AutoScheduler to use the Domain-Driven Design (DDD) architecture.
Decoupling: AutoScheduler no longer depends on platform-specific APIs like call_action.
Abstraction: It now uses PlatformAdapterFactory to create an adapter for each bot instance and calls IGroupInfoRepository.get_group_list to fetch groups.
Maintainability: This change makes the scheduler platform-agnostic, allowing new platforms to be supported by simply adding a new PlatformAdapter without modifying the scheduler code.
2026-02-08 20:24:32 +08:00
SXP-Simon c3cc2fd1f4 fix: complete the migration of the group_list configuration to use AstrBot Unified Message Origins (UMOs).
Changes Implemented:
Configuration: group_list now supports UMOs (e.g., qq_123456:GroupMessage:123456) while maintaining backward compatibility for simple group IDs.
Logic: ConfigManager and AutoScheduler were updated to handle UMOs for permission checking and group fetching.
Commands: The /分析设置 command now uses the full UMO when enabling/disabling analysis for a group.
2026-02-08 20:19:07 +08:00
SXP-Simon e24449cac1 fix: 完成多平台逻辑解耦优化
配置模式 (_conf_schema.json):
将所有 "QQ号" 描述更名为通用的 "ID" 或 "用户ID"。
更新了 话题分析、用户称号分析、金句分析 的默认 Prompt 模板,将示例 JSON 中的 qq 字段改为 user_id。
保留 bot_qq_ids 配置项名称以维持向后兼容性,但其描述已更新。
数据模型 (data_models.py):
UserTitle 和 GoldenQuote 类中的 qq 字段重命名为 user_id (类型 str)。
为了兼容旧代码,添加了 qq 属性(@property),自动将 user_id 转为 int 返回。
分析逻辑 (analyzers/*.py):
TopicAnalyzer: 通用化了 @ 消息的处理,支持读取 qq、id 或 user_id 字段。
UserTitleAnalyzer & GoldenQuoteAnalyzer: 更新了 Prompt 构建和结果提取逻辑,优先使用 user_id,不再强制依赖 QQ 号格式。
ReportGenerator: 更新了报告生成逻辑,使用 user_id 获取头像。
结果: 插件现在更具通用性,配置和提示词不再默认绑定 QQ 平台术语,能更好地适应 Discord 等其他平台。容器已重启,新配置生效。
2026-02-08 20:09:56 +08:00
SXP-Simon 94fdc42abb fix: 报告生成器硬编码了 QQ 头像 API (qlogo.cn),导致 Discord 用户显示默认/错误的 QQ 头像。
修复:

修改 ReportGenerator,允许传入自定义的 avatar_getter 回调。
2026-02-08 20:02:46 +08:00
SXP-Simon f377b2cf87 fix: discord 内发送 image 格式的报告 2026-02-08 19:58:19 +08:00
SXP-Simon bdcd876663 fix: 手动触发,编排器首先尝试从 event 直接提取 bot 客户端 2026-02-08 19:54:30 +08:00
SXP-Simon 0e3778ff55 fix: _get_orchestrator 使用 platform_id (如 "lulouch") 来创建适配器,但应该使用 platform_name (如 "discord") 来确定适配器类型 2026-02-08 19:48:12 +08:00
SXP-Simon df28aa1076 fix: 修复 Discord 适配器客户端访问问题
问题:self.bot 是 DiscordPlatformAdapter 对象,没有 get_channel 方法。

修复:

添加 _get_discord_client() 辅助方法来正确获取 Discord 客户端(通过 DiscordPlatformAdapter.client)
将所有方法中的 self.bot.xxx 替换为 self._discord_client.xxx
2026-02-08 19:44:16 +08:00
SXP-Simon e780e3cbe9 fix: 修复平台ID提取
问题:_get_platform_id_from_event 方法使用了错误的属性访问方式,导致 platform_id=None。

修复:改为使用正确的 AstrMessageEvent API
2026-02-08 19:41:39 +08:00
SXP-Simon 6f7b20d962 fix: 正确注册命令 2026-02-08 19:39:50 +08:00
SXP-Simon 38f0cb26df fix: 修复 main.py 文件结构损坏,支持跨平台命令 2026-02-08 19:27:42 +08:00
SXP-Simon e9eda2571e fix: 导入必要模块 2026-02-08 19:09:58 +08:00
SXP-Simon d56f2e0dbc feat: 添加 raw_message 和 user_id 字段以增强消息兼容性 2026-02-08 19:05:00 +08:00
SXP-Simon 0d34a9df3a feat: 添加发送者字段填充,确保向后兼容旧分析器 2026-02-08 19:04:51 +08:00
SXP-Simon 46356d1c19 feat: 添加分析编排器和日志过滤器,优化群聊分析功能 2026-02-08 18:55:26 +08:00
SXP-Simon b4d50c2571 refactor: fully implement cross-platform support (UMO, adapter usage, OneBot compat format) 2026-02-08 18:38:26 +08:00
SXP-Simon 310860708d feat: 优化消息获取逻辑,支持通过适配器获取群聊消息并兼容旧逻辑 2026-02-08 18:36:15 +08:00
SXP-Simon ce640e61f4 fix: resolve AttributeError by using context.get_config() to access plugin_set (仅测试,后期需要纠正) 2026-02-08 18:27:25 +08:00
SXP-Simon 00060eb0d4 fix: remove platform check and support generic event for Discord compatibility 2026-02-08 18:08:43 +08:00
SXP-Simon 5a4418654e fix: robust metadata retrieval in BotManager to support Discord platform 2026-02-08 17:59:48 +08:00
SXP-Simon 7fc961df31 fix: use stacked decorators for command aliases to support Discord 2026-02-08 17:42:47 +08:00
SXP-Simon d24baa4261 feat: add English command aliases for Discord compatibility 2026-02-08 17:37:45 +08:00
SXP-Simon 5a8f41e081 feat: 优化 BotManager 中平台名称检测逻辑,增强对平台元数据的支持 2026-02-08 17:24:26 +08:00
SXP-Simon c8f98618e8 fix: 自动修复配置格式以支持旧版本字符串配置 2026-02-08 17:07:35 +08:00
SXP-Simon 25391380b5 feat: enhance BotManager to support lazy loading of platform adapters 2026-02-08 17:07:29 +08:00
SXP-Simon b8c1481ec1 fix: solve race condition in BotManager initialization for Discord 2026-02-08 16:55:28 +08:00