minecraft1024a
64e3d6d56b
fix(cache): 兼容元组形式的 embedding_result
...
get_embedding 方法的返回值可能是一个包含向量和模型名称的元组
2025-11-19 22:44:52 +08:00
雅诺狐
383f704b53
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-11-19 22:44:32 +08:00
minecraft1024a
b3d02ff1c3
feat(cache): 用文件修改时间替换源码哈希生成缓存键
...
BREAKING CHANGE: CacheManager 的 _generate_key/get/set 方法签名变更,现在需要传入 tool_file_path 而非 tool_class 实例,所有调用方需跟进适配。
2025-11-19 22:44:01 +08:00
minecraft1024a
04b6b20189
修复缓存管理器中的异常处理逻辑
...
- 将捕获的异常类型从 `TypeError` 和 `OSError` 修改为 `Exception`,以涵盖更多潜在错误。
- 增强日志记录,提供更清晰的类名和简化的错误信息,便于调试和问题追踪。
2025-11-19 22:44:00 +08:00
minecraft1024a
6568ea49da
feat(cache): 增强嵌入向量处理的健壮性和验证
...
- 新增 `_validate_embedding` 方法,用于在存入缓存前对嵌入向量进行严格的格式检查、维度验证和数值有效性校验。
- 在缓存查询 (`get`) 和写入 (`set`) 流程中,集成此验证逻辑,确保只有合规的向量才能被处理和存储。
- 增加了在L1和L2向量索引操作中的异常捕获,防止因向量处理失败导致缓存功能中断,提升了系统的整体稳定性。
2025-11-19 22:43:59 +08:00
雅诺狐
48ed62deae
Refactor cache L2 storage to use SQLAlchemy DB
...
Replaces the L2 cache layer's SQLite implementation with an async SQLAlchemy-based database model (CacheEntries). Updates cache_manager.py to use db_query and db_save for cache operations, adds semantic cache handling with ChromaDB, and introduces async cache clearing and expiration cleaning methods. Adds the CacheEntries model and integrates it into the database API.
2025-11-19 22:43:59 +08:00
雅诺狐
16da725272
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-11-19 22:43:57 +08:00
minecraft1024a
438be4fe38
chore(deps): 移除未使用的 ModelTaskConfig 导入
...
从 cache_manager.py 文件中删除了对 `src.config.api_ada_configs` 中 `ModelTaskConfig` 的导入,因为它在该文件中并未被使用。
添加了记忆系统的大饼
Co-authored-by: 雅诺狐 <foxcyber907@users.noreply.github.com >
2025-11-19 22:43:46 +08:00
minecraft1024a
da73c5593e
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-11-19 22:43:46 +08:00
雅诺狐
f318801942
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-11-19 22:43:45 +08:00
雅诺狐
ced43386bf
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-11-19 22:43:44 +08:00
minecraft1024a
27c63380c2
refactor(core): 调整数据库初始化时机
...
将数据库的初始化、表结构创建和自动迁移逻辑从配置文件加载时移动到主程序 `raw_main` 函数中。
这一改动旨在解决循环导入问题,并确保数据库在所有配置和核心模块加载完毕后才进行初始化,提高了程序的启动鲁棒性和模块独立性。
2025-11-19 22:43:17 +08:00
minecraft1024a
0144321254
refactor(db): 使用迁移函数替代 create_all 初始化数据库
...
将数据库初始化过程从直接调用 `Base.metadata.create_all` 修改为调用新的 `check_and_migrate_database` 函数。
这一更改旨在实现更灵活的数据库模式管理,允许在不丢失现有数据的情况下,自动检查并添加新的列或表,从而增强了数据库迁移的健壮性。
2025-11-19 22:43:14 +08:00
Furina-1013-create
8902f6b7cb
增加videoid修复同一个视频重复识别的问题
...
ps:通过数据库检查的去重:
视频hash计算:使用SHA256算法计算视频文件的唯一标识
数据库去重检查:在分析前先检查数据库中是否已存在相同hash的视频
结果缓存:将分析结果存储到Videos表中,避免重复分析
2025-11-19 22:42:45 +08:00
雅诺狐
6b3d916fd0
移除遥测
2025-11-19 22:42:44 +08:00
minecraft1024a
56444f04eb
chore(logger): 更新日志模块颜色与别名配置
...
为多个新模块和重构后的模块添加了对应的日志颜色和别名,以增强日志的可读性和区分度。具体包括:
- SQLAlchemy 相关模块
- OpenAI 和 Gemini 客户端
- 多个插件和管理器
- 重构后的 MaiZone 服务和操作
- 新增的网络工具插件
2025-11-19 22:42:37 +08:00
雅诺狐
875e02d42f
数据库重构
2025-11-19 22:40:23 +08:00
雅诺狐
dfecccfc56
llm统计记录模型反应时间
2025-11-19 22:40:11 +08:00
雅诺狐
fc8c38496f
移除了MCP
2025-11-19 22:39:44 +08:00
雅诺狐
1ed7d1248d
添加了MCP SEE支持
...
能不能用我不知道,先加进来。主要我没有服务,无法测试
2025-11-19 22:39:25 +08:00
雅诺狐
bd1b9b279d
添加Unix socket连接方法
2025-11-19 22:39:19 +08:00
minecraft1024a
3af3904070
添加日程管理相关模型Schedule和MaiZoneScheduleStatus,并在调度管理器中实现日程处理状态的检查与更新逻辑,优化了基于日程的发送功能。
2025-11-19 22:39:13 +08:00
minecraft1024a
ebf6fc5c20
重构日程管理模块,将原有的schedule_manager模块迁移至manager目录,并更新相关引用。同时优化了定时任务管理逻辑,确保基于日程的发送功能正常运作,改进了日志记录和活动处理机制(OK兄弟们全体目光向我看齐,看我看我,我是个sb)
2025-11-19 22:39:03 +08:00
minecraft1024a
1c7693cedf
优化日程管理逻辑,增加日程数据格式验证,处理JSON解析错误,确保日程事件字段完整性,改进日志记录。
2025-11-19 22:38:58 +08:00
minecraft1024a
af71c578b0
只是一个测试提交
2025-11-19 22:36:17 +08:00
minecraft1024a
99189921e1
更新logger.py文件,新增多个模块的颜色和别名映射,优化代码结构以支持API、插件系统、工具和依赖管理等扩展功能(这上了色是真的好看吧)
2025-11-19 22:36:03 +08:00
雅诺狐
2e6ae2419b
优化项目结构,格式化代码
2025-11-19 22:35:40 +08:00
minecraft1024a
c62e6642f7
feat: 添加日程管理功能,包括日程模型、配置和初始化逻辑,增强聊天回复中对当前活动的动态反馈。
2025-11-19 22:35:28 +08:00
雅诺狐
23ee3767ef
初始化
2025-11-19 22:34:56 +08:00
SengokuCola
fed0c0fd04
feat:更新记忆系统
2025-08-13 23:17:28 +08:00
SengokuCola
4ffcc61f4b
feat:记录使用的表达方式
2025-08-12 21:44:35 +08:00
SengokuCola
ae254de494
better:重构personinfo,使用Person类和类属性
2025-08-12 14:33:13 +08:00
SengokuCola
0f6ed0fe02
ref:重构关系系统第一步,拆除impression,采用不同属性交叉评分呢
2025-08-12 01:38:19 +08:00
SengokuCola
c5cc1f8770
feat: 暂时禁用group_info
2025-08-11 22:53:00 +08:00
SengokuCola
268b428e8f
feat: llm统计现已记录模型反应时间
2025-08-11 21:51:59 +08:00
UnCLAS-Prommer
204075b6ef
Merge branch 'dev' of github.com:MaiM-with-u/MaiBot into dev
2025-08-11 18:54:19 +08:00
UnCLAS-Prommer
bd5cbebf5f
增加了很好的定位,修复了日志清理先等24h的问题
2025-08-11 18:54:01 +08:00
SengokuCola
6f49b3d99d
修复Action没有reply_to_message的问题
2025-08-11 14:55:23 +08:00
SengokuCola
3804124df8
fix:优化reply,填补缺失值,youhualog
2025-08-11 00:19:31 +08:00
SengokuCola
69a855df8d
feat:保存关键词到message数据库
2025-08-10 21:12:49 +08:00
SengokuCola
8053067af5
feat:优化关键词显示,优化表达方式配置和逻辑
2025-08-09 00:10:41 +08:00
SengokuCola
a2c86f3605
feat:部分处理notify,自动同步数据库null约束变更
...
notify存储至message库
2025-08-08 12:34:21 +08:00
墨梓柒
fa9cd653fe
Revert "feat(database): 添加MySQL支持并重构数据库配置"
2025-08-07 12:04:51 +08:00
cuckoo711
939f17890a
refactor(database): 重构数据库初始化和字段检查逻辑
...
- 添加对 MySQL 数据库的支持
- 优化字段检查和添加逻辑,处理 NOT NULL 字段和默认值
- 改进错误处理和日志记录
- 调整表和字段操作的 SQL 语句以适应不同数据库类型
2025-08-07 11:22:01 +08:00
cuckoo711
b6f5831785
feat(database): 添加MySQL支持并重构数据库配置
...
- 新增DataBaseConfig类用于集中管理数据库配置
- 重构数据库初始化逻辑,支持SQLite和MySQL两种数据库类型
- 为数据库表添加表前缀支持,便于多实例部署
- 更新数据库模型字段类型和长度限制
- 在配置模板中添加数据库配置节
2025-08-07 10:55:48 +08:00
UnCLAS-Prommer
1e5db5d7e1
正确使用lpmm构建prompt
2025-08-03 19:52:31 +08:00
Afan
3e780c4417
把所有的深蓝色的日志都改成浅蓝色,(可能是个人差了)看起来或许会更加舒服一点......(应该会舒服一点吧,总之我感觉看起来是这样的)
2025-07-31 14:29:46 +08:00
SengokuCola
2aec68bd3d
fixruff
...
Update heartflow_message_processor.py
2025-07-25 13:53:10 +08:00
SengokuCola
a02ea61386
fix ruff
2025-07-24 05:00:30 +08:00
SengokuCola
6c91b95314
better:新增log前缀映射,优化emoji的显示,加强了emoji的识别
2025-07-24 04:54:47 +08:00