Commit Graph

172 Commits

Author SHA1 Message Date
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
Windpicker-owo
44d86c8847 尝试整合工具和插件系统 2025-07-26 18:37:29 +08:00
UnCLAS-Prommer
3a4f343d84 tools修改 2025-07-25 14:35:59 +08:00
UnCLAS-Prommer
229d45083d command简化,修复unregister的bug 2025-07-25 13:39:27 +08:00
UnCLAS-Prommer
bbb112d803 动态控制命令后续处理 2025-07-25 11:01:14 +08:00
UnCLAS-Prommer
a82de0a50e action文档 2025-07-25 00:08:00 +08:00
UnCLAS-Prommer
f4bc583c7d base action update 2025-07-24 09:58:48 +08:00
SengokuCola
6c9c94d719 better:优化一些颜色和Logger
better:优化logger
2025-07-24 04:04:03 +08:00
UnCLAS-Prommer
e15183a422 管理插件,但是只有一半 2025-07-23 15:53:59 +08:00
SengokuCola
7807168d1b Merge branch 'dev' of https://github.com/MaiM-with-u/MaiBot into dev 2025-07-23 02:26:57 +08:00
SengokuCola
c17b138c08 fix:ruff 2025-07-23 02:25:43 +08:00
UnCLAS-Prommer
10bf424540 增加了组件的局部禁用方法 2025-07-23 00:41:31 +08:00
UnCLAS-Prommer
484fc20983 typing and plugins 2025-07-21 01:23:23 +08:00
UnCLAS-Prommer
8d20134cbb 合并BaseEventPlugin到BasePlugin,重写了components_registry,修正了统计输出 2025-07-19 19:16:42 +08:00
UnCLAS-Prommer
ca5a45c090 增加logging API 2025-07-19 19:11:59 +08:00
UnCLAS-Prommer
400ffd0b53 增加样例插件,修复统计数据(部分),修复一个bug 2025-07-19 00:46:04 +08:00