雅诺狐
58f775fbdd
Merge branch 'master' of https://github.com/MoFox-Studio/MoFox_Bot
2025-08-28 18:36:11 +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
Windpicker-owo
1b5ee249a5
Merge branch 'master' of https://github.com/MoFox-Studio/MoFox_Bot
2025-08-28 18:25:37 +08:00
Windpicker-owo
2e2fd90497
feat(plugin-system): 添加事件触发和订阅的白名单机制
...
为事件系统添加权限控制功能,包括:
- 在BaseEvent中新增allowed_subscribers和allowed_triggers白名单字段
- 事件管理器触发和订阅时进行白名单验证
- 为所有系统默认事件设置仅允许SYSTEM插件触发
- 在所有事件触发调用处显式传递plugin_name="SYSTEM"参数
确保只有授权插件可以触发特定事件和订阅处理器,增强系统安全性。
2025-08-28 18:25:33 +08:00
minecraft1024a
5153d8f60f
Merge branch 'master' of https://github.com/MoFox-Studio/MoFox_Bot
2025-08-28 17:59:46 +08:00
minecraft1024a
41e862281d
替换名字
2025-08-28 17:58:08 +08:00
Windpicker-owo
42a8c091ec
Merge branch 'master' of https://github.com/MoFox-Studio/MoFox_Bot
2025-08-28 17:18:05 +08:00
Windpicker-owo
786a830da5
fix(plugin): 为事件处理器添加异步锁和并行执行支持
...
在BaseEvent类中引入asyncio.Lock确保同一个事件不能同时激活多次
重构事件触发逻辑,使用asyncio.gather并行执行所有订阅者处理器
提高事件处理效率的同时保证线程安全
2025-08-28 17:18:01 +08:00
tt-P607
f42b4adaab
哈哈哈哈哈,中,太中咧!!!一把出分啊各位一把出分!没有虫啊没有bug!直接就能回复自己说说下的评论了 😋 爽!
2025-08-28 17:13:24 +08:00
Windpicker-owo
935a82fa58
引入lock防止同一个事件同时触发
2025-08-28 16:57:25 +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
雅诺狐
c1a219b5bd
Merge branch 'master' of https://github.com/MoFox-Studio/MoFox_Bot
2025-08-28 13:00:36 +08:00
雅诺狐
f320d1f576
更新示例
2025-08-28 13:00:32 +08:00
tt-P607
829ff4cd4f
feat(sleep): 实现睡眠唤醒与重新入睡机制
...
引入了更完善的睡眠唤醒和重新入睡逻辑,以处理在睡眠期间被消息打扰的情况。
- **唤醒机制**: 当在睡眠时间内收到消息并达到唤醒阈值时,角色会被唤醒并进入愤怒状态。唤醒后,将保持清醒状态处理消息,而不是立即重新入睡。
- **状态持久化**: 新增 `_is_woken_up` 状态到 `schedule_manager`,并将其持久化,以确保在重启后能记住唤醒状态。
- **重新入睡**: 如果角色被吵醒后,在配置的一段时间内(`re_sleep_delay_minutes`)没有收到新消息,系统将自动尝试重新进入睡眠状态,以模拟更自然的行为。
- **上下文同步**: 在唤醒时,`wakeup_manager` 会通知 `schedule_manager` 更新其内部状态,确保系统各模块之间的睡眠状态一致。
2025-08-28 08:48:19 +08:00
tt-P607
910b0db5d2
feat(core): 实现HFC及睡眠状态的持久化
...
将HFC上下文、唤醒管理器和日程管理器的核心状态保存到本地存储,并在程序启动时加载。这确保了角色的能量、睡眠压力、唤醒度、失眠状态和弹性睡眠进度在重启后能够恢复,增强了长期运行的连续性和稳定性。
主要变更:
- **HfcContext**: 增加状态的加载与保存逻辑,持久化能量、睡眠压力和失眠状态。
- **WakeupManager**: 增加状态的加载与保存逻辑,持久化唤醒度及愤怒状态。
- **ScheduleManager**: 增加弹性睡眠状态的加载与保存逻辑,持久化“准备入睡”及延迟睡眠的状态。
- **HeartFChatting**: 在主循环中调用保存HFC上下文状态的方法。
- 调整了失眠和唤醒逻辑,以更好地与持久化状态和弹性睡眠机制协同工作。
2025-08-28 02:50:02 +08:00
tt-P607
f34be9728a
feat(schedule): 引入弹性睡眠与睡前通知机制
...
新增了弹性睡眠功能,使AI的入睡行为更加自然。AI现在会根据睡眠压力决定是否延迟入睡,而不是严格按日程表时间立即休眠。
主要更新包括:
- **弹性睡眠逻辑**: 在进入理论睡眠时间时,会有一段5-10分钟的准备缓冲期。如果睡眠压力低于阈值,AI会推迟入睡,以增加互动时间。
- **睡前通知**: 在决定入睡后,AI可以自动向指定群组发送晚安消息。
- **配置选项**: 在配置文件中增加了相关选项,允许用户启用/禁用这些功能,并自定义睡眠压力阈值、最大延迟时间、通知群组和提示词。
- **代码重构**: 对 `is_sleeping` 方法进行了重构,将其拆分为理论睡眠时间判断和核心弹性逻辑,提高了代码的可读性和可维护性。
2025-08-28 00:45:30 +08:00
tt-P607
d072cde01b
fix(config): 为实验性功能配置添加默认值
...
为 `experimental` 配置项设置 `default_factory`,确保在配置文件中未提供该项时,程序能够正常初始化并使用默认配置,避免因缺少配置而引发的启动错误。
2025-08-27 23:31:46 +08:00
tt-P607
099544dd9a
Merge branch 'master' of https://github.com/MoFox-Studio/MoFox_Bot
2025-08-27 23:14:13 +08:00
tt-P607
29e18c2db7
feat(monthly_plan): 增加月度计划数量上限并自动清理
...
style: 优化月度计划相关日志输出
- 在数据库模块中新增物理删除月度计划的函数 `delete_plans_by_ids`
- 在月度计划管理器中引入 `max_plans_per_month` 配置,用于限制每月计划数量
- 当检测到计划数量超出上限时,自动按创建时间删除最旧的计划以维持数量限制
- 优化了标记计划完成和删除计划时的日志记录,使其输出更详细的计划内容
- 调整了检查现有计划时的日志信息,使其更清晰
2025-08-27 23:13:55 +08:00
雅诺狐
963087f778
更新 bot_config_template.toml
2025-08-27 22:45:07 +08:00
tt-P607
35157a1521
某个狐狸又忘记改版本号了
2025-08-27 22:44:26 +08:00
雅诺狐
57c16bae38
Update bot_config_template.toml
2025-08-27 22:24:23 +08:00
雅诺狐
fe22b79c63
Merge branch 'master' of https://github.com/MoFox-Studio/MoFox_Bot
2025-08-27 22:21:44 +08:00
雅诺狐
1d48478e79
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-08-27 22:21:03 +08:00
minecraft1024a
8a8d2ed574
refactor(memory): 重构向量记忆清理逻辑以提高稳定性
...
原有的清理逻辑直接使用 delete 和 where 条件(timestamp: {"$lt": ...})来删除过期记录。然而,ChromaDB 对元数据中复杂的查询操作符(如 $lt)的支持并不可靠。
为确保过期记录能被稳定地清除,本次提交将清理策略修改为更稳健的“获取-过滤-删除”模式:
1. 为向量数据库抽象层新增 `get` 方法,并为 ChromaDB 提供具体实现。
2. 在 `VectorInstantMemoryV2` 中,先获取指定聊天的所有记录。
3. 在应用代码中根据时间戳筛选出过期的记录ID。
4. 最后根据ID列表精确删除过期记录,确保了清理操作的准确性。
2025-08-27 21:40:03 +08:00
minecraft1024a
eb469240d4
feat(expression): 重构表达学习配置,引入基于规则的结构化定义
...
本次更新旨在提高表达学习配置的可读性和灵活性。旧的基于列表的 `expression_learning` 和 `expression_groups` 配置方式难以理解且容易出错。
通过引入新的 `ExpressionRule` Pydantic模型,我们将所有相关设置(如聊天流ID、是否学习、学习强度、共享组等)整合到一个统一的、自描述的结构中。现在,所有规则都在一个新的 `[[expression.rules]]` 表中进行配置,使得逻辑更加清晰和易于维护。
相关模块,如 `ExpressionSelector`,已更新以适配新的配置结构。同时,数据库中的 `Expression` 模型也已更新为现代的 SQLAlchemy 2.0 风格。
BREAKING CHANGE: 表达学习的配置文件格式已完全改变。旧的 `expression_learning` 和 `expression_groups` 配置不再受支持,用户需要根据新的 `bot_config_template.toml` 文件迁移到 `[[expression.rules]]` 格式。
2025-08-27 21:24:12 +08:00
minecraft1024a
17e8755e66
紧急补了一下配置文件
2025-08-27 21:08:38 +08:00
minecraft1024a
0665e67b7d
Merge branch 'master' of https://github.com/MoFox-Studio/MoFox_Bot
2025-08-27 21:02:27 +08:00
minecraft1024a
ecf2df27fa
feat(chat): implement sleep pressure and insomnia system
...
This commit introduces a new sleep pressure and insomnia system to simulate more realistic character behavior.
Key features include:
- **Sleep Pressure**: A new metric that accumulates with each action the bot takes and decreases during scheduled sleep times.
- **Insomnia Mechanic**: When a sleep period begins, the system checks the current sleep pressure. Low pressure can lead to a higher chance of "insomnia," causing the bot to stay awake. There is also a small chance for random insomnia.
- **Insomnia State**: During insomnia, the bot enters a special state for a configurable duration. It can trigger unique proactive thoughts related to being unable to sleep, and its mood is adjusted accordingly.
- **Configuration**: All parameters, such as insomnia probability, duration, and pressure thresholds, are fully configurable.
2025-08-27 21:02:21 +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
826147e0b2
Merge branch 'master' of https://github.com/MoFox-Studio/MoFox_Bot
2025-08-27 19:46: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
tt-P607
44527c50a7
Merge branch 'master' of https://github.com/MoFox-Studio/MoFox_Bot
2025-08-27 19:35:37 +08:00
tt-P607
68e1e1e046
chore(chat): 增加临时表情缓存上限
2025-08-27 19:34:26 +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
27dfc32fdf
Merge branch 'master' of https://github.com/MoFox-Studio/MoFox_Bot
2025-08-27 18:46:37 +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
Furina-1013-create
b4e83c448b
Merge branch 'master' of https://github.com/MoFox-Studio/MoFox_Bot
2025-08-27 18:28:41 +08:00
tt-P607
0a277c656e
fix(chat): 处理截断消息时message为None的情况
...
在 `truncate_message` 函数中,如果传入的 `message` 参数为 `None`,会导致 `len(message)` 抛出 `TypeError`。本次提交增加了对 `None` 值的检查,确保在处理 `None` 时函数能正常返回空字符串,从而提高代码的健壮性。
2025-08-27 18:21:35 +08:00
minecraft1024a
1fd1c76a84
ruff这一块
2025-08-27 18:03:07 +08:00
minecraft1024a
be114223b4
fix(memory_system): 修复即时记忆的 orjson 编码与解码问题
...
`orjson.dumps` 返回 `bytes` 类型,在存入数据库前需要解码为 `str`。
同时,将关键词的反序列化库从标准 `json` 统一为 `orjson`,以保持序列化和反序列化操作的一致性。
2025-08-27 18:01:12 +08:00
minecraft1024a
5076410a00
Reapply "【迁移】工具系统再完善:工具缓存、ttl支持、自动记录、长期保存、自动清理缓存、将记录与执行分离、api记录查询、时间聊天工具筛选查询..."
...
This reverts commit 3d93bc4079 .
2025-08-27 17:58:18 +08:00
Windpicker-owo
c360f016dd
Merge branch 'master' of https://github.com/MoFox-Studio/MoFox_Bot
2025-08-27 17:39:32 +08:00
Windpicker-owo
bbbb9df112
修复空回复检测,同时修复tool_call
2025-08-27 17:39:28 +08:00
Furina-1013-create
9fca087b2c
feat(plugin_system): 增加工具执行日志记录
...
feat(plugin_system): 增加工具执行日志记录
在工具执行前添加一行日志,用于记录正在调用的工具名称和参数,方便调试和追踪。
2025-08-27 17:10:56 +08:00
Windpicker-owo
6c885afe9d
Merge branch 'master' of https://github.com/MoFox-Studio/MoFox_Bot
2025-08-27 12:46:38 +08:00