Commit Graph

13 Commits

Author SHA1 Message Date
雅诺狐
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
雅诺狐
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
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
雅诺狐
875e02d42f 数据库重构 2025-11-19 22:40:23 +08:00
雅诺狐
dfecccfc56 llm统计记录模型反应时间 2025-11-19 22:40:11 +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
雅诺狐
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