Commit Graph

548 Commits

Author SHA1 Message Date
minecraft1024a
88f7ea4d8b refactor(llm_models): 优化并发请求的返回值处理
修改了`execute_concurrently`的返回逻辑,将其解包以分别返回`content`和包含`reasoning_content`, `model_name`, `tool_calls`的元组。这使得调用方能更清晰地处理并发请求的结果。
2025-08-29 20:34:23 +08:00
minecraft1024a
65fee5458a refactor(energy): 移除is_sleeping方法对wakeup_manager的依赖
将`schedule_manager.is_sleeping`的调用从`is_sleeping(self.context.wakeup_manager)`修改为`is_sleeping()`,以解耦对`wakeup_manager`的直接依赖。

同时,在`napcat_adapter_plugin`中将`enable_plugin`的默认值修改为`False`。
2025-08-29 20:04:05 +08:00
雅诺狐
16a1568f65 Merge branch 'master' of https://github.com/MoFox-Studio/MoFox_Bot 2025-08-29 19:15:04 +08:00
雅诺狐
0a647376f7 Remove rust-video keyframe extraction API and related files
Deleted the entire src/chat/utils/rust-video directory, including Rust and Python source files, configuration, and documentation. Updated utils_video.py, official_configs.py, and bot_config_template.toml to remove or adjust references to the removed rust-video module. This cleans up the codebase by removing the integrated Rust-based keyframe extraction API and its supporting infrastructure.
2025-08-29 19:13:42 +08:00
minecraft1024a
1bad63fcbd ruff ci 2025-08-29 18:34:13 +08:00
minecraft1024a
35db4c5d91 refactor(schedule): 将睡眠状态管理逻辑重构并迁移到SleepManager
将原先分散在 `ScheduleManager` 中的睡眠状态机逻辑(包括状态判断、转换、持久化等)抽取并封装到一个新的 `SleepManager` 类中。

这次重构的主要目的如下:
- **职责分离**: `ScheduleManager` 的核心职责是管理日程的生成和查询,而睡眠状态的管理是一个独立的、复杂的逻辑单元。将其分离可以使两个类的职责更单一、代码更清晰。
- **可维护性**: 将所有与睡眠相关的状态和逻辑集中到 `SleepManager` 中,使得未来对睡眠功能的修改和扩展更加容易,减少了对 `ScheduleManager` 的影响。
- **代码简化**: `ScheduleManager` 不再需要管理内部的睡眠状态变量(如 `_current_state`, `_sleep_buffer_end_time` 等),而是通过委托 `sleep_manager` 实例来处理,简化了其内部实现。

相应的,`HfcContext` 中冗余的睡眠相关状态(如 `is_in_insomnia`)也被移除,统一由 `SleepManager` 管理。其他模块(如 `HeartFChatting`, `WakeUpManager`)对睡眠状态的调用也已更新为通过 `schedule_manager.sleep_manager` 或其代理方法进行。
2025-08-29 18:17:16 +08:00
minecraft1024a
e1fb3d7a3e Merge branch 'master' of https://github.com/MoFox-Studio/MoFox_Bot 2025-08-29 17:40:26 +08:00
minecraft1024a
41565eb144 refactor(schedule): 重构睡眠系统为状态机模型
将原有的睡眠、失眠、唤醒等分散的布尔标记逻辑重构为一个统一的睡眠状态机(SleepState),以提高代码的可读性、可维护性和可扩展性。

主要变更:
- 引入 `SleepState` 枚举,包含 `AWAKE`, `INSOMNIA`, `PREPARING_SLEEP`, `SLEEPING`, `WOKEN_UP` 状态。
- 在 `ScheduleManager` 中实现 `_update_sleep_state` 作为核心状态机,统一管理所有状态转换。
- 将原有的失眠判断逻辑从 `WakeUpManager` 移至 `ScheduleManager` 的状态机内部,与弹性睡眠决策合并,简化了模块职责。
- `heartFC_chat.py` 中的聊天循环现在直接查询 `ScheduleManager` 的当前状态,而不是处理多个独立的布尔值,使逻辑更清晰。
- 删除了 `WakeUpManager` 中与失眠相关的配置和方法,因为它现在由 `ScheduleManager` 统一管理。
- 删除了配置中已废弃的 `enable_is_sleep` 选项。
2025-08-29 17:40:22 +08:00
Windpicker-owo
c0033c4acc Merge branch 'master' of https://github.com/MoFox-Studio/MoFox_Bot 2025-08-29 16:58:55 +08:00
Windpicker-owo
edc7b36724 移除测试 2025-08-29 16:58:52 +08:00
minecraft1024a
01455156a7 Merge branch 'master' of https://github.com/MoFox-Studio/MoFox_Bot 2025-08-29 16:23:12 +08:00
minecraft1024a
aa3ecfb63a feat:重写了hello_world 2025-08-29 16:23:08 +08:00
Windpicker-owo
925604a708 feat(napcat): 新增18个账号相关事件处理器与完善文档
为NapCat适配器添加完整的账号操作功能:
- 在线客户端查询、在线状态设置、最近联系人
- 好友列表、分组列表、删除好友、点赞
- 头像设置、个性签名、自定义在线状态
- 小程序卡片生成、用户信息/状态查询
并同步补充事件类型注解
BREAKING CHANGE: BaseEvent构造函数不再接受可变默认实参
2025-08-29 16:20:19 +08:00
Windpicker-owo
288a686022 Merge branch 'master' of https://github.com/MoFox-Studio/MoFox_Bot 2025-08-29 14:16:30 +08:00
Windpicker-owo
ad18af3c99 feat(napcat): 添加账号设置处理器和事件类型注解
为napcat插件增加SetProfileHandler来处理账号信息设置事件
- 实现参数解析和napcat API调用逻辑
- 添加详细的事件类型文档注解,包含参数说明和返回格式
- 扩展事件枚举类,新增多个群组相关操作事件
- 在插件初始化时自动注册所有事件处理器
- 为HandlerResultsCollection添加获取消息结果的方法

同时添加接口测试处理器用于验证事件系统的正常工作
2025-08-29 14:16:24 +08:00
minecraft1024a
74863fb914 chore(config): update bot_config_template version and remove unused option
- Bumps the config version from 6.5.7 to 6.5.8.
- Removes the `prompt_before_install` option which was not implemented.
2025-08-29 13:59:34 +08:00
minecraft1024a
e0a5e8e2d3 Merge branch 'master' of https://github.com/MoFox-Studio/MoFox_Bot 2025-08-29 13:56:27 +08:00
minecraft1024a
a485aaf4ad refactor(config): rename wakeup_system to sleep_system for clarity
This commit refactors the entire "wakeup system" to be named "sleep system". This change provides a more intuitive and accurate name for the functionality, which manages the AI's sleep cycles, sleep pressure, and related behaviors like insomnia and flexible sleep schedules.

The renaming has been applied consistently across all relevant files, including:
- Configuration models (`WakeUpSystemConfig` -> `SleepSystemConfig`)
- Configuration files (`bot_config_template.toml`)
- Core application logic that references these configurations.

Additionally, flexible sleep and pre-sleep notification settings have been moved from the `ScheduleConfig` to the new `SleepSystemConfig` to centralize all sleep-related parameters.
2025-08-29 13:56:24 +08:00
雅诺狐
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
Furina-1013-create
23559fc92e 初步上传基于rust的后端视频关键帧抽帧处理源文件以及readme
但是api还未完成接入
2025-08-29 12:57:39 +08:00
Furina-1013-create
abb1a382aa 为即将到来的rust视频组件更新依赖文件.jpg 2025-08-29 12:48:15 +08:00
Furina-1013-create
bbebca832f 解决某人不会改的日志刷屏问题,是谁我不说() 2025-08-29 12:09:27 +08:00
tt-P607
f9a6614fb1 小修复,还有就是炸掉hello world! 2025-08-29 07:58:49 +08:00
Windpicker-owo
d7d5b662cd napcat插件继续更新 2025-08-29 01:02:45 +08:00
Windpicker-owo
14a82008d5 Merge branch 'master' of https://github.com/MoFox-Studio/MoFox_Bot 2025-08-28 22:04:33 +08:00
Windpicker-owo
3a89c790ef 修复napcat插件 2025-08-28 22:04:17 +08:00
minecraft1024a
3d78ed19ec docs(changelog): 强调第三方更新记录的起始点
在变更日志中,为第三方改版记录的起始说明文字增加了额外的标点符号,使其更加醒目,以便于区分官方更新和社区贡献。
2025-08-28 21:54:04 +08:00
minecraft1024a
cf3ffb5f55 docs(changelog): 更新0.10.0-alpha版本日志
为即将发布的 `0.10.0-alpha` 版本添加详细的更新日志。

本次更新日志涵盖了新功能、问题修复和代码重构三大方面,全面记录了从持久化回复跟踪、模型故障转移机制等新功能的引入,到多个关键bug的修复,再到项目更名和模块重构等重要变更。
2025-08-28 21:32:42 +08:00
minecraft1024a
6736375329 refactor(config): 移除changelog_config并更新模型配置模板
删除了手动维护的`changelog_config.md`文件,因为它已经过时且难以维护。

同时,更新了`model_config_template.toml`文件,将Google Gemini的`client`配置从"gemini"修改为"aiohttp_gemini",以适配新的API客户端。
2025-08-28 21:22:44 +08:00
Windpicker-owo
8539bc2b08 修复enable配置 2025-08-28 21:13:54 +08:00
Windpicker-owo
8c660934d0 Merge branch 'master' of https://github.com/MoFox-Studio/MoFox_Bot 2025-08-28 21:05:17 +08:00
tt-P607
01c2089982 Merge branch 'master' of https://github.com/MoFox-Studio/MoFox_Bot 2025-08-28 21:04:36 +08:00
tt-P607
ad3e6763e1 Merge branch 'master' of https://github.com/MoFox-Studio/MoFox_Bot 2025-08-28 21:04:05 +08:00
minecraft1024a
9cf6cc4910 docs:新增了一份部署指南但是暂时不完整,等我们的文档仓库生出来再说 2025-08-28 21:03:52 +08:00
tt-P607
3d958b9e05 feat(maizone): 引入持久化回复跟踪以避免重复回复
引入 `ReplyTrackerService` 来持久化跟踪已回复的评论,确保即使在程序重启后也不会对同一评论进行重复回复。

主要变更:
- 新增 `ReplyTrackerService`,用于记录和管理对特定说说下评论的回复状态。
- 在 `QZoneService` 中重构评论回复逻辑,利用 `ReplyTrackerService` 来判断评论是否已被回复。
- 增加逻辑以验证和清理无效的回复记录,例如当用户手动删除了机器人的回复后,程序能够识别并清除相应的记录,从而可以重新进行回复。
- 将 `ReplyTrackerService` 注册为全局服务,以便在插件内部共享。
2025-08-28 21:02:33 +08:00
minecraft1024a
78e78e71ba docs: 更新模型配置指南
- 新增 `gemini` 客户端类型
- 更新 Google API 的 `base_url`
- 移除 `extra_params` 对 `gemini` 客户端的无效说明
- 新增 `anti_truncation` 参数说明
- 增加多个新的模型任务配置示例
- 将文档中的 `MaiBot` 统一为 `MoFox_Bot
2025-08-28 20:47:49 +08:00
minecraft1024a
add68fcf58 docs: remove outdated and unused documentation files
A significant number of documentation files, including design documents, user guides, and old images, have been removed to clean up the repository and eliminate outdated information. This reduces clutter and ensures that the documentation accurately reflects the current state of the project.

Key removals include:
- `memory_system_design_v3.md`
- `model_configuration_guide.md`
- `PERMISSION_SYSTEM.md`
- `CONTRIBUTE.md`
- `vector_db_usage_guide.md
2025-08-28 20:41:44 +08:00
minecraft1024a
77bad4891d docs(plugins): remove outdated tool documentation
Removes the `tool-components.md` and `tool_caching_guide.md` files as they are no longer relevant after recent refactoring of the tool and caching systems. This cleanup ensures the documentation stays current with the codebase.
2025-08-28 20:21:53 +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
minecraft1024a
f7f39431f5 Merge branch 'master' of https://github.com/MoFox-Studio/MoFox_Bot 2025-08-28 19:57:24 +08:00
minecraft1024a
1b86fff855 feat(llm):为LLM请求实现模型故障转移机制
重构了LLM请求执行逻辑,以引入一个健壮的模型故障转移和回退系统。这通过在当前模型失败时自动切换到下一个可用模型,增强了服务的可靠性。

- 引入 `_model_scheduler` 以按顺序迭代任务配置的模型列表。
- 当模型请求因API错误、认证问题或超时等原因失败时,系统现在会自动使用列表中的下一个模型重试该请求。
- 移除了先前针对空回复或截断响应的内部重试逻辑。这类响应现在被视为特定模型尝试的最终失败,不会触发故障转移。
2025-08-28 19:56:59 +08:00
Windpicker-owo
b3176fea40 修复event权限,现在每个component都拥有plugin_name属性 2025-08-28 19:52:08 +08:00
tt-P607
4b6542b8e0 Merge branch 'master' of https://github.com/MoFox-Studio/MoFox_Bot 2025-08-28 19:24:22 +08:00
Windpicker-owo
593cf7f32a Merge origin/master into windpicker-adapter branch 2025-08-28 19:21:37 +08:00
tt-P607
72a3be5b26 refactor(maizone): 优化说说评论回复逻辑
重构了处理和回复评论的算法,以提高准确性和代码清晰度。

主要变更:
- 在获取说说列表时引入 `is_monitoring_own_feeds` 参数,以区分处理自己和好友的说说,避免跳过对自己说说的评论检查。
- 优化了评论回复逻辑,通过将评论区分为用户评论和自己的回复,更精确地识别未回复的评论,防止了之前可能出现的重复回复或漏回复的问题。
2025-08-28 19:19:53 +08:00
Windpicker-owo
d152e59c70 删除过时的代码 2025-08-28 19:04:03 +08:00
minecraft1024a
7bd1320504 Merge branch 'master' of https://github.com/MoFox-Studio/MoFox_Bot 2025-08-28 18:42:37 +08:00
minecraft1024a
7ba3b7f34d refactor(core): remove tool history manager and integrate cache into tool executor
Removes the `ToolHistoryManager` and its associated functionalities, including history recording, querying, and prompt generation. This simplifies the architecture by decoupling tool execution history from the core logic.

The tool caching mechanism is now directly integrated into the `ToolExecutor` by wrapping the `execute_tool_call` method. This ensures that caching is applied consistently for all tool executions that have it enabled, improving performance and reducing redundant calls.

- Deletes `src/common/tool_history.py`.
- Removes tool history related functions from `prompt_builder.py` and `tool_api.py`.
- Adds a `wrap_tool_executor` function in `cache_manager.py` to apply caching logic directly to the `ToolExecutor`.
2025-08-28 18:42:17 +08:00
雅诺狐
b28116e17b 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-08-28 18:42:04 +08:00