Commit Graph

1866 Commits

Author SHA1 Message Date
雅诺狐
71c6b0ef1e 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-11-19 22:49:23 +08:00
雅诺狐
395cd14e52 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-11-19 22:49:16 +08:00
tt-P607
491c9103f9 哈哈哈哈哈,中,太中咧!!!一把出分啊各位一把出分!没有虫啊没有bug!直接就能回复自己说说下的评论了😋爽! 2025-11-19 22:49:13 +08:00
雅诺狐
4b0e0f3482 修复qq提取 2025-11-19 22:49:12 +08:00
雅诺狐
3757d444bf 更新示例 2025-11-19 22:49:11 +08:00
tt-P607
ef95ec9d70 feat(maizone): 实现对说说中图片的识别与理解
重构了原有的评论生成逻辑,使其能够处理和理解说说中的图片内容。现在,插件可以调用视觉模型来描述图片,并将图片描述作为上下文信息,从而生成更贴切、更具情景感的评论。

主要变更:
- 新增了对说说中图片的识别能力,在生成评论时会考虑图片内容。
- 将原有的直接调用LLM API的评论生成方式,重构为使用更高级的 `generator_api`,以更好地融入框架的对话管理和人格系统。
- 为评论和回复生成的逻辑增加了重试机制,提高了在网络波动或API不稳定情况下的成功率。
- 修复了监控自己说说时,因QQ号类型不匹配(int vs str)导致无法正确识别自己身份的bug。
- 优化了对自己说说的评论回复逻辑,确保不会回复自己发表的评论。
- 增强了HTML解析能力,现在可以从网页版QQ空间中提取图片和更完整的评论结构。
2025-11-19 22:49:10 +08:00
雅诺狐
0616623e71 修复权限系统 2025-11-19 22:48:44 +08:00
minecraft1024a
3948fbacbe 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-11-19 22:48:42 +08:00
tt-P607
e362615d6d 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-11-19 22:48:40 +08:00
minecraft1024a
864272ab8f 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-11-19 22:48:39 +08:00
minecraft1024a
6b53560a7e 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-11-19 22:48:37 +08:00
minecraft1024a
2c3ebedc96 ruff这一块 2025-11-19 22:48:35 +08:00
minecraft1024a
36021284da refactor(config): 整合搜索服务配置并移除废弃选项
将原先独立的 Exa 和 Tavily 搜索引擎配置项合并到 `web_search` 配置块中,以实现更统一的管理。同时,移除了已废弃的 `Telemetry` 和部分 `Experimental` 功能配置,简化了整体配置文件结构。

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

- 在 `config.toml` 中新增了 `[maizone_intercom]` 配置项用于定义互通组。
- 重构并增强了动态(说说)的拉取逻辑,提高了对不同数据格式的兼容性和解析的稳定性。
- 对项目中的多个文件进行了代码清理,移除了未使用的导入,使代码更加整洁。
2025-11-19 22:48:02 +08:00
tt-P607
0dae3153d2 fix(maizone_refactored): 修复获取cookie时响应为空导致的错误 2025-11-19 22:47:42 +08:00
雅诺狐
ab3a36bfa7 全面更换orjson 2025-11-19 22:47:10 +08:00
雅诺狐
9f514d8799 更新作者信息 2025-11-19 22:46:40 +08:00
雅诺狐
8735bfbc88 feat: 添加视频处理多线程优化和消息切片重组功能
- 新增视频帧提取的线程池支持,提升大视频文件处理性能
- 集成消息切片重组器,支持长消息的自动重组处理
- 优化视频帧提取算法,使用numpy进行数值计算优化
- 重构权限管理插件,修复属性访问和方法签名问题
- 清理未使用的导入和代码,提升代码质量
- 默认启用插件管理功能
2025-11-19 22:46:27 +08:00
tt-P607
89bee8db90 feat(video): 新增按时间间隔抽帧模式
增加了按时间间隔提取视频帧的新模式,与原有的固定总帧数模式并存。用户现在可以通过配置文件选择最适合其需求的抽帧方式。

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

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

主要的逻辑变更在 `SchedulerService` 中:
- 在获取到当前活动后,会先检查活动名称是否包含黑名单中的任意关键字。
- 如果匹配成功,则记录日志并跳过本次发送,同时更新 `last_processed_activity` 状态,以避免在黑名单活动结束后立即错误地触发发送。
- 只有当活动不在黑名单中,且与上一次处理的活动不同时,才会触发发送流程。
2025-11-19 22:46:14 +08:00
minecraft1024a
824ef0ad02 refactor(core_actions): 移除 AntiInjectorSkipListCommand
精简了核心操作插件,移除了未使用的 `AntiInjectorSkipListCommand` 组件,以简化代码和配置。
2025-11-19 22:46:09 +08:00
雅诺狐
3360b22dca 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-11-19 22:46:06 +08:00
minecraft1024a
283c69e89b refactor: 移除未使用的导入和优化代码风格
本次提交主要包含以下代码重构和风格优化:
- 从多个文件中移除了未被使用的导入,例如 `Dict`, `Any`, `List`, `os`, `threading` 等,以保持代码的整洁性。
- 统一了测试脚本中的输出格式,移除了不必要的 f-string,使代码更加简洁。
- 清理了部分冗余的类型提示,提升了代码的可读性。
2025-11-19 22:46:05 +08:00
minecraft1024a
1a5cb9e851 refactor(chat): 优化跨群聊上下文构建与代码格式
对 `default_generator.py` 进行了多项重构和优化:
- 将跨群聊上下文的构建逻辑移入独立的 `_build_cross_context_block` 方法,并在主流程中异步并行执行,提高了代码的模块化和执行效率。
- 全面清理了代码中的多余空行和不一致的间距,提升了代码的可读性和一致性。
- 调整了 `NoReplyAction` 和 `ReplyAction` 的 `mode_enable` 配置,使其行为更符合预期。
2025-11-19 22:46:01 +08:00
Furina-1013-create
6af2716e0e 修复Action组件可用性和实现消息驱动思考循环
Action组件修复:
- 在core_actions插件中正确注册reply动作
ps:这个优先还是使用之前系统原有的reply,新增这个仅作为回退使用

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

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

大C发力了,今天有一点感冒所以停止思考这一块()
2025-11-19 22:45:56 +08:00
minecraft1024a
bca9747691 feat(plugin): 兼容 alpha 版本并更新插件版本限制
- 在版本比较器中增加对 alpha 版本号的兼容性处理,现在可以正确解析如 `0.10.0-alpha-1` 格式的版本。
2025-11-19 22:45:51 +08:00
Furina-1013-create
7dca70b057 异步记忆系统优化 & 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-11-19 22:45:51 +08:00
雅诺狐
1b9c86abef 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-11-19 22:45:42 +08:00
minecraft1024a
159baabe6c fix:统一了一下日志名称 2025-11-19 22:45:24 +08:00
minecraft1024a
95c4723bda fix:不小心改了一下名字改回来了 2025-11-19 22:45:23 +08:00
minecraft1024a
adfce6d74f 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-11-19 22:45:23 +08:00
minecraft1024a
2f1a9fa966 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-11-19 22:45:22 +08:00
minecraft1024a
db0ef148d3 fix:修复了空间导入的问题(谁要是以后再用第三方pack不导入我就用草喂养他) 2025-11-19 22:45:07 +08:00
tt-P607
ffdfa8e38e refactor(maizone_refactored): use absolute path for default image directory
The default path for `image_directory` was previously a relative path (`./data/images`), which could lead to issues depending on the working directory from which the application is run.

This change modifies the default value to be an absolute path derived from the plugin's file location (`Path(__file__).parent / "images"`). This ensures that the image directory path is always correct and robust, regardless of the execution context.
2025-11-19 22:45:04 +08:00
雅诺狐
dbe137ed2f 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-11-19 22:45:04 +08:00
雅诺狐
90f5e2357e Improve anti-injector status handling and statistics
Moved statistics update to only occur when the anti-injector system is enabled. Enhanced statistics reporting to handle disabled state and improved uptime calculation to use session start time. Updated status command to provide clearer feedback when the anti-injector system is disabled or when errors occur. Also fixed a docstring in prompt_builder.py for clarity.
2025-11-19 22:45:03 +08:00
tt-P607
a8dab4d648 完善本地图片配图功能并优化图片上传机制 2025-11-19 22:45:01 +08:00
雅诺狐
95bbce355a Improve anti-injection detection logging and text extraction
Added detailed debug logs for text extraction and LLM detection input in the anti-injector module. Refactored message processing to only use user-added content for detection, avoiding duplicate text. Fixed import paths for command_skip_list in plugin manager and anti_injector_manager to reflect new module structure.
2025-11-19 22:45:01 +08:00
雅诺狐
aefb3965d4 配置未和主框架耦合,移动到外部插件目录 2025-11-19 22:44:57 +08:00
tt-P607
2b0fd12f4b refactor(maizone_refactored): 优化Cookie服务中备用HTTP获取逻辑
将获取Cookie的HTTP请求从GET改为POST,并增加domain参数,以适配更可靠的实现。同时,增强了对返回数据的解析和校验逻辑,确保能正确处理并转换Cookie字符串格式,提高了服务的健壮性和兼容性。
2025-11-19 22:44:57 +08:00
minecraft1024a
aa6e419fd0 feat(maizone_refactored): 在生成说说时融入当前时间信息
在生成说说的提示词中加入了当前的具体时间(年/月/日 时:分)和星期信息。同时,引导模型在生成内容时可以自然地提及当前时间,使得生成的说说更具时效性和真实感,更贴近用户发布那一刻的情境。
2025-11-19 22:44:53 +08:00
minecraft1024a
f2e82cf82f refactor(memory): 重构瞬时记忆为全量向量化存储模型
新系统采用“全量存储,定时清理”的设计理念,将所有聊天消息向量化并存入ChromaDB。通过后台线程定时清理过期消息,取代了之前基于“重要性模式”判断是否记忆的复杂逻辑。

主要变更:
- **全量存储**: 不再进行前置判断,所有消息均被向量化存储,简化了记忆创建流程。
- **定时清理**: 引入基于`threading`的后台任务,根据设定的`retention_hours`自动清理过期记忆,确保系统轻量高效。
- **简化检索**: 检索逻辑更新为直接查询相似消息,并增加了相似度阈值过滤和时间差格式化,提高了上下文的准确性和可读性。

在 `DefaultReplyer` 中,已切换至新的 `HybridInstantMemory`(其底层实现为V2),并优化了记忆上下文的构建逻辑,使其能更稳定地处理不同类型的记忆返回结果。
2025-11-19 22:44:50 +08:00
tt-P607
cd8fd47a91 修复qzone_service.py中缺失的pathlib.Path导入导致的无法查找到路径问题,还有host和端口的一些修改👀总之就是又混到提交了😋 2025-11-19 22:44:47 +08:00
tt-P607
ce133bb9a1 修复了空间插件监控好友空间失败的问题 2025-11-19 22:44:47 +08:00
雅诺狐
bb4592846c Refactor config system to use Pydantic validation
Refactored configuration classes to inherit from a new ValidatedConfigBase using Pydantic for robust validation and error reporting. Updated api_ada_configs.py, config.py, config_base.py, and official_configs.py to replace dataclasses with Pydantic models, add field validation, and improve error messages. This change enhances configuration reliability and developer feedback for misconfigurations. Also includes minor code cleanups and removal of unused variables in other modules.
2025-11-19 22:44:45 +08:00
雅诺狐
383f704b53 Remove unused imports across multiple modules
Cleaned up various files by removing unused or redundant import statements to improve code readability and reduce potential confusion. No functional changes were made.
2025-11-19 22:44:32 +08:00
tt-P607
3e20d11eec <Thinking>
我需要分析这个git diff,并生成一个与之前完全不同的commit message。

让我先分析变更内容:

1. **主要变更**:
   - 在 `anti_injector.py` 中添加了新的 `auto` 处理模式
   - 添加了命令跳过列表功能 (`command_skip_list`)
   - 重构了反注入管理命令,从独立插件移动到核心动作插件
   - 更新了配置文件以支持新功能
   - 在插件管理器中添加了跳过列表刷新逻辑

2. **之前的commit message重点**:
   - 强调了"advanced anti-injection capabilities"
   - 重点描述了"intelligent 'auto' mode"
   - 提到了"command skip list"
   - 强调了"dynamically assesses threats"
   - 提到了"refactored and integrated into core actions plugin"

3. **我需要完全不同的角度**:
   - 可以从架构重构的角度
   - 可以从用户体验改进的角度
   - 可以从系统集成的角度
   - 可以从性能优化的角度

让我从**系统架构优化和插件整合**的角度来写这个commit message,重点强调:
- 插件系统的重构和整合
- 管理命令的迁移和统一
- 跳过机制的实现
- 自动化决策系统的引入

这样就能避免使用之前message中的关键词和结构。
</Thinking>

refactor(plugins): 重构反注入插件架构并优化命令管理体系

将反注入管理功能从独立插件迁移至核心动作模块,实现更好的系统集成。新增智能跳过机制,允许已注册的插件命令绕过检测流程,有效减少误判。同时引入自适应处理策略,系统可根据威胁评估结果自主选择最适当的响应方式。

插件管理器现已集成自动刷新功能,确保跳过列表与插件状态保持同步。配置系统扩展支持多种跳过模式和自定义规则,提升了整体可维护性和用户体验。
ps:谢谢雅诺狐姐姐投喂的提交喵^ω^
2025-11-19 22:44:03 +08:00
minecraft1024a
b3d02ff1c3 feat(cache): 用文件修改时间替换源码哈希生成缓存键
BREAKING CHANGE: CacheManager 的 _generate_key/get/set 方法签名变更,现在需要传入 tool_file_path 而非 tool_class 实例,所有调用方需跟进适配。
2025-11-19 22:44:01 +08:00
雅诺狐
16da725272 Add LLM anti-prompt injection system
Introduces a comprehensive anti-prompt injection system for LLMs, including rule-based and LLM-based detection, user ban/whitelist management, message shielding, and statistics tracking. Adds new modules under src/chat/antipromptinjector, integrates anti-injection checks into the message receive flow, updates configuration and database models, and provides test scripts. Also updates templates and logger aliases to support the new system.
2025-11-19 22:43:57 +08:00