雅诺狐
ceb8150914
Expand and update prompt injection detection patterns
...
Enhanced the default_patterns list in PromptInjectionDetector with more comprehensive and specific regular expressions to improve detection of prompt injection attempts, including new patterns for admin commands, system prompts, privilege escalation, and sensitive information leakage. This update aims to strengthen the robustness of the anti-prompt-injection mechanism.
2025-08-18 18:04:44 +08:00
雅诺狐
9c23ceae01
Merge branch 'master' of https://github.com/MaiBot-Plus/MaiMbot-Pro-Max
2025-08-18 17:51:50 +08:00
雅诺狐
f61710b0ce
Refactor anti-injector process result handling
...
Introduced a ProcessResult enum to standardize anti-injector message processing outcomes. Updated anti_injector.py to return ProcessResult values instead of booleans, and refactored bot.py to handle these results with improved logging and clearer control flow. This change improves code clarity and maintainability for anti-prompt injection logic.
2025-08-18 17:51:44 +08:00
Furina-1013-create
8959ffebb0
Merge branch 'master' of https://github.com/MaiBot-Plus/MaiMbot-Pro-Max
2025-08-18 17:37:57 +08:00
Furina-1013-create
247235c5ba
之前单等于的原因是被Rust带歪了(
2025-08-18 17:37:19 +08:00
雅诺狐
f3958ef484
Merge branch 'master' of https://github.com/MaiBot-Plus/MaiMbot-Pro-Max
2025-08-18 17:29:32 +08:00
雅诺狐
689aface9d
Add LLM anti-prompt injection system
...
Introduces a comprehensive anti-prompt injection system for LLMs, including rule-based and LLM-based detection, user ban/whitelist management, message shielding, and statistics tracking. Adds new modules under src/chat/antipromptinjector, integrates anti-injection checks into the message receive flow, updates configuration and database models, and provides test scripts. Also updates templates and logger aliases to support the new system.
2025-08-18 17:27:59 +08:00
Furina-1013-create
6eec2daaa6
修复视频只有单帧被识别的问题并再次更新requirements.txt
2025-08-18 17:11:09 +08:00
Furina-1013-create
23aec68cc0
修复Gemini api专属的那个gemini_client.py里面的一个潜在的导入问题并增加回退机制
2025-08-18 16:18:21 +08:00
Furina-1013-create
9205edf8ca
更新一闪忘记更新的requirements.txt
2025-08-18 15:47:36 +08:00
minecraft1024a
22f6cd2d94
feat(deps): 实现依赖包智能别名解析
...
引入了依赖包智能别名解析机制,以解决 Python 生态中常见的安装名与导入名不一致的问题(如 `beautifulsoup4` -> `bs4`)。
当通过包名直接导入失败时,依赖管理器会自动查询一个内置的别名映射表,并尝试使用别名再次导入。这大大提升了开发者在定义简单字符串格式依赖时的体验,减少了因名称不一致导致的依赖检查失败。
同时,更新了相关文档,详细说明了该功能的工作原理、解决了什么问题,并更新了最佳实践。
2025-08-18 13:48:55 +08:00
minecraft1024a
d43d352ca5
refactor(config): 移除视频分析相关重复的配置及未使用的导入(所以我挺好奇为什么VideoAnalysisConfig能有两个)
...
同时,清理了多个文件中未使用的导入,包括 `inspect`、`base64` 和 `get_image_manager`,以保持代码库的整洁。
2025-08-18 13:16:54 +08:00
minecraft1024a
3b3eb080da
feat(plugin): 实现插件配置集中化管理
...
将插件配置文件从各自的插件目录迁移至项目根目录下的 `config/plugins/` 文件夹中,方便用户统一管理和修改。
主要变更:
- 新增 `plugins.centralized_config` 总开关,用于控制是否启用此功能。
- 修改插件加载逻辑,现在会从 `config/plugins/<plugin_name>/` 目录读取用户配置。
- 如果用户配置不存在,会自动从插件目录下的模板配置文件复制一份。
- 保留了原有的配置版本检查和自动迁移功能,现在作用于用户配置文件。
2025-08-18 13:00:13 +08:00
minecraft1024a
dcc2e4caff
feat(maizone): 新增定时任务随机间隔功能
...
为了避免定时任务在完全相同的时间点触发,引入了随机延迟机制。
现在,定时任务的执行间隔将在设定的最小和最大分钟数之间随机波动,使行为模式更难被预测。
此功能可通过配置项进行调整,默认间隔为 5 到 15 分钟。
Co-Authored-By: tt-P607 <68868379+tt-P607@users.noreply.github.com >
2025-08-18 12:04:35 +08:00
minecraft1024a
c47d666d07
chore(deps): 移除未使用的 ModelTaskConfig 导入
...
从 cache_manager.py 文件中删除了对 `src.config.api_ada_configs` 中 `ModelTaskConfig` 的导入,因为它在该文件中并未被使用。
添加了记忆系统的大饼
Co-authored-by: 雅诺狐 <foxcyber907@users.noreply.github.com >
2025-08-18 11:54:00 +08:00
minecraft1024a
51c0d2a1e8
refactor(cache): 重构缓存系统为分层语义缓存
...
将原有的基于文件的 `ToolCache` 替换为全新的 `CacheManager`,引入了更复杂和高效的分层语义缓存机制。
新系统特性:
- **分层缓存**:
- L1 缓存: 内存字典 (KV) + FAISS (向量),用于极速访问。
- L2 缓存: SQLite (KV) + ChromaDB (向量),用于持久化存储。
- **语义缓存**: 利用嵌入模型 (Embedding) 对查询进行向量化,实现基于语义相似度的缓存命中,显著提高了缓存命中率。
- **自动失效**: 缓存键包含工具源代码的哈希值,当工具代码更新时,相关缓存会自动失效,避免了脏数据问题。
- **异步支持**: 缓存的 `get` 和 `set` 方法现在是异步的,以适应项目中异步化的工具调用流程。
`web_search_tool` 已更新以使用新的 `CacheManager`,在调用缓存时传递 `tool_class` 和 `semantic_query` 以充分利用新功能。
Co-Authored-By: tt-P607 <68868379+tt-P607@users.noreply.github.com >
2025-08-17 22:18:26 +08:00
minecraft1024a
b45a992484
Merge branch 'master' of https://github.com/MaiBot-Plus/MaiMbot-Pro-Max
2025-08-17 21:26:42 +08:00
minecraft1024a
1752831024
perf(web_search): 缓存网络工具调用以加速响应
...
为 `WebSurfingTool` 和 `URLParserTool` 集成 `tool_cache`,避免对相同参数的重复请求。
此更改通过在执行网络搜索或URL解析前检查缓存来优化性能。如果找到先前成功的结果,则立即返回缓存数据,从而显著减少延迟和外部API的使用。仅当缓存未命中时,工具才会继续执行其原始逻辑,并将成功的结果存入缓存以备将来使用。
2025-08-17 21:26:35 +08:00
雅诺狐
aaaf8f5ef7
Update TODO: Mark MCP SSE support as incomplete
...
Changed the MCP SSE support item from completed to incomplete in the TODO list to reflect current project status.
Co-Authored-By: tt-P607 <68868379+tt-P607@users.noreply.github.com >
2025-08-17 21:08:49 +08:00
雅诺狐
74ae472005
Add ToolCache class for tool result caching
...
Introduces a ToolCache class to manage caching of tool invocation results with support for both exact and approximate (similarity-based) query matching. Includes methods for cache retrieval, storage, expiration, cleanup, and statistics. This helps improve efficiency by reusing previous results and reducing redundant tool executions.
Co-Authored-By: tt-P607 <68868379+tt-P607@users.noreply.github.com >
2025-08-17 21:06:25 +08:00
雅诺狐
3155c4713f
Remove Nix, pre-commit, and related config files
...
Deleted Nix flake files, pre-commit configuration, environment files, sample data, and a batch script. Also commented out automatic triggers in the Docker GitHub Actions workflow, leaving only manual dispatch. This simplifies the repository by removing development environment and automation tooling.
Co-Authored-By: tt-P607 <68868379+tt-P607@users.noreply.github.com >
2025-08-17 21:03:27 +08:00
雅诺狐
b618953322
Remove GitHub PR template and workflow files
...
Deleted the pull request template and related GitHub Actions workflows for precheck and Ruff checks. This streamlines the repository by removing automated PR checks and formatting enforcement.
Co-Authored-By: tt-P607 <68868379+tt-P607@users.noreply.github.com >
2025-08-17 20:57:21 +08:00
雅诺狐
cb65d91c7a
Refactor antiprompt flowchart and fix indentation
...
Updated the antipromptinjector flowchart for improved clarity and logic. Fixed indentation in expression_selector.py to correct code structure. Removed obsolete db_migration_plan.md documentation.
2025-08-17 20:51:52 +08:00
minecraft1024a
3b0eb87877
fix(maizone): 修复处理动态时因feed为空引发的错误
...
在处理QQ空间动态列表时,单个`feed`对象可能为`None`,导致在访问其属性(如`appid`)时引发`TypeError`。
本次提交通过增加一个空值检查,在遍历动态列表时跳过为`None`的`feed`项,从而避免了潜在的程序崩溃,增强了代码的健壮性。
2025-08-17 19:40:18 +08:00
minecraft1024a
4dcb7fbecf
feat(core): 启动时增加随机小贴士
...
在系统初始化完成后的启动信息中,增加了一个随机显示的小贴士(彩蛋)功能。
每次启动时会从预设的短语列表中随机选择一条进行展示,增加趣味性。
2025-08-17 19:31:02 +08:00
minecraft1024a
ba5563abc5
feat(chat): 私聊专注模式下强制回复
...
在私聊的专注模式下,即使用户的发言没有触发任何功能,机器人也会进行回复,而不是选择“no_reply”。
此举旨在提升私聊场景下的用户体验,避免机器人因未匹配到关键词而沉默,让对话感觉更自然。
2025-08-17 16:48:42 +08:00
minecraft1024a
848f16346b
fix(maizone): 兼容新版QQ空间动态接口返回的JSON格式
...
QQ空间监控好友动态的接口返回格式从 JSONP (_Callback(...)) 变更为纯 JSON。
本次提交通过增加判断,兼容了新旧两种数据格式,并修复了因此导致的动态拉取失败问题。
同时,为 `images` 循环中的未使用变量 `img_bytes` 添加下划线前缀,并为 `pic_bos` 和 `richvals` 两个未使用的变量添加 `# noqa: F841` 以消除 linter 警告。
2025-08-17 16:06:17 +08:00
minecraft1024a
cd3ccba8ad
refactor(core): 调整数据库初始化时机
...
将数据库的初始化、表结构创建和自动迁移逻辑从配置文件加载时移动到主程序 `raw_main` 函数中。
这一改动旨在解决循环导入问题,并确保数据库在所有配置和核心模块加载完毕后才进行初始化,提高了程序的启动鲁棒性和模块独立性。
2025-08-17 15:59:56 +08:00
minecraft1024a
ec622767ab
Merge branch 'master' of https://github.com/MaiBot-Plus/MaiMbot-Pro-Max
2025-08-17 15:38:15 +08:00
minecraft1024a
4512b3f9f1
feat(schedule): 新增每日零点自动生成日程任务
...
新增一个后台异步任务,用于在每日零点自动为新的一天生成日程表。
此功能通过 `AsyncTask` 实现,在程序启动时初始化并启动一个循环任务。该任务会计算到下一个零点的时间并等待,然后在零点触发新的日程生成和保存流程,确保日程表能够每日自动更新。
2025-08-17 15:38:07 +08:00
Furina-1013-create
a5ec9a9cd0
Merge branch 'master' of https://github.com/MaiBot-Plus/MaiMbot-Pro-Max
2025-08-17 15:31:56 +08:00
Furina-1013-create
612589fb54
修点言柒报告的bug并更新TODO
2025-08-17 15:31:09 +08:00
雅诺狐
9665d83399
Merge branch 'master' of https://github.com/MaiBot-Plus/MaiMbot-Pro-Max
2025-08-17 15:07:56 +08:00
minecraft1024a
1093657b05
feat(maizone): 新增独立的maizone模型配置
...
为maizone功能添加了专属的模型任务配置`maizone`,使其可以与默认的回复模型`replyer_1`使用不同的模型和参数。
- 在`ModelTaskConfig`中增加了`maizone`字段。
- 将`maizone_refactored`插件的默认模型从`replyer_1`修改为`maizone`。
- 在配置文件模板中添加了`[model_task_config.maizone]`的默认配置。
2025-08-17 14:52:06 +08:00
minecraft1024a
b1452ba3bd
refactor(maizone): 优化代码格式并移除多余日志
...
对 `qzone_service` 和 `monitor_service` 进行了代码风格调整和重构。
- 在 `qzone_service.py` 中,统一了函数定义、字典和参数列表的格式,使其更符合代码规范,提高了可读性。
- 在 `monitor_service.py` 中,移除了监控任务开始时的一条多余日志记录,以减少不必要的日志输出。
- 在 `qzone_service.py` 的 `_monitor_list_feeds` 方法中,增加了对API返回格式的校验,以增强代码的健壮性。
2025-08-17 14:40:04 +08:00
minecraft1024a
f12cc68d04
refactor(db): 使用迁移函数替代 create_all 初始化数据库
...
将数据库初始化过程从直接调用 `Base.metadata.create_all` 修改为调用新的 `check_and_migrate_database` 函数。
这一更改旨在实现更灵活的数据库模式管理,允许在不丢失现有数据的情况下,自动检查并添加新的列或表,从而增强了数据库迁移的健壮性。
2025-08-17 14:31:58 +08:00
雅诺狐
2b61110dd8
Merge branch 'master' of https://github.com/MaiBot-Plus/MaiMbot-Pro-Max
2025-08-17 14:17:46 +08:00
雅诺狐
78417e254a
移除遥测
2025-08-17 14:17:41 +08:00
minecraft1024a
4f1e59abf7
feat(core): 在 no_reply 核心动作中增加了对聊天类型的判断,使其仅在群聊中生效
2025-08-17 14:16:49 +08:00
Furina-1013-create
d41246dbc1
Merge branch 'master' of https://github.com/MaiBot-Plus/MaiMbot-Pro-Max
2025-08-17 14:00:42 +08:00
Furina-1013-create
c09536bf76
增加videoid修复同一个视频重复识别的问题
...
ps:通过数据库检查的去重:
视频hash计算:使用SHA256算法计算视频文件的唯一标识
数据库去重检查:在分析前先检查数据库中是否已存在相同hash的视频
结果缓存:将分析结果存储到Videos表中,避免重复分析
2025-08-17 14:00:00 +08:00
雅诺狐
37684fea51
Update emoji_manager.py
2025-08-17 13:59:09 +08:00
雅诺狐
c9b260082c
Merge branch 'master' of https://github.com/MaiBot-Plus/MaiMbot-Pro-Max
2025-08-17 13:56:19 +08:00
雅诺狐
a9d5cd8958
fix:数据库修复
2025-08-17 13:56:15 +08:00
minecraft1024a
15c5d919aa
docs: 更新 TODO 列表
...
更新了适配器黑/白名单功能的完成状态。
2025-08-17 13:48:35 +08:00
tt-P607
e8e85cf83f
更新.gitgnore
2025-08-17 13:40:27 +08:00
minecraft1024a
0537dcc1c4
Merge branches 'master' and 'master' of https://github.com/MaiBot-Plus/MaiMbot-Pro-Max
2025-08-17 12:50:55 +08:00
minecraft1024a
19f7fa15ac
chore(logger): 更新日志模块颜色与别名配置
...
为多个新模块和重构后的模块添加了对应的日志颜色和别名,以增强日志的可读性和区分度。具体包括:
- SQLAlchemy 相关模块
- OpenAI 和 Gemini 客户端
- 多个插件和管理器
- 重构后的 MaiZone 服务和操作
- 新增的网络工具插件
2025-08-17 12:50:49 +08:00
雅诺狐
2ca578741c
Merge branch 'master' of https://github.com/MaiBot-Plus/MaiMbot-Pro-Max
2025-08-17 12:50:13 +08:00
雅诺狐
fc17fafc32
更新 docker-image.yml
2025-08-17 12:42:25 +08:00