minecraft1024a
eb4a48d45a
fix(chatter): 修复私聊时获取用户昵称的属性错误
...
在私聊场景下,`plan.target_info` 是一个 `UserInfo` 对象,而不是字典。此前的代码使用字典方式 `get("person_name")` 访问属性,会导致 `AttributeError`。
本次修改将属性访问方式从 `plan.target_info.get("person_name")` 调整为 `plan.target_info.person_name`,以正确获取用户信息。同时,更新了相关注释,阐明了情绪模块的依赖关系,防止因配置关闭而引发错误。
2025-10-19 13:52:28 +08:00
minecraft1024a
73383f8246
refactor(prompt): 优化Prompt组件注入逻辑并简化代码
...
将Prompt组件的注入逻辑从`Prompt.format`方法前置到`PromptManager.get_prompt_async`和`create_prompt_async`中。这使得注入时机更早,逻辑更清晰,并允许在获取Prompt时就能动态传入参数以影响注入内容。
主要变更:
- `PromptManager`: `get_prompt_async`现在负责处理组件注入,并接收可选的`parameters`参数。`format_prompt`相应地传递参数。
- `create_prompt_async`: 现在也支持在创建时进行动态注入。
- `Prompt.format`: 移除了原有的组件注入逻辑,简化了方法实现。
- `PromptComponentManager`: 重构为直接从全局`component_registry`获取组件,移除了自身的注册和存储逻辑,减少了状态管理的复杂性。
- `plan_filter.py`: 删除了大量冗余和重复的代码块,包括主动聊天模式的独立逻辑和旧的历史消息构建方式。
2025-10-19 13:32:49 +08:00
minecraft1024a
50a6c2de58
feat(plugin): 引入Prompt组件系统以实现动态Prompt注入
...
引入了一个新的插件组件类型 `BasePrompt`,允许插件动态地向核心Prompt模板中注入额外的上下文信息。该系统旨在提高Prompt的可扩展性和可定制性,使得开发者可以在不修改核心代码的情况下,通过插件来丰富和调整模型的行为。
主要变更包括:
- **`BasePrompt` 基类**: 定义了Prompt组件的标准接口,包括 `execute` 方法用于生成注入内容,以及 `injection_point` 属性用于指定目标Prompt。
- **`PromptComponentManager`**: 一个新的管理器,负责注册、分类和执行所有 `BasePrompt` 组件。它会在构建核心Prompt时,自动查找并执行相关组件,将其输出拼接到主Prompt内容之前。
- **核心Prompt逻辑更新**: `src.chat.utils.prompt.Prompt` 类现在会调用 `PromptComponentManager` 来获取并注入组件内容。
- **插件系统集成**: `ComponentRegistry` 和 `PluginManager` 已更新,以支持 `BasePrompt` 组件的注册、管理和统计。
- **示例插件更新**: `hello_world_plugin` 中增加了一个 `WeatherPrompt` 示例,演示了如何创建和注册一个新的Prompt组件。
- **代码重构**: 将 `PromptParameters` 类从 `prompt.py` 移动到独立的 `prompt_params.py` 文件中,以改善模块化和解决循环依赖问题。
2025-10-19 13:00:23 +08:00
tt-P607
4f2cb56740
refactor(learning): 在线程池工作函数中实例化LLMRequest
...
将 `LLMRequest` 对象的实例化从 `extract_information` 函数移动到线程池执行的 `extract_info_sync` 函数内部。
此更改确保每个工作线程都有自己独立的 `LLMRequest` 实例,避免了在多线程环境下共享同一实例可能引发的潜在并发问题。
2025-10-18 23:38:03 +08:00
tt-P607
2bb7e51252
feat(knowledge): 新增问答段落相似度阈值
...
为知识库问答中的段落检索增加相似度阈值过滤功能。
此前,即使相似度很低的段落也会被返回,可能导致问答结果不准确。通过新增 `qa_paragraph_threshold` 配置项,可以过滤掉低于设定阈值的段落,从而提高问答的精准度和相关性。
2025-10-18 23:17:24 +08:00
minecraft1024a
22ef271c89
fix(chat): 修复知识库相关性得分格式化问题
...
当知识库返回的相关性得分(relevance)不是有效的浮点数时,格式化字符串 `f"{relevance:.2f}"` 会引发 `TypeError` 或 `ValueError`,导致程序崩溃。
本次修改通过添加 `try-except` 块来捕获潜在的异常。如果 `relevance` 可以成功转换为浮点数,则将其格式化为两位小数;如果转换失败,则直接使用其原始字符串表示形式,从而增强了代码的健壮性,避免了因数据类型不匹配而导致的运行时错误。
2025-10-18 21:57:27 +08:00
minecraft1024a
a2ac0d01bc
Merge branch 'dev' of https://github.com/MoFox-Studio/MoFox_Bot into dev
2025-10-18 21:29:48 +08:00
minecraft1024a
599dc95a99
refactor(knowledge): 简化知识库问答管理器的使用
...
将 `QAManager` 类实例化改为直接导入和使用单例 `qa_manager`,以简化代码并提高效率。同时,移除了对 `get_knowledge` 方法中不再需要的参数,使其调用更加清晰。
2025-10-18 21:29:44 +08:00
明天好像没什么
a6947a95d8
Merge branch 'dev' of https://github.com/MoFox-Studio/MoFox_Bot into dev
2025-10-18 20:58:52 +08:00
明天好像没什么
5c9d7db7fa
ci(docker): 重构CI/CD流程,支持多架构构建与自动推送
...
- 启用push触发,支持master/dev分支及版本标签
- 新增ARM64独立构建任务,使用ubuntu-24.04-arm运行器
- 引入docker/metadata-action自动生成标签,支持分支、标签、semver及sha
- 采用push-by-digest方式分别构建AMD64/ARM64镜像,最后合并多架构manifest
- 移除maim_message与MaiMBot-LPMM子模块克隆步骤,镜像名由maibot改为mofox
- docker-compose同步更新镜像名、容器名及挂载路径,保持与CI一致
2025-10-18 20:58:47 +08:00
tt-P607
d65f6dcefe
chore(scripts): 为学习工具脚本引入并发依赖
2025-10-18 20:21:54 +08:00
明天好像没什么
5f85b5d52c
refactor(docker): 重构容器化配置,移除冗余服务并迁移至 uv 包管理
...
- 精简 Dockerfile:删除 lpmm 编译步骤,改用 pyproject.toml 与 uv sync
- 移除 docker-compose 中的 adapters、sqlite-web 服务,仅保留 core 与 napcat
- 统一工作目录与卷挂载路径,由 /MaiMBot 更名为 /InkFox
- 网络名称由 maim_bot 改为 mofox
- 入口命令切换为 uv run,提升启动速度与依赖隔离
2025-10-18 20:13:01 +08:00
明天好像没什么
92d5b096c8
chore(deps): 精简依赖并升级Python基线至3.11
...
- 移除3.10兼容层,清理旧版本wheel与回退包
- 统一numpy、scipy、networkx为单版本,削减重复解析
- 新增mcp>=0.9.0与sse-starlette>=2.2.1,解锁新能力
- inkfox升至0.1.1,新增arm64/aarch64原生支持
- 通过更严格的平台标记,锁文件体积减少八成
2025-10-18 20:11:17 +08:00
minecraft1024a
c9c2de40ee
chore(scripts): 移除过时的一次性脚本
...
移除了两个用于项目重构的一次性脚本:
- `convert_sqlalchemy_models.py`:用于将 SQLAlchemy 模型从旧版 `Column` 语法转换为 `Mapped` 语法。
- `update_prompt_imports.py`:用于批量更新 `Prompt` 类的导入路径。
这些脚本已完成其历史使命,不再需要维护。
同时,对插件加载日志和 manifest 转换脚本进行了小幅改进:
- 插件加载日志现在会显示组件的简短描述,方便快速了解其功能。
- manifest 转换脚本增加了对更多元数据字段(如仓库地址、关键字、分类等)的支持。
2025-10-18 19:22:34 +08:00
tt-P607
e702480411
Merge branch 'dev' of https://github.com/MoFox-Studio/MoFox_Bot into dev
2025-10-18 17:09:35 +08:00
tt-P607
373db77768
Revert "总之就是知识库"
...
This reverts commit 0383a999fb .
2025-10-18 17:09:18 +08:00
LuiKlee
bafddb39e8
调整格式
2025-10-18 12:08:21 +08:00
minecraft1024a
efded9b03a
Merge branch 'dev' of https://github.com/MoFox-Studio/MoFox_Bot into dev
2025-10-18 11:13:54 +08:00
minecraft1024a
8c97774465
ruff ci
2025-10-18 11:11:05 +08:00
tt-P607
72ea362e29
feat(web_search): 新增 Metaso 搜索引擎支持
...
为联网搜索工具集成了新的搜索引擎 Metaso,为用户提供更多搜索选择。
- 在搜索引擎基类 `BaseSearchEngine` 中添加了可选的 `read_url` 方法,为未来支持直接读取网页内容奠定基础。
- 更新了插件加载、工具执行逻辑和配置文件模板,以完整支持 Metaso 引擎。
- 将默认回复生成器的任务超时时间从 15 秒延长至 45 秒,以适应联网搜索等耗时较长的操作,提高稳定性。
2025-10-18 00:46:17 +08:00
minecraft1024a
39e672a1d5
docs: 更新 README.md 中的功能描述和 admonition 语法
...
- 将 admonition 语法从 `[!docs: 更新 README.md 功能描述和 admonition 语法
- 将 admonition 语法从 `[!IMPORTANT]` 和 `[!WARNING]` 调整为 GitHub 支持的 `[IMPORTANT]` 和 `[WARNING]` 格式。
- 在“拓展功能”部分新增了“AFC 智能对话”特性。
- 移除了“原版功能”中重复列出的“智能对话系统”条目,使其更加清晰。
2025-10-17 21:25:26 +08:00
minecraft1024a
afeac77d1c
docs(config): 更新配置文件注释说明
...
将配置类继承说明从“重要的”改为“所有”,以强调所有配置类都必须继承自 `ValidatedConfigBase`。
2025-10-17 21:20:43 +08:00
minecraft1024a
8c17a22947
现在不是空盒子了
2025-10-17 21:15:12 +08:00
minecraft1024a
7c4af00b62
fix(server): 移除启动日志中多余的协议前缀
2025-10-17 21:07:34 +08:00
minecraft1024a
fb1e4ff110
Merge branch 'dev' of https://github.com/MoFox-Studio/MoFox_Bot into dev
2025-10-17 20:25:47 +08:00
minecraft1024a
0b5a536855
chore(scripts): 移除无用的脚本文件
...
删除了两个已不再需要的脚本:
- `run_multi_stage_smoke.py`: 用于早期烟雾测试,现已过时。
- `text_length_analysis.py`: 用于分析数据库中的消息文本长度,功能已不再需要。
feat(scripts):为来自MaiBot的插件提供了转换插件的 _manifest.json 文件的脚本
2025-10-17 20:25:44 +08:00
Windpicker-owo
6eb6bab4df
Merge branch 'dev' of https://github.com/MoFox-Studio/MoFox_Bot into dev
2025-10-17 20:16:27 +08:00
Windpicker-owo
f22e6365cc
feat(action): 重构 Action 激活机制并添加 go_activate() 方法
...
引入新的 Action 激活机制,允许通过重写 go_activate() 方法来自定义激活逻辑。提供了三个工具函数:
- _random_activation(): 随机概率激活
- _keyword_match(): 关键词匹配激活
- _llm_judge_activation(): LLM 智能判断激活
主要变更:
- 在 BaseAction 中添加 go_activate() 抽象方法和相关工具函数
- 更新 ActionModifier 使用新的激活判断逻辑
- 在 hello_world_plugin 中添加新的激活方式示例
- 更新文档说明新的激活机制
- 保持向后兼容,旧的激活类型配置仍然可用
BREAKING CHANGE: Action 激活判断现在通过 go_activate() 方法进行,旧的激活类型字段已标记为废弃但仍然兼容
2025-10-17 20:16:15 +08:00
minecraft1024a
9e39d28e80
fix(chat): 修复睡眠和情绪系统中的空值和逻辑问题
...
修复了两个问题:
1. 在睡眠状态下,如果没有设置起床时间,且当天也无法从日程中获取新的起床时间,程序会错误地继续执行后续的唤醒判断逻辑,而不是直接返回并继续睡眠。
2. 在更新情绪状态时,如果消息的`interest_value`为`None`,会导致类型错误。已增加空值检查,将其默认处理为 0.0。
2025-10-17 20:04:12 +08:00
minecraft1024a
02a54fd3c9
feat(chat): 引入睡眠系统,在睡眠状态下拦截消息
...
在消息处理的最前端 (`MessageManager`) 增加了对睡眠状态的检查。当系统处于 `SLEEPING` 状态时,将直接拦截所有新消息,不再进行后续处理。
同时,为了配合睡眠系统的正常运作:
- 将睡眠系统的定时任务初始化移至 `main.py`,确保其在应用启动时正确加载。
- 在主动思维插件 (`proactive_thinker`) 的定时任务(冷启动和日常唤醒)中增加了睡眠状态检查,避免在睡眠期间触发主动行为。
2025-10-17 19:55:11 +08:00
minecraft1024a
1eade97633
refactor(config): 简化睡眠系统配置项
...
移除旧的、基于睡眠压力模型的多个配置项,包括睡眠压力阈值、失眠概率(区分不同压力)、压力增减值等。
这些配置项在新系统中已不再使用,将其移除可以简化配置文件,避免引起混淆。现在的睡眠逻辑更加直接,不再依赖复杂的压力计算。
2025-10-17 19:04:52 +08:00
minecraft1024a
559ad03fe0
refactor(chat): 从 MessageManager 中移除睡眠和唤醒管理器的残留代码
...
在之前的提交 (cb51446 ) 中,睡眠管理器模块已被移除。本次提交清除了 `MessageManager` 中与之相关的残留代码,包括导入语句、实例初始化以及启动/停止逻辑,完成了整个重构过程。
2025-10-17 19:02:49 +08:00
minecraft1024a
cb514465a2
refactor(chat): 移除旧的睡眠管理器模块
...
删除了位于 `src/chat/message_manager/sleep_manager/` 目录下的整个旧版睡眠管理器。该模块包含了 `sleep_manager`, `wakeup_manager`, `sleep_state` 等多个文件,其功能将被新的实现所取代。
同时,对 `context_manager.py` 中的群聊判断逻辑进行了微调,以适应新的消息结构。
2025-10-17 18:57:59 +08:00
minecraft1024a
ff3b35a5d3
Revert "实现了新的睡眠系统喵~",我看了不如我回去自己写一个()
...
This reverts commit e1dde64fc6 .
2025-10-17 18:44:38 +08:00
tt-P607
ce3fe95b37
refactor(core): make chat utils async and decouple plugin dependencies
...
- Convert `get_recent_group_speaker` and `count_messages_between` in `chat/utils` to async functions to align with underlying asynchronous database calls, preventing potential blocking issues.
- Implement optional import for `sleep_system` within the `affinity_flow_chatter` plugin using a try-except block. This decouples the hard dependency between the two plugins, enhancing modularity and ensuring the chatter plugin remains operational even if the sleep system is unavailable.
2025-10-17 14:44:33 +08:00
tt-P607
d3b38f49b4
Merge branch 'dev' of https://github.com/MoFox-Studio/MoFox_Bot into dev
2025-10-17 14:21:42 +08:00
tt-P607
c51d72b945
feat(chat): add protection for quoted content in response processing
...
In the LLM response post-processing flow, a new protection layer for quoted content has been added. This prevents the sentence splitter from incorrectly breaking up complete sentences enclosed in quotation marks, thus ensuring the integrity of the quoted text.
- Adds `protect_quoted_content` and `recover_quoted_content` functions.
- Upgrades the response processing to a three-layer protection system (kaomoji, quotes, special blocks).
- Also adjusts the default values for typing simulation time to improve user experience.
2025-10-17 14:21:32 +08:00
ikun-11451
e68b805cfb
修复了导入错误喵......
2025-10-17 12:05:28 +08:00
tt-P607
aa35581cbc
Merge branch 'dev' of https://github.com/MoFox-Studio/MoFox_Bot into dev
2025-10-17 02:34:51 +08:00
tt-P607
1f26238368
refactor(chat): overhaul response processing for robustness and integrity
...
This commit redesigns the LLM response handling pipeline to gracefully manage complex, long, and structured outputs, shifting from a restrictive filtering model to a more resilient and content-aware approach.
The previous implementation suffered from brittleness, often discarding valid responses or corrupting formatted content. This refactor introduces two core changes to ensure response integrity:
1. **Adaptive Message Merging:** Replaces the rigid message count and length limits, which caused the silent dropping of valid long-form answers. The new logic dynamically merges the shortest adjacent sentences if a response is overly fragmented, ensuring the full thought is preserved while adhering to display limits.
2. **Content-Aware Pre-processing:** Implements a protection mechanism for special text formats. It now identifies and isolates Markdown code blocks, LaTeX-style math equations, and other code-like segments using placeholders before splitting or typo generation. This prevents formatting corruption and ensures technical content is rendered correctly.
Additionally, the LLM prompt for splitting has been refined to emphasize logical coherence over simple fragmentation.
Finally, this commit also hardens the `LLMRequest` class against race conditions by adding an `asyncio.Lock` to serialize generation requests, improving the system's stability under concurrent workloads.
2025-10-17 02:34:39 +08:00
ikun-11451
f57d0f3213
Merge branch 'dev' of https://github.com/MoFox-Studio/MoFox_Bot into dev
2025-10-17 01:48:06 +08:00
ikun-11451
e1dde64fc6
实现了新的睡眠系统喵~
2025-10-17 01:47:43 +08:00
tt-P607
514da0b56f
Merge branch 'dev' of https://github.com/MoFox-Studio/MoFox_Bot into dev
2025-10-17 01:09:36 +08:00
tt-P607
59e94ea7aa
嗯,llm分割提示词优化一下
2025-10-17 01:09:08 +08:00
LuiKlee
bfbba6879c
修复格式问题
...
修改613行的标点
如果功能异常,请提交报告
2025-10-16 20:28:15 +08:00
LuiKlee
bd864b43ab
Update README.md
2025-10-15 23:39:59 +08:00
LuiKlee
7601f881fc
Update README.md
2025-10-15 23:34:29 +08:00
LuiKlee
f587565502
调整
2025-10-15 23:33:06 +08:00
LuiKlee
ea95d56177
调整排版
2025-10-15 23:28:45 +08:00
ikun两年半
21e4f7f659
更正依赖名字喵~
2025-10-13 17:43:40 +08:00