tt-P607 87b1d5aec4 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-11-19 23:22:27 +08:00
2025-11-19 23:21:54 +08:00
2025-11-19 23:22:24 +08:00
2025-11-19 23:13:20 +08:00
2025-07-09 17:48:00 +08:00
2025-11-19 23:22:12 +08:00
2025-02-28 00:49:47 +08:00
2025-11-19 22:54:09 +08:00
2025-11-19 23:22:21 +08:00
2025-11-19 23:22:23 +08:00
2025-11-19 23:19:12 +08:00
2025-11-19 23:22:12 +08:00

🌟 MoFox_Bot

🚀 基于 MaiCore 的增强型 AI 智能体,功能更强大,体验更流畅

License Python 3.11+ Pyright Ruff Ask DeepWiki
QQ Group QQ Group


📖 项目简介

MoFox_Bot 是一个基于 MaiCore 0.10.0 snapshot.5 的增强型 fork 项目。我们保留了原项目几乎所有核心功能,并在此基础上进行了深度优化与功能扩展,致力于打造一个更稳定、更智能、更具趣味性的 AI 智能体。

Important

第三方项目声明

本项目由 MoFox Studio 独立维护,为 MaiBot 的第三方分支,并非官方版本。所有更新与支持均由我们团队负责,与 MaiBot 官方无直接关系。

Warning

迁移风险提示

由于我们对数据库结构进行了重构与优化,从官方 MaiBot 直接迁移至 MoFox_Bot 可能导致数据不兼容。请在迁移前务必备份原始数据,以避免信息丢失。


核心功能

🔧 原版功能(全部保留)

  • 🧠 智能对话系统 - 基于 LLM 的自然语言交互,支持 normal 和 focus 统一化处理
  • 🔌 强大插件系统 - 全面重构的插件架构,支持完整的管理 API 和权限控制
  • 💭 实时思维系统 - 模拟人类思考过程
  • 📚 表达学习功能 - 学习群友的说话风格和表达方式
  • 😊 情感表达系统 - 情绪系统和表情包系统
  • 🧠 持久记忆系统 - 基于图的长期记忆存储
  • 🎭 动态人格系统 - 自适应的性格特征和表达方式
  • 📊 数据分析 - 内置数据统计和分析功能,更好了解麦麦状态

🚀 拓展功能

  • 🔄 数据库切换 - 支持 SQLite 与 MySQL 自由切换,采用 SQLAlchemy 2.0 重新构建
  • 🛡️ 反注入集成 - 内置一整套回复前注入过滤系统,为人格保驾护航
  • 🎥 视频分析 - 支持多种视频识别模式,拓展原版视觉
  • 😴 苏醒系统 - 能够睡觉、失眠、被吵醒,更具乐趣
  • 📅 日程系统 - 让墨狐规划每一天
  • 🧠 拓展记忆系统 - 支持瞬时记忆等多种记忆
  • 🎪 完善的 Event - 支持动态事件注册和处理器订阅,并实现了聚合结果管理
  • 🔍 内嵌魔改插件 - 内置联网搜索等诸多功能,等你来探索
  • 🌟 还有更多 - 请参阅详细修改 commits

🔧 系统要求

💻 基础环境

项目 要求
🖥️ 操作系统 Windows 10/11、macOS 10.14+、Linux (Ubuntu 18.04+)
🐍 Python 版本 Python 3.10 或更高版本
💾 内存 建议 ≥ 4GB 可用内存
💿 存储空间 建议 ≥ 2GB 可用空间

🛠️ 依赖服务

服务 描述
🤖 QQ 协议端 NapCatQQ 或其他兼容协议端
🗃️ 数据库 SQLite默认或 MySQL可选
🔧 管理工具 Chat2DB可选用于数据库可视化管理

🏁 快速开始

📦 安装与部署

Note

详细安装与配置指南请参考官方文档:

⚙️ 配置要点

  1. 📝 核心配置:编辑 config/bot_config.toml,设置 LLM API Key、Bot 名称等基础参数。
  2. 🤖 协议端配置:确保使用 NapCatQQ 或兼容协议端,建立稳定通信。
  3. 🗃️ 数据库配置:选择 SQLite默认或配置 MySQL 数据库连接。
  4. 🔌 插件配置:在 config/plugins/ 目录中启用或配置所需插件。

🙏 致谢

我们衷心感谢以下开源项目为本项目提供的坚实基础:

项目 描述 贡献
🎯 MaiM-with-u/MaiBot 原版 MaiBot 框架 提供核心架构与设计
🐱 NapNeko/NapCatQQ 高性能 QQ 协议端 实现稳定通信
🌌 internetsb/Maizone 魔改空间插件 功能借鉴与启发

⚠️ 重要提示

Caution

请务必阅读以下内容:

  • 本项目使用前,请仔细阅读并同意 用户协议 (EULA.md)
  • 本应用生成的内容由 AI 大模型提供,请谨慎甄别其准确性。
  • 请勿将 AI 生成内容用于任何违法、违规或不当用途。
  • 所有 AI 输出不代表 MoFox Studio 的立场或观点。

📄 开源协议

本项目基于 GPL-3.0 协议开源。

GPL-3.0

                                   Copyright © 2025 MoFox Studio
                            Licensed under the GNU General Public License v3.0

🌟 如果这个项目对你有帮助,请给我们一个 Star

💬 有任何问题或建议?欢迎提交 Issue 或 Pull Request

💬 点击加入 QQ 交流群

Made with ❤️ by MoFox Studio

Description
No description provided
Readme GPL-3.0 73 MiB
Languages
Python 97.2%
HTML 1.7%
JavaScript 0.9%
CSS 0.2%