Commit Graph
185 Commits
Author SHA1 Message Date
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 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 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 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 6f7b20d962 fix: 正确注册命令 2026-02-08 19:39:50 +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 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 5a4418654e fix: robust metadata retrieval in BotManager to support Discord platform 2026-02-08 17:59:48 +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
SXP-Simon 4a5f9ff4fb feat: implement DiscordAdapter with py-cord integration 2026-02-08 16:47:01 +08:00
SXP-Simon 8e09a9e1cf feat: add DiscordAdapter skeleton and register in factory 2026-02-08 16:23:57 +08:00
SXP-Simon e0d81ec5c5 feat: add convert_to_raw_format to PlatformAdapter and update OneBotAdapter 2026-02-08 16:23:41 +08:00
SXP-Simon e8833be891 refactor: translate comments to Chinese and fix hardcoded OneBot format 2026-02-08 16:23:32 +08:00
SXP-Simon 39cc318d9b feat: 完善 DDD 架构 - 添加领域分析器服务适配层
- 添加 src/__init__.py 作为源码包入口
- 添加 domain/services 分析器适配层:
  - topic_analyzer.py: 话题分析领域服务
  - user_title_analyzer.py: 用户称号分析领域服务
  - golden_quote_analyzer.py: 金句分析领域服务
- 更新 domain/entities/__init__.py 导出更多实体类
- 更新 shared/constants.py 添加枚举类 (Platform, TaskStatus, ContentType, ReportFormat)
- 所有新代码使用中文注释
2026-02-08 15:12:52 +08:00
SXP-Simon 39e5d6169d chore: 注释 2026-02-08 15:06:33 +08:00
SXP-Simon 7ef58f9d53 feat: complete DDD Phase 2 - add domain services, infrastructure layers, and shared components
- domain/value_objects: Add Topic, UserTitle, GoldenQuote, Statistics value objects
- domain/services: Add StatisticsCalculator, ReportGenerator domain services
- domain/exceptions: Add comprehensive domain exception hierarchy
- infrastructure/persistence: Add HistoryRepository for data storage
- infrastructure/llm: Add LLMClient wrapper for AstrBot providers
- infrastructure/config: Add ConfigManager for centralized configuration
- infrastructure/resilience: Add CircuitBreaker, RateLimiter, retry utilities
- application: Add SchedulingService, ReportingService application services
- shared: Add constants and TraceContext for request tracing

All imports verified in Docker container.
2026-02-08 14:39:19 +08:00
SXP-Simon 62a91a914a refactor: integrate PlatformAdapterFactory into BotManager
- BotManager now creates PlatformAdapter alongside bot instances
- Added get_adapter(), has_adapter(), can_analyze() methods for DDD access
- Added _detect_platform_name() for automatic platform detection
- Fixed incorrect relative imports in message_handler.py and helpers.py
- Updated get_status_info() to include adapter information
2026-02-08 14:22:48 +08:00
SXP-Simon c1d3bf5ece feat: add DDD architecture layers (domain, infrastructure, application)
- Domain layer: UnifiedMessage, PlatformCapabilities, repository interfaces
- Infrastructure layer: PlatformAdapter base, OneBotAdapter, factory
- Application layer: AnalysisOrchestrator, MessageConverter

This provides cross-platform abstraction for group analysis plugin.
2026-02-08 14:13:09 +08:00
SXP-Simon 9534d4ea68 feat: implement sub-daily history tracking for analysis results 2026-02-08 00:24:09 +08:00
SXP-Simon 4477c8b862 style: apply ruff linting and pyupgrade fixes 2026-02-07 23:58:41 +08:00
SXP-Simon b551abd2db refactor: update ConfigManager with provider selection logic 2026-02-07 23:49:33 +08:00
SXP-Simon 1c317b16df refactor: use AstrBot native APScheduler in AutoScheduler 2026-02-07 23:49:18 +08:00
SXP-Simon 5930cfd804 feat: extract ReportDispatcher for report delivery 2026-02-07 23:49:03 +08:00
SXP-Simon 7e0455c454 feat: extract MessageSender for multi-platform message handling 2026-02-07 23:49:03 +08:00
SXP-Simon 22dc0bf59f feat: add trace context and resilience utilities for LLM calls 2026-02-07 23:48:34 +08:00
SXP-Simon df4236baa9 fix(RetryManager): 'RetryManager' object has no attribute '_notify_failure' 2026-02-05 23:15:19 +08:00
SXP-Simon 53be552be1 fix(AutoScheduler): 增强性处理,保持代码健壮性,增加友好提示 2026-02-05 21:51:59 +08:00
SXP-Simon fe2c9d74c4 feat(auto_analysis_time): 将 auto_analysis_time 配置改为 list,满足支持配置每日多个时间点总结的需求 (#79) 2026-02-05 21:35:45 +08:00
SXP-Simon 2a98df85c5 fix(scheduler): 修复定时分析发送后台不完全静默的 Bug,正确处理文本发送回退时机 2026-01-31 16:12:50 +08:00
SXP-Simon 86178743d5 fix: 删除未使用的引入 2026-01-20 20:35:11 +08:00
SXP-Simon 2438ab5b98 fix(pdf): 迁移为 playwright 2026-01-20 20:26:20 +08:00
SXP-Simon b5e094ff1a feat(ReportGenerator): 优化 t2i 参数 2026-01-20 15:56:39 +08:00
SXP-Simon 80cbe786bf feat(ReportGenerator): 优化 t2i 参数 2026-01-20 14:34:42 +08:00
SXP-Simon 164a5bd5cc [v4.6.4] 重试管理器优化和业务逻辑调整 2026-01-18 00:56:42 +08:00
SXP-Simon a0b0c3e0d1 fix(RetryManager): 重试管理器直接从渲染器请求原始图像字节,QQ 客户端不再需要从本地服务器下载图片,从而绕过了导致超时的网络传输层
直接字节获取(Direct Byte Retrieval): 重试管理器现在直接从渲染器请求原始图像字节(Bytes),而不是通过 URL。这使得 QQ 客户端不再需要从本地服务器下载图片,从而绕过了导致超时的网络传输层。Base64 编码: 图像字节现在被编码为 Base64 字符串。协议兼容性: 消息负载(Payload)现在使用 base64:// 前缀构建,这是 OneBot/AstrBot 协议中发送 Base64 图片的标准方式。
2026-01-18 00:52:08 +08:00