Commit Graph

421 Commits

Author SHA1 Message Date
tt-P607
17bbff8066 refactor(bot): 统一关闭逻辑到finally块
将优雅关闭(graceful_shutdown)的调用逻辑从`KeyboardInterrupt`异常处理块移动到`finally`块中。

这确保了无论程序是正常退出、收到中断信号,还是发生其他任何异常,都会尝试执行统一的、可靠的清理和关闭流程,从而增强了程序的健壮性。
2025-08-20 10:33:28 +08:00
ikun-11451
99970f9e58 发现了乱改版本号会导致插件爆炸的猫猫喵~ 2025-08-20 03:14:55 +08:00
ikun-11451
473e7b3f28 修改了版本号喵~ 2025-08-20 03:10:15 +08:00
雅诺狐
0e761a5ea2 配置未和主框架耦合,移动到外部插件目录 2025-08-20 00:09:50 +08:00
tt-P607
9e160874d1 refactor(maizone_refactored): 优化Cookie服务中备用HTTP获取逻辑
将获取Cookie的HTTP请求从GET改为POST,并增加domain参数,以适配更可靠的实现。同时,增强了对返回数据的解析和校验逻辑,确保能正确处理并转换Cookie字符串格式,提高了服务的健壮性和兼容性。
2025-08-19 23:14:02 +08:00
Furina-1013-create
4681ea0b6d Merge branch 'master' of https://github.com/MaiBot-Plus/MaiMbot-Pro-Max 2025-08-19 22:15:45 +08:00
Furina-1013-create
f835dcb5e2 改进focus模式下的回复逻辑,理论上现在focus模式下在bot被@ / 提及 时应该会回复了
采用的是在focus模式下移除no_reply动作的方式
同步更新bot_config_template里面的注释
2025-08-19 22:15:13 +08:00
minecraft1024a
dcd7abc109 refactor(video): update config key from utils_video to video_analysis 2025-08-19 21:40:59 +08:00
minecraft1024a
7a9845b8a4 refactor(antipromptinjector): 将每次输入都记录的 info 级别调至 debug
避免大量冗余信息在常规日志级别输出,保持日志整洁
2025-08-19 21:18:56 +08:00
minecraft1024a
3bef6f4bab fix(embedding): 彻底解决事件循环冲突导致的嵌入生成异常
通过以下改动修复嵌入生成过程中的事件循环相关问题:
- 在 EmbeddingStore._get_embedding 中,改为同步创建-使用-销毁的新事件循环模式,彻底避免嵌套事件循环问题
- 调整批量嵌入 _get_embeddings_batch_threaded,确保每个线程使用独立、短生命周期的事件循环
- 新增 force_new 参数,LLM 请求嵌入任务时强制创建新的客户端实例,减少跨循环对象复用
- 在 OpenAI 客户端的 embedding 调用处补充详细日志,方便排查网络连接异常
- get_embedding() 每次都重建 LLMRequest,降低实例在多个事件循环中穿梭的概率

此次改动虽然以同步风格“硬掰”异步接口,但对现有接口零破坏,确保了向量数据库及相关知识检索功能的稳定性。(还有就是把的脚本文件夹移回来了)
2025-08-19 20:41:00 +08:00
minecraft1024a
f3b5836eee feat(maizone_refactored): 在生成说说时融入当前时间信息
在生成说说的提示词中加入了当前的具体时间(年/月/日 时:分)和星期信息。同时,引导模型在生成内容时可以自然地提及当前时间,使得生成的说说更具时效性和真实感,更贴近用户发布那一刻的情境。
2025-08-19 20:30:09 +08:00
minecraft1024a
3a4020fd8d Merge branch 'master' of https://github.com/MaiBot-Plus/MaiMbot-Pro-Max 2025-08-19 20:19:59 +08:00
minecraft1024a
9149407370 fix(cache): 兼容元组形式的 embedding_result
get_embedding 方法的返回值可能是一个包含向量和模型名称的元组
2025-08-19 20:19:51 +08:00
雅诺狐
586dc6cda3 Merge branch 'master' of https://github.com/MaiBot-Plus/MaiMbot-Pro-Max 2025-08-19 20:17:36 +08:00
雅诺狐
d25c6ab452 修复了专注错误
Updated logic in heartFC_chat.py and relationship_manager.py to prioritize 'chat_info_platform', then 'user_platform', and finally a default when determining platform information. Added a fallback to 'unknown' in get_person_id if platform is None, improving robustness when platform data is missing.

Co-Authored-By: tt-P607 <68868379+tt-P607@users.noreply.github.com>
2025-08-19 20:17:32 +08:00
minecraft1024a
0364c38152 refactor(memory): 移除混合记忆模型,全面转向向量化瞬时记忆
删除了 `HybridInstantMemory` 模块及其复杂的策略判断、同步和检索逻辑。此举旨在简化记忆系统的架构,统一采用 `VectorInstantMemoryV2` 作为唯一的瞬时记忆解决方案。(虽然我也不知道效果好不好反正先转了再说,因为基于大模型的瞬时记忆有那么一点点慢)
2025-08-19 20:15:42 +08:00
minecraft1024a
f2c46d0d1d refactor(memory): 重构瞬时记忆为全量向量化存储模型
新系统采用“全量存储,定时清理”的设计理念,将所有聊天消息向量化并存入ChromaDB。通过后台线程定时清理过期消息,取代了之前基于“重要性模式”判断是否记忆的复杂逻辑。

主要变更:
- **全量存储**: 不再进行前置判断,所有消息均被向量化存储,简化了记忆创建流程。
- **定时清理**: 引入基于`threading`的后台任务,根据设定的`retention_hours`自动清理过期记忆,确保系统轻量高效。
- **简化检索**: 检索逻辑更新为直接查询相似消息,并增加了相似度阈值过滤和时间差格式化,提高了上下文的准确性和可读性。

在 `DefaultReplyer` 中,已切换至新的 `HybridInstantMemory`(其底层实现为V2),并优化了记忆上下文的构建逻辑,使其能更稳定地处理不同类型的记忆返回结果。
2025-08-19 19:56:56 +08:00
minecraft1024a
e5ebd6879d Merge branch 'master' of https://github.com/MaiBot-Plus/MaiMbot-Pro-Max 2025-08-19 18:48:17 +08:00
minecraft1024a
ac542f1e71 feat(memory): 引入基于向量的瞬时记忆系统
用基于 ChromaDB 和向量相似度的新瞬时记忆系统取代了原有的实现。此更改旨在提高记忆创建和检索的准确性和相关性。

主要变更:
- **向量化重要性判断**: 放弃了原有的 LLM 判断方法,通过将聊天记录与预定义的“重要性模式”进行向量相似度比较,来决定是否创建记忆。
- **高效去重**: 在存储新记忆之前,通过向量相似度检查,有效避免了内容重复。
- **精准检索**: 利用向量搜索,根据用户当前输入检索最相关的记忆,提高了上下文的连贯性。
- **双重存储**: 为了保持系统兼容性,记忆同时存储在 ChromaDB 向量数据库和现有的 SQLAlchemy 数据库中。
- **代码集成**: 在 `DefaultReplyer` 中将 `InstantMemory` 的实现切换为新的 `VectorInstantMemory`。
2025-08-19 18:48:10 +08:00
雅诺狐
d6f762865c Add aiohttp_gemini client type and update TaskConfig defaults
Added 'aiohttp_gemini' to allowed client types in APIProvider. Updated TaskConfig defaults: max_tokens to 800, temperature to 0.7, and concurrency_count to 1 for improved default behavior.
2025-08-19 18:42:33 +08:00
雅诺狐
8435c02cf0 修复硬编码错误 2025-08-19 18:03:31 +08:00
雅诺狐
3dfb138d2c 修复硬编码错误 2025-08-19 18:00:41 +08:00
tt-P607
d1efa3b5c1 Merge branch 'master' of https://github.com/MaiBot-Plus/MaiMbot-Pro-Max 2025-08-19 17:44:43 +08:00
tt-P607
7dabc4273d 修复AttributeError异常**:
- 在ChatConfig中添加get_current_talk_frequency()方法
   - 在ExpressionConfig中添加get_expression_config_for_chat()方法,但是模型配置文件依旧被架空力😭😭😭我解决不了,帮帮我!雅诺狐姐姐!😭😭😭
2025-08-19 17:35:47 +08:00
雅诺狐
7d4951be8c Merge branch 'master' of https://github.com/MaiBot-Plus/MaiMbot-Pro-Max 2025-08-19 16:39:26 +08:00
雅诺狐
71c7d8fc67 Add time and stream-based config for chat and expression
Introduces methods to dynamically determine talk frequency and expression learning settings based on current time and chat stream ID. Adds helper functions for parsing stream config strings, handling both global and stream-specific overrides for chat and expression configurations.
2025-08-19 16:39:17 +08:00
tt-P607
c140d30e44 修复qzone_service.py中缺失的pathlib.Path导入导致的无法查找到路径问题,还有host和端口的一些修改👀总之就是又混到提交了😋 2025-08-19 16:18:12 +08:00
雅诺狐
7a9ebfc86b Merge branch 'master' of https://github.com/MaiBot-Plus/MaiMbot-Pro-Max 2025-08-19 15:35:11 +08:00
雅诺狐
1405b50d5a Refactor config system to use Pydantic validation
Refactored configuration classes to inherit from a new ValidatedConfigBase using Pydantic for robust validation and error reporting. Updated api_ada_configs.py, config.py, config_base.py, and official_configs.py to replace dataclasses with Pydantic models, add field validation, and improve error messages. This change enhances configuration reliability and developer feedback for misconfigurations. Also includes minor code cleanups and removal of unused variables in other modules.
2025-08-19 15:33:43 +08:00
tt-P607
84b563b930 修复了空间插件监控好友空间失败的问题 2025-08-19 14:42:47 +08:00
minecraft1024a
a0ed9dae9c 删除全新三层记忆系统架构 (V2.0) 设计文档,简化文档结构以便于后续更新和维护。 2025-08-19 14:08:31 +08:00
minecraft1024a
2af415da0e refactor(chat): 调整消息选择的优先级
在确定 `action_message` 时,优先使用 `target_message` 而不是 `message_data`。

这一变更优化了消息处理流程,确保在存在明确的目标消息时,系统能够正确地选择它,从而避免了潜在的逻辑冲突,使行为更加符合预期。

Co-authored-by: 雅诺狐 <212194964+foxcyber907@users.noreply.github.com>
Co-authored-by: tt-P607 <68868379+tt-P607@users.noreply.github.com>
2025-08-19 13:03:46 +08:00
minecraft1024a
717b7e783f ~~哎呀,主人,你又在乱改代码了。这次的修改还真是……微妙呢。算了,看在你这么努力的份上,本小姐就帮你写个像样点的 commit message 吧。拿去用,不谢。~~
refactor(easter_egg): 简化彩蛋实现并移除未使用的选项

- 移除了 `bot.py` 中 `easter_egg` 函数内的加权随机选择逻辑,现在固定显示一个彩蛋。
- 删除了两个未被使用的彩蛋文本。
- 在 `src/main.py` 中为 `zip` 函数调用添加了 `strict=True` 参数,以增强代码的健壮性,确保彩蛋文本和权重列表长度严格匹配。
2025-08-19 12:33:01 +08:00
ikun两年半
1efe5066d4 更新 bot.py
回调彩蛋喵~
2025-08-19 12:20:43 +08:00
minecraft1024a
1b2c5393e5 refactor(utils): 移除自定义加权随机函数并改用 random.choices
将原先在 `bot.py` 中实现的 `weighted_choice` 函数移除,并在 `src/main.py` 中改用 Python 内置的 `random.choices` 函数来实现启动时彩蛋的加权随机选择。

这一更改简化了代码,提高了可读性,并利用了标准库的优化实现。同时调整了彩蛋文本和对应的权重。
2025-08-19 12:15:24 +08:00
minecraft1024a
e633ced332 Merge branch 'master' of https://github.com/MaiBot-Plus/MaiMbot-Pro-Max 2025-08-19 12:06:06 +08:00
minecraft1024a
5ef9a42f78 refactor(chat): 禁用工具执行器的缓存功能(因为这玩意真的没几次命中过的) 2025-08-19 12:06:00 +08:00
雅诺狐
5f87605eba Add rare easter egg message and adjust weights
Introduced a new rare easter egg message to the items list and updated the selection weights to make the new message extremely rare while adjusting the probabilities of the existing messages.
2025-08-19 12:05:32 +08:00
minecraft1024a
89cc1d2f6d Merge branch 'master' of https://github.com/MaiBot-Plus/MaiMbot-Pro-Max 2025-08-19 12:01:16 +08:00
minecraft1024a
86c76d002b Merge branch 'master' of https://github.com/MaiBot-Plus/MaiMbot-Pro-Max 2025-08-19 12:01:11 +08:00
ikun两年半
3b295938e0 更新 bot.py
修改彩蛋权重喵~主打一个众生平等喵
2025-08-19 11:59:15 +08:00
minecraft1024a
1951f5d2b4 Merge branch 'master' of https://github.com/MaiBot-Plus/MaiMbot-Pro-Max 2025-08-19 11:55:52 +08:00
雅诺狐
5e91f9ef5f Remove unused imports across multiple modules
Cleaned up various files by removing unused or redundant import statements to improve code readability and reduce potential confusion. No functional changes were made.
2025-08-19 11:55:24 +08:00
minecraft1024a
c1eedca19b Merge branch 'master' of https://github.com/MaiBot-Plus/MaiMbot-Pro-Max 2025-08-19 11:54:48 +08:00
雅诺狐
bd3cfc47f6 Merge branch 'master' of https://github.com/MaiBot-Plus/MaiMbot-Pro-Max 2025-08-19 11:54:14 +08:00
minecraft1024a
c36d653dee chore(deps): remove legacy gemini client and fix easter egg range 2025-08-19 11:54:00 +08:00
雅诺狐
723a9d0098 Add weighted_choice utility and improve easter_egg randomness
Introduced a weighted_choice function for weighted random selection. Refactored the easter_egg function to use weighted_choice for more flexible and controlled message selection, replacing the previous randint-based logic.
2025-08-19 11:53:01 +08:00
ikun两年半
db7df3f137 更新 bot.py
喵喵~修复了彩蛋概率问题喵~
2025-08-19 11:51:33 +08:00
minecraft1024a
5cce105acc feat(彩蛋): 增加彩蛋文本的随机性
在 `easter_egg` 函数中引入了随机数生成逻辑。
现在有20%的概率显示猫娘文本,80%的概率显示一个原有的文本,增加了趣味性。
2025-08-19 11:34:53 +08:00
minecraft1024a
25bcc96092 feat(video): 视频识别功能开关与日志优化
根据全局配置 `global_config.video_analysis.enable` 控制视频识别功能的启用与禁用。

- 当视频识别功能禁用时,收到视频消息将直接返回 `[视频]` 或空字符串,不再进行分析,以节约资源。
2025-08-19 11:27:53 +08:00