Commit Graph

521 Commits

Author SHA1 Message Date
雅诺狐
f33bb57c75 Merge branch 'master' of https://github.com/MoFox-Studio/MoFox_Bot 2025-08-29 13:48:01 +08:00
雅诺狐
865159ece3 Refactor plugin system and update permission checks
Removed the permission_example plugin and its files. Refactored plugin hot reload and manager logic for more robust reloading, deep reload, and cache clearing, including improved debounce and plugin name resolution. Updated MaiZone plugin and actions to use the new permission API for feed read/send actions, and registered new permission nodes. Enhanced plugin management commands with PlusCommand, improved help, and added hot reload and cache management commands.
2025-08-29 13:47:54 +08:00
tt-P607
ad3e6763e1 Merge branch 'master' of https://github.com/MoFox-Studio/MoFox_Bot 2025-08-28 21:04:05 +08:00
tt-P607
3d958b9e05 feat(maizone): 引入持久化回复跟踪以避免重复回复
引入 `ReplyTrackerService` 来持久化跟踪已回复的评论,确保即使在程序重启后也不会对同一评论进行重复回复。

主要变更:
- 新增 `ReplyTrackerService`,用于记录和管理对特定说说下评论的回复状态。
- 在 `QZoneService` 中重构评论回复逻辑,利用 `ReplyTrackerService` 来判断评论是否已被回复。
- 增加逻辑以验证和清理无效的回复记录,例如当用户手动删除了机器人的回复后,程序能够识别并清除相应的记录,从而可以重新进行回复。
- 将 `ReplyTrackerService` 注册为全局服务,以便在插件内部共享。
2025-08-28 21:02:33 +08:00
minecraft1024a
eb1feeeb0b refactor(cache): 重构工具缓存机制并优化LLM请求重试逻辑
将工具缓存的实现从`ToolExecutor`的装饰器模式重构为直接集成。缓存逻辑被移出`cache_manager.py`并整合进`ToolExecutor.execute_tool_call`方法中,简化了代码结构并使其更易于维护。

主要变更:
- 从`cache_manager.py`中移除了`wrap_tool_executor`函数。
- 在`tool_use.py`中,`execute_tool_call`现在包含完整的缓存检查和设置逻辑。
- 调整了`llm_models/utils_model.py`中的LLM请求逻辑,为模型生成的空回复或截断响应增加了内部重试机制,增强了稳定性。
- 清理了项目中未使用的导入和过时的文档文件,以保持代码库的整洁。
2025-08-28 20:10:32 +08:00
tt-P607
4b6542b8e0 Merge branch 'master' of https://github.com/MoFox-Studio/MoFox_Bot 2025-08-28 19:24:22 +08:00
tt-P607
72a3be5b26 refactor(maizone): 优化说说评论回复逻辑
重构了处理和回复评论的算法,以提高准确性和代码清晰度。

主要变更:
- 在获取说说列表时引入 `is_monitoring_own_feeds` 参数,以区分处理自己和好友的说说,避免跳过对自己说说的评论检查。
- 优化了评论回复逻辑,通过将评论区分为用户评论和自己的回复,更精确地识别未回复的评论,防止了之前可能出现的重复回复或漏回复的问题。
2025-08-28 19:19:53 +08:00
雅诺狐
8d77d1cc3f Refactor permission checks and decorators usage
Refactored permission checks in built-in plugins to use the new @require_permission decorator, improving code clarity and consistency. Enhanced permission_decorators to better extract ChatStream and support PlusCommand. Updated PermissionCommand to use permission decorators for all subcommands, improved user mention parsing, and improved feedback messages. Registered a new permission node for sending feeds in MaiZone plugin and updated command registration to use PlusCommand info.
2025-08-28 18:35:59 +08:00
tt-P607
f42b4adaab 哈哈哈哈哈,中,太中咧!!!一把出分啊各位一把出分!没有虫啊没有bug!直接就能回复自己说说下的评论了😋爽! 2025-08-28 17:13:24 +08:00
tt-P607
96a7dff86b Merge branch 'master' of https://github.com/MoFox-Studio/MoFox_Bot 2025-08-28 16:36:06 +08:00
tt-P607
2a67ad1e86 feat(maizone): 实现对说说中图片的识别与理解
重构了原有的评论生成逻辑,使其能够处理和理解说说中的图片内容。现在,插件可以调用视觉模型来描述图片,并将图片描述作为上下文信息,从而生成更贴切、更具情景感的评论。

主要变更:
- 新增了对说说中图片的识别能力,在生成评论时会考虑图片内容。
- 将原有的直接调用LLM API的评论生成方式,重构为使用更高级的 `generator_api`,以更好地融入框架的对话管理和人格系统。
- 为评论和回复生成的逻辑增加了重试机制,提高了在网络波动或API不稳定情况下的成功率。
- 修复了监控自己说说时,因QQ号类型不匹配(int vs str)导致无法正确识别自己身份的bug。
- 优化了对自己说说的评论回复逻辑,确保不会回复自己发表的评论。
- 增强了HTML解析能力,现在可以从网页版QQ空间中提取图片和更完整的评论结构。
2025-08-28 16:35:52 +08:00
雅诺狐
5d3e0315b2 修复qq提取 2025-08-28 13:37:20 +08:00
雅诺狐
f320d1f576 更新示例 2025-08-28 13:00:32 +08:00
雅诺狐
9189010c56 修复权限系统 2025-08-27 20:15:01 +08:00
tt-P607
ff1007049d Merge branch 'master' of https://github.com/MoFox-Studio/MoFox_Bot 2025-08-27 20:00:18 +08:00
tt-P607
00dc0ce5a8 refactor: rename project from MaiMbot-Pro-Max to MoFox_Bot
This commit renames the project from "MaiMbot-Pro-Max" to "MoFox_Bot" across the entire codebase. The change reflects the new project identity and ownership under the MoFox-Studio organization.

Key changes include updating:
- EULA and README documentation
- Project URLs and repository links
- Startup messages and display names
- Plugin manifest metadata
2025-08-27 19:59:10 +08:00
minecraft1024a
d06cfe3a36 refactor(schedule): 重构日程与月度计划管理模块
将 `schedule_manager` 和 `monthly_plan_manager` 从 `src/manager` 移动到 `src/schedule` 目录,以更好地组织与日程和计划相关的功能。

主要变更:
- 将 `schedule_manager` 和 `monthly_plan_manager` 移动到新的 `src/schedule` 目录。
- 更新了所有对这两个模块的导入路径,以反映新的文件位置。
- 删除了旧的 `src/manager` 目录下的模块文件。
- `monthly_plan_manager` 内部实现被重构,取代了原有的 `plan_generator.py`,简化了计划生成逻辑。
2025-08-27 19:46:01 +08:00
minecraft1024a
4ced72010b feat(core): 集成统一向量数据库服务并重构相关模块
本次提交引入了一个统一的、可扩展的向量数据库服务层,旨在解决代码重复、实现分散以及数据库实例泛滥的问题。

主要变更:

新增向量数据库抽象层:

在 src/common/vector_db/ 目录下创建了 VectorDBBase 抽象基类,定义了标准化的数据库操作接口。
创建了 ChromaDBImpl 作为具体的实现,并采用单例模式确保全局只有一个数据库客户端实例。
重构语义缓存 (CacheManager):

移除了对 chromadb 库的直接依赖。
改为调用统一的 vector_db_service 来进行向量的添加和查询操作。
重构瞬时记忆 (VectorInstantMemoryV2):

彻底解决了为每个 chat_id 创建独立数据库实例的问题。
现在所有记忆数据都存储在统一的 instant_memory 集合中,并通过 metadata 中的 chat_id 进行数据隔离和查询。
新增使用文档:

在 docs/ 目录下添加了 vector_db_usage_guide.md,详细说明了如何使用新的 vector_db_service 代码接口。
带来的好处:

高内聚,低耦合: 业务代码与具体的向量数据库实现解耦。
易于维护和扩展: 未来可以轻松替换或添加新的向量数据库支持。
性能与资源优化: 整个应用共享一个数据库连接,显著减少了文件句柄和内存占用
2025-08-27 19:18:28 +08:00
minecraft1024a
af17290595 feat(tool_system): implement declarative caching for tools
This commit refactors the tool caching system to be more robust, configurable, and easier to use. The caching logic is centralized within the `wrap_tool_executor`, removing the need for boilerplate code within individual tool implementations.

Key changes:
- Adds `enable_cache`, `cache_ttl`, and `semantic_cache_query_key` attributes to `BaseTool` for declarative cache configuration.
- Moves caching logic from a simple history-based lookup and individual tools into a unified handling process in `wrap_tool_executor`.
- The new system leverages the central `tool_cache` manager for both exact and semantic caching based on tool configuration.
- Refactors `WebSurfingTool` and `URLParserTool` to utilize the new declarative caching mechanism, simplifying their code.
2025-08-27 18:45:59 +08:00
minecraft1024a
1fd1c76a84 ruff这一块 2025-08-27 18:03:07 +08:00
minecraft1024a
2db42292d2 refactor(config): 整合搜索服务配置并移除废弃选项
将原先独立的 Exa 和 Tavily 搜索引擎配置项合并到 `web_search` 配置块中,以实现更统一的管理。同时,移除了已废弃的 `Telemetry` 和部分 `Experimental` 功能配置,简化了整体配置文件结构。

主要变更:
-   `ExaConfig` 和 `TavilyConfig` 被移除,其 API 密钥设置已迁移至 `WebSearchConfig`。
-   删除了 `TelemetryConfig` 及其在主配置中的引用。
-   简化了 `planner` 的自定义提示词逻辑,现在仅通过内容是否为空来判断是否启用。
-   更新了配置文件模板,以反映上述结构调整并移除过时的注释和配置项。
2025-08-26 21:10:06 +08:00
minecraft1024a
1e037e5ce9 feat(maizone): 新增QQ空间互通组功能,根据聊天上下文生成说说
引入了全新的“QQ空间互通组”功能。用户可以配置多个群聊为一个互通组。
在通过指令发布说说时,系统会自动获取这些群聊的近期聊天记录作为上下文,从而生成与当前讨论话题更相关的说说内容。

- 在 `config.toml` 中新增了 `[maizone_intercom]` 配置项用于定义互通组。
- 重构并增强了动态(说说)的拉取逻辑,提高了对不同数据格式的兼容性和解析的稳定性。
- 对项目中的多个文件进行了代码清理,移除了未使用的导入,使代码更加整洁。
2025-08-26 20:20:54 +08:00
雅诺狐
0e815779b7 Merge branch 'master' of https://github.com/MaiBot-Plus/MaiMbot-Pro-Max 2025-08-26 14:20:32 +08:00
雅诺狐
4a44ba9866 全面更换orjson 2025-08-26 14:20:26 +08:00
tt-P607
1ca365168a fix(maizone_refactored): 修复获取cookie时响应为空导致的错误 2025-08-26 12:11:08 +08:00
雅诺狐
bfabf896b5 更新作者信息 2025-08-25 21:53:06 +08:00
雅诺狐
8054262827 Merge branch 'master' of https://github.com/MaiBot-Plus/MaiMbot-Pro-Max 2025-08-25 16:36:59 +08:00
雅诺狐
0bcc0ba8b5 feat: 添加视频处理多线程优化和消息切片重组功能
- 新增视频帧提取的线程池支持,提升大视频文件处理性能
- 集成消息切片重组器,支持长消息的自动重组处理
- 优化视频帧提取算法,使用numpy进行数值计算优化
- 重构权限管理插件,修复属性访问和方法签名问题
- 清理未使用的导入和代码,提升代码质量
- 默认启用插件管理功能
2025-08-25 16:16:33 +08:00
tt-P607
11f86683f2 Merge branch 'master' of https://github.com/MaiBot-Plus/MaiMbot-Pro-Max 2025-08-25 01:22:19 +08:00
tt-P607
d34467abc5 feat(video): 新增按时间间隔抽帧模式
增加了按时间间隔提取视频帧的新模式,与原有的固定总帧数模式并存。用户现在可以通过配置文件选择最适合其需求的抽帧方式。

- 新增 `frame_extraction_mode` 配置项,可选值为 "fixed_number" (固定总帧数) 或 "time_interval" (按时间间隔)。
- 新增 `frame_interval_seconds` 配置项,用于指定时间间隔模式下的抽帧秒数。
- `max_frames` 配置项现在仅在 "fixed_number" 模式下生效。
- 更新了 `VideoAnalyzer` 类以支持两种抽帧逻辑,并从配置中读取新参数。
- 相应地更新了配置文件模板 `bot_config_template.toml`。
2025-08-25 01:21:50 +08:00
雅诺狐
f308adcf5b refactor: 清理代码质量和移除未使用文件
- 移除未使用的导入语句和变量
- 修复代码风格问题(空格、格式化等)
- 删除备份文件和测试文件
- 改进异常处理链式调用
- 添加权限系统数据库模型和配置
- 更新版本号至6.4.4
- 优化SQL查询使用正确的布尔表达式
2025-08-24 22:11:20 +08:00
tt-P607
88d56aab50 feat(maizone): 新增日程活动黑名单以防止自动发送
新增了一个配置项 `schedule.activity_blacklist`,允许用户定义一个包含特定关键字的列表。当定时任务检测到的当前日程活动包含这些关键字(如“睡觉”、“睡眠”)时,将跳过本次自动发送说说的流程。

此功能主要解决了在睡眠等不希望被打扰的活动期间,插件仍然会根据日程表自动发送说说的问题。通过引入黑名单机制,可以更智能地过滤掉不适合发布动态的活动,提升了用户体验和插件的实用性。

主要的逻辑变更在 `SchedulerService` 中:
- 在获取到当前活动后,会先检查活动名称是否包含黑名单中的任意关键字。
- 如果匹配成功,则记录日志并跳过本次发送,同时更新 `last_processed_activity` 状态,以避免在黑名单活动结束后立即错误地触发发送。
- 只有当活动不在黑名单中,且与上一次处理的活动不同时,才会触发发送流程。
2025-08-23 17:20:20 +08:00
minecraft1024a
8e1aa25e65 refactor(core_actions): 移除 AntiInjectorSkipListCommand
精简了核心操作插件,移除了未使用的 `AntiInjectorSkipListCommand` 组件,以简化代码和配置。
2025-08-22 17:52:36 +08:00
雅诺狐
8d8d9fbda1 Refactor anti-injection system and remove command skip list
Removed the command skip list feature and related code from the anti-injection system, including configuration options, plugin command collection, and management commands. Refactored anti-injector logic to operate directly on message dictionaries and simplified whitelist and message content extraction. Updated response handling to perform anti-injection checks before reply generation, and removed skip list refresh logic from the plugin manager.
2025-08-22 15:48:21 +08:00
minecraft1024a
11eceb6b90 refactor: 移除未使用的导入和优化代码风格
本次提交主要包含以下代码重构和风格优化:
- 从多个文件中移除了未被使用的导入,例如 `Dict`, `Any`, `List`, `os`, `threading` 等,以保持代码的整洁性。
- 统一了测试脚本中的输出格式,移除了不必要的 f-string,使代码更加简洁。
- 清理了部分冗余的类型提示,提升了代码的可读性。
2025-08-22 14:19:21 +08:00
Furina-1013-create
021a1a5906 解决合并冲突:又是Merge这一块 2025-08-22 13:47:36 +08:00
Furina-1013-create
3de02fd3a7 修复Action组件可用性和实现消息驱动思考循环
Action组件修复:
- 在core_actions插件中正确注册reply动作
ps:这个优先还是使用之前系统原有的reply,新增这个仅作为回退使用

- 更新_manifest.json、config.toml和plugin.py

- 解决no_reply和reply动作不可用问题(关于这个我觉得是之前的那个在focus模式下设置了提及/@ 必回然后移除动作的先后顺序这一块有问题)

大C发力了,今天有一点感冒所以停止思考这一块()
2025-08-22 13:42:05 +08:00
minecraft1024a
5c7bdfb069 refactor(chat): 优化跨群聊上下文构建与代码格式
对 `default_generator.py` 进行了多项重构和优化:
- 将跨群聊上下文的构建逻辑移入独立的 `_build_cross_context_block` 方法,并在主流程中异步并行执行,提高了代码的模块化和执行效率。
- 全面清理了代码中的多余空行和不一致的间距,提升了代码的可读性和一致性。
- 调整了 `NoReplyAction` 和 `ReplyAction` 的 `mode_enable` 配置,使其行为更符合预期。
2025-08-22 13:37:59 +08:00
Furina-1013-create
a5159bb030 Merge这一块 2025-08-22 13:17:18 +08:00
Furina-1013-create
980221d589 异步记忆系统优化 & Action组件修复
主要改进:
1. 异步记忆系统优化 - 解决记忆操作阻塞主程序问题
   - 新增异步记忆队列管理器 (async_memory_optimizer.py)
   - 新增异步瞬时记忆包装器 (async_instant_memory_wrapper.py)
   - 优化主程序记忆构建任务为后台非阻塞执行
   - 优化消息处理器记忆调用,增加超时保护和回退机制

2. Action组件修复 - 解决'未找到Action组件: no_reply'问题
   - 修复no_reply动作激活类型配置错误
   - 新增reply回退动作 (reply.py)
   - 增强planner.py动作选择回退机制
   - 增强cycle_processor.py动作创建回退机制
2025-08-22 13:16:19 +08:00
minecraft1024a
7531ed9ba8 feat(plugin): 兼容 alpha 版本并更新插件版本限制
- 在版本比较器中增加对 alpha 版本号的兼容性处理,现在可以正确解析如 `0.10.0-alpha-1` 格式的版本。
2025-08-22 13:03:36 +08:00
雅诺狐
f8ba0d0e43 Refactor web search plugin and clean up code
Refactored the web search plugin by removing the old Bing search implementation and reorganizing the plugin structure. Introduced modular search engine classes under 'web_search_tool/engines' and utility tools under 'web_search_tool/tools' and 'web_search_tool/utils'. Updated references and initialization logic to support multiple search engines and improved maintainability. Also performed minor code cleanups and replaced 'except ...: pass' with 'except ...: ...' for brevity.
2025-08-21 23:42:16 +08:00
minecraft1024a
96e6f1bc15 fix:统一了一下日志名称 2025-08-21 21:28:22 +08:00
minecraft1024a
cb9cc019fc fix:不小心改了一下名字改回来了 2025-08-21 21:27:29 +08:00
minecraft1024a
aa096835f8 feat(search): add bing search engine support
Integrates Bing as a new search engine option alongside existing engines like DDG, Exa, and Tavily. This provides users with more choice and improves the robustness of the web search tool.

- Adds `BingSearch` class and its integration into the `WebSurfingTool`.
- Implements the `_search_bing` async method to handle search queries via the Bing scraper.
- Updates the search strategy logic to include "bing" as an option.
- Modifies the tool cache key generation to use the file path for better uniqueness.
- Updates the configuration template to list "bing" as an available search engine.
2025-08-21 21:26:58 +08:00
minecraft1024a
87ee286614 refactor(cleanup): 移除未使用的导入项与冗余代码
清理了整个代码库中所有无用的模块导入、重复定义以及冗余变量引用,具体包括:
- bot.py 去掉了 random、typing 的未使用 import
- antipromptinjector 模块统一移除未引用的 DetectionResult、Dict、List 等
- chat_loop 中删除了未调用的 Timer、mai_thinking_manager、events_manager 等引用
- qzone_service 删除多余 f-string 大括号,避免日志警告格式问题
- 其他模块同步剔除各自范围内的冗余 import(asyncio、datetime 等共 20+ 处)

保持功能不变,仅作代码整洁度优化,无破坏性变更。(并添加了一个现在暂时还没加进去的必应搜索源文件)
2025-08-21 21:09:52 +08:00
minecraft1024a
c6cb4c7390 fix:修复了空间导入的问题(谁要是以后再用第三方pack不导入我就用草喂养他) 2025-08-21 12:41:01 +08:00
雅诺狐
7894cd81b0 Merge branch 'master' of https://github.com/MaiBot-Plus/MaiMbot-Pro-Max 2025-08-21 00:44:40 +08:00
雅诺狐
b6d789f018 Remove manual and temporary skip pattern support
Eliminated support for manually and temporarily adding skip patterns in CommandSkipListManager and related command handling. The skip list now only manages system and plugin patterns, simplifying the skip pattern management logic and user interface.
2025-08-21 00:44:35 +08:00
tt-P607
4d02093cc8 Merge branch 'master' of https://github.com/MaiBot-Plus/MaiMbot-Pro-Max 2025-08-21 00:05:39 +08:00