Commit Graph

137 Commits

Author SHA1 Message Date
Windpicker-owo
086a7322b3 fix:修复插件组件无法正确获取插件配置的问题 2025-11-19 22:58:56 +08:00
minecraft1024a
a30652b0bc feat(planner): 实现大小脑规划器分离以优化决策流程
将规划器(Planner)拆分为“大脑”和“小脑”两个部分,以实现更精细化的决策控制。

- **大脑(BIG_BRAIN)**: 负责宏观决策,如是否回复、是否需要@人等高层级意图。
- **小脑(SMALL_BRAIN)**: 负责具体的功能性动作执行。

此重构引入了 `PlannerType` 枚举,并更新了动作(Action)定义,允许将动作明确分配给大脑或小脑,从而提升了AI回复的逻辑性和条理性。同时,新增了 `no_action` 类型,用于在规划阶段明确表示“无动作”,提高了处理流程的清晰度。
2025-11-19 22:58:55 +08:00
minecraft1024a
02d8e7e5fc rrrrrrrrrrrrrrrrruuuuuuuuuuuufffffffffffffffffffffffffffffffff x2 2025-11-19 22:58:39 +08:00
Windpicker-owo
03d1f7c57c 继续尝试迁移,但是组件获取插件配置存在问题 2025-11-19 22:58:34 +08:00
Windpicker-owo
fe472dff60 修复代码格式和文件名大小写问题 2025-11-19 22:55:55 +08:00
minecraft1024a
4b36a34c1e refactor(plugin): 优化插件配置加载与同步机制
- 移除全局插件配置开关 `plugins.centralized_config`。
- 简化 `PluginBase` 的配置加载逻辑,不再使用模板文件,而是直接在中央配置目录生成默认配置。
- 在 `PluginManager` 中增加配置同步逻辑,在加载插件时,实现插件目录与中央配置目录之间的双向同步,确保配置一致性。
- 更新 `bot_config_template.toml`,移除已废弃的 `[plugins]` 配置项并提升版本号。
2025-11-19 22:54:05 +08:00
Windpicker-owo
eeddf1976c feat(napcat): 新增18个账号相关事件处理器与完善文档
为NapCat适配器添加完整的账号操作功能:
- 在线客户端查询、在线状态设置、最近联系人
- 好友列表、分组列表、删除好友、点赞
- 头像设置、个性签名、自定义在线状态
- 小程序卡片生成、用户信息/状态查询
并同步补充事件类型注解
BREAKING CHANGE: BaseEvent构造函数不再接受可变默认实参
2025-11-19 22:50:07 +08:00
Windpicker-owo
1dbf14c096 feat(napcat): 添加账号设置处理器和事件类型注解
为napcat插件增加SetProfileHandler来处理账号信息设置事件
- 实现参数解析和napcat API调用逻辑
- 添加详细的事件类型文档注解,包含参数说明和返回格式
- 扩展事件枚举类,新增多个群组相关操作事件
- 在插件初始化时自动注册所有事件处理器
- 为HandlerResultsCollection添加获取消息结果的方法

同时添加接口测试处理器用于验证事件系统的正常工作
2025-11-19 22:50:04 +08:00
minecraft1024a
a645e766ca 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-11-19 22:49:46 +08:00
Windpicker-owo
ce64cc68e1 修复event权限,现在每个component都拥有plugin_name属性 2025-11-19 22:49:41 +08:00
雅诺狐
89bb9e5b3e Change default start_index in get_remaining to 0
Updated the get_remaining method in CommandArgs to default start_index to 0 instead of 1, ensuring all arguments are included by default when retrieving remaining parameters.
2025-11-19 22:49:22 +08:00
Windpicker-owo
e468dd1989 feat(plugin-system): 添加事件触发和订阅的白名单机制
为事件系统添加权限控制功能,包括:
- 在BaseEvent中新增allowed_subscribers和allowed_triggers白名单字段
- 事件管理器触发和订阅时进行白名单验证
- 为所有系统默认事件设置仅允许SYSTEM插件触发
- 在所有事件触发调用处显式传递plugin_name="SYSTEM"参数

确保只有授权插件可以触发特定事件和订阅处理器,增强系统安全性。
2025-11-19 22:49:20 +08:00
Windpicker-owo
dc13343b88 fix(plugin): 为事件处理器添加异步锁和并行执行支持
在BaseEvent类中引入asyncio.Lock确保同一个事件不能同时激活多次
重构事件触发逻辑,使用asyncio.gather并行执行所有订阅者处理器
提高事件处理效率的同时保证线程安全
2025-11-19 22:49:19 +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
雅诺狐
a2873a71ef Add PlusCommand enhanced command system
Introduces the PlusCommand system for simplified command development, including new base classes, argument parsing utilities, and registration logic. Updates the plugin system, component registry, and bot message handling to support PlusCommand components alongside traditional commands. Adds documentation and configuration for command prefixes, and provides a developer guide for the new system.
2025-11-19 22:48:49 +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
e7fa3d79ff Reapply "【迁移】工具系统再完善:工具缓存、ttl支持、自动记录、长期保存、自动清理缓存、将记录与执行分离、api记录查询、时间聊天工具筛选查询..."
This reverts commit 3d93bc4079.
2025-11-19 22:48:31 +08:00
Windpicker-owo
e068663ef9 Revert "【迁移】工具系统再完善:工具缓存、ttl支持、自动记录、长期保存、自动清理缓存、将记录与执行分离、api记录查询、时间聊天工具筛选查询..."
This reverts commit 80ab0c687c.
2025-11-19 22:48:24 +08:00
Windpicker-owo
adfacd883c 【迁移】工具系统再完善:工具缓存、ttl支持、自动记录、长期保存、自动清理缓存、将记录与执行分离、api记录查询、时间聊天工具筛选查询... 2025-11-19 22:48:23 +08:00
雅诺狐
ab3a36bfa7 全面更换orjson 2025-11-19 22:47:10 +08:00
Windpicker-owo
5d1390d546 event重构暂时完成,待测试 2025-11-19 22:46:26 +08:00
Windpicker-owo
902a031a9d feat: 迁移Windpicker-owo的Event系统重构\n\n- 引入新的BaseEvent和HandlerResult架构\n- 实现灵活的事件订阅与激活机制\n- 添加事件管理器单例模式\n- 支持事件缓存和权重排序\n- 统一事件处理接口 2025-11-19 22:46:25 +08:00
minecraft1024a
f53993e34a feat(proactive_thinking): 重构主动思考为由Planner直接决策
重构了主动思考的触发和决策流程。原有的通过生成特定prompt来启动思考循环的方式被移除,改为直接调用Planner的`PROACTIVE`模式。

- **Planner增强**:
  - 新增`PROACTIVE`聊天模式,用于处理主动思考场景。
  - 为`PROACTIVE`模式设计了专用的prompt模板,整合了长期记忆、当前状态等信息。
  - 引入`do_nothing`动作,允许Planner在分析后决定保持沉默。
  - 增加从海马体(长期记忆)获取上下文的功能,为决策提供更丰富的背景。

- **ProactiveThinker简化**:
  - 移除了原有的prompt生成和调用`observe`的逻辑。
  - 现在直接调用`action_planner.plan(mode=ChatMode.PROACTIVE)`来获取决策。
  - 根据Planner返回的动作(如`do_nothing`或具体行动),决定是保持沉默还是执行计划。

- **CycleProcessor & Tracker调整**:
  - `CycleProcessor`新增`execute_plan`方法,用于执行一个已经由Planner预先制定好的计划。
  - `CycleTracker`能够区分并标记由主动思考发起的循环(例如,cycle_id为 "1.p"),以便于追踪和分析。
2025-11-19 22:45:16 +08:00
minecraft1024a
660428cdad refactor(config): 移除视频分析相关重复的配置及未使用的导入(所以我挺好奇为什么VideoAnalysisConfig能有两个)
同时,清理了多个文件中未使用的导入,包括 `inspect`、`base64` 和 `get_image_manager`,以保持代码库的整洁。
2025-11-19 22:43:48 +08:00
minecraft1024a
9b382a9505 feat(plugin): 实现插件配置集中化管理
将插件配置文件从各自的插件目录迁移至项目根目录下的 `config/plugins/` 文件夹中,方便用户统一管理和修改。

主要变更:
- 新增 `plugins.centralized_config` 总开关,用于控制是否启用此功能。
- 修改插件加载逻辑,现在会从 `config/plugins/<plugin_name>/` 目录读取用户配置。
- 如果用户配置不存在,会自动从插件目录下的模板配置文件复制一份。
- 保留了原有的配置版本检查和自动迁移功能,现在作用于用户配置文件。
2025-11-19 22:43:47 +08:00
minecraft1024a
38fed9b4cc 添加聊天类型限制功能,支持根据聊天类型过滤命令和动作,新增私聊和群聊专用命令及动作,优化相关日志记录。 2025-11-19 22:40:01 +08:00
雅诺狐
69f59afc19 格式化了一下代码 2025-11-19 22:37:37 +08:00
minecraft1024a
8ed15c8199 新增插件Python依赖管理系统,支持自动检查和安装依赖,优化依赖配置和错误处理,更新相关文档和示例代码。 2025-11-19 22:35:58 +08:00
SengokuCola
bad2be2bdc fix:全面移除reply_to,并且非必须 2025-08-11 20:25:13 +08:00
SengokuCola
6f49b3d99d 修复Action没有reply_to_message的问题 2025-08-11 14:55:23 +08:00
UnCLAS-Prommer
41e8966ae7 更多events 2025-08-09 17:33:24 +08:00
UnCLAS-Prommer
18e23cacdd 防炸和ruff 2025-08-06 12:25:59 +08:00
Windpicker-owo
cd7c1bb3ca Merge branch 'dev' of https://github.com/Windpicker-owo/MaiBot into dev 2025-08-06 12:02:48 +08:00
Windpicker-owo
94a66bd235 使Tool支持读取配置文件,优化了开始执行工具调用时的日志输出 2025-08-06 12:01:31 +08:00
UnCLAS-Prommer
1e5db5d7e1 正确使用lpmm构建prompt 2025-08-03 19:52:31 +08:00
UnCLAS-Prommer
1f53ecff10 加上tools的enum属性 2025-08-03 10:27:47 +08:00
UnCLAS-Prommer
37e52a1566 tools系统 2025-07-31 11:41:15 +08:00
UnCLAS-Prommer
16c644a666 转换原来的tools到新的(虽然没转) 2025-07-29 00:15:29 +08:00
UnCLAS-Prommer
6062b6bd3c Merge pull request #1149 from Windpicker-owo/dev
在一些细节上完善工具
2025-07-29 00:01:47 +08:00
UnCLAS-Prommer
af27d0dbf0 tools整合彻底完成 2025-07-28 23:57:55 +08:00
Windpicker-owo
3692015ce5 update 2025-07-28 23:53:54 +08:00
Windpicker-owo
a395573f06 Update src/plugin_system/base/base_tool.py
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
2025-07-28 23:06:02 +08:00
Windpicker-owo
33f6377dad Merge branch 'dev' of https://github.com/Windpicker-owo/MaiBot into dev 2025-07-28 22:57:20 +08:00
Windpicker-owo
8131e65e9e tool支持是否启用,更人性化的直接调用 2025-07-28 22:56:52 +08:00
UnCLAS-Prommer
82c4dfbb88 Merge branch 'dev' into dev 2025-07-28 21:59:48 +08:00
UnCLAS-Prommer
c0375f5dd9 合并utils_api 2025-07-28 12:37:37 +08:00
Windpicker-owo
8aa8f0e6b7 修改了hello_world_plugin 2025-07-26 22:29:44 +08:00
Windpicker-owo
3021acff59 修复了一些bug,修改了插件加载输出 2025-07-26 20:49:22 +08:00
Windpicker-owo
ef505cc118 Merge branch 'MaiM-with-u:dev' into dev 2025-07-26 20:46:38 +08:00
UnCLAS-Prommer
b3e8fa7058 让activation概率可以为0 2025-07-26 19:23:21 +08:00