Commit Graph

32 Commits

Author SHA1 Message Date
John Richard
7923eafef3 re-style: 格式化代码 2025-10-02 20:26:01 +08:00
John Richard
ecb02cae31 style: 格式化代码 2025-10-02 19:38:39 +08:00
Windpicker-owo
dc39fd26c7 feat(memory): 重构记忆系统并移除插件热重载
重构记忆系统核心模块,引入全局记忆作用域、记忆指纹去重机制和查询规划器,优化多阶段检索性能。移除插件热重载系统及其相关依赖。

主要变更:
- 引入全局记忆作用域,简化记忆管理
- 实现记忆指纹去重,避免重复记忆存储
- 新增查询规划器,支持语义查询规划和记忆类型过滤
- 优化多阶段检索,增加语义重排和权重配置
- 改进向量存储,支持嵌入维度自动解析和查询向量生成
- 增强元数据索引,支持主体索引和更新操作
- 记忆构建器支持多主体和自然语言展示
- 移除watchdog依赖和插件热重载模块
- 更新配置模板,简化记忆配置项

BREAKING CHANGE: 移除插件热重载系统,相关API和命令不再可用。记忆系统接口有较大调整,使用该系统的模块需要适配新接口。
2025-10-01 04:56:32 +08:00
Windpicker-owo
fd76e36320 refactor(chat): 迁移数据库操作为异步模式并修复相关调用
将同步数据库操作全面迁移为异步模式,主要涉及:
- 将 `with get_db_session()` 改为 `async with get_db_session()`
- 修复相关异步调用链,确保 await 正确传递
- 优化消息管理器、上下文管理器等核心组件的异步处理
- 移除同步的 person_id 获取方法,避免协程对象传递问题

修复 deepcopy 在 StreamContext 中的序列化问题,跳过不可序列化的 asyncio.Task 对象

删除无用的测试文件和废弃的插件清单文件
2025-09-28 20:40:46 +08:00
Windpicker-owo
a2baec088e feat(chat): 实现动态消息分发系统和消息打断机制
添加基于focus_energy的动态消息分发周期调整功能,根据聊天流兴趣度智能调整检查间隔
实现消息打断系统,允许高优先级消息打断正在处理的任务
重构ChatStream类,引入动态兴趣度计算系统,包括消息兴趣度统计和用户关系评分
扩展数据库模型和配置系统以支持新功能,增加相关配置项
更新版本号至0.11.0-alpha-1以反映重大功能更新
2025-09-25 17:14:01 +08:00
tt-P607
1a24233b86 feat(core): 实现消息异步处理并引入LLM驱动的智能表情回应
本次更新对系统核心处理流程和插件功能进行了重要升级,主要包含以下两方面:

1.  **消息处理异步化**:
    - 在 `main.py` 中引入了 `asyncio.create_task` 机制,将每条消息的处理过程包装成一个独立的后台任务。
    - 这解决了长时间运行的AI或插件操作可能阻塞主事件循环的问题,显著提升了机器人的响应速度和系统稳定性。
    - 为后台任务添加了完成回调,现在可以详细地记录每个消息处理任务的成功、失败或取消状态及其耗时,便于监控和调试。

2.  **`set_emoji_like` 插件智能化**:
    - 为 `set_emoji_like` 插件增加了LLM驱动的表情选择功能。当动作指令未指定具体表情时,插件会自动构建包含聊天上下文、情绪和人设的提示,请求LLM选择一个最合适的表情进行回应。
    - 为支持此功能,对AFC规划器的提示词进行了优化,为LLM提供了更清晰的参数示例和规则,提高了动作生成的准确性。

此外,为了统一日志规范,将 `[所见]` 消息接收日志集中到 `bot.py` 中,确保在任何过滤逻辑执行前记录所有收到的消息,并移除了插件中重复的日志。
2025-09-24 15:43:12 +08:00
minecraft1024a
ff72181649 refactor(chat): 更新判断群聊消息的属性以适配新结构 2025-09-23 21:28:30 +08:00
minecraft1024a
83860b28de 先修一下命令无法正常检查聊天类型限制 2025-09-23 11:25:47 +08:00
Windpicker-owo
444f1ca315 ruff,私聊视为提及了bot 2025-09-20 22:34:22 +08:00
Windpicker-owo
553739f2cd feat(affinity-flow): 调整回复概率参数和评分计算
- 增加最大不回复次数至15次,降低每次不回复的概率提升至1%
- 在最终评分计算中增加1.15倍系数提升
- 被提及时的基础分数从1.0提升至3.0
- 为兴趣标签保存添加数据库验证机制
- 在消息处理流程中增加数据库存储功能
- 修复JSON解析错误处理,增加异常情况下的默认响应
- 优化数据库会话管理和模型转换的健壮性
2025-09-17 13:37:57 +08:00
Windpicker-owo
cdb2344e41 feat(affinity-flow): 优化兴趣度评分系统并集成消息管理器
重构兴趣度评分系统,移除时间因子权重,增加未读消息处理机制。集成消息管理器用于消息存储和状态跟踪,改进提及检测逻辑。

主要变更:
- 移除时间因子评分,调整兴趣匹配度权重至0.5
- 添加未读消息参数到规划器,优化兴趣度计算
- 引入消息管理器处理消息存储和状态标记
- 改进提及检测逻辑,使用消息对象的is_mentioned属性
- 添加消息清理和启动/停止机制

BREAKING CHANGE: 兴趣度评分算法调整,需要重新评估消息优先级
2025-09-16 14:13:56 +08:00
Windpicker-owo
0d47e237ee 炸飞hfc,引入afc 2025-09-15 17:51:49 +08:00
Windpicker-owo
02a636a8ce plugin_name改为permission_group 2025-09-07 19:03:42 +08:00
Windpicker-owo
c9b712d8fa refactor(prompt): 重构并统一提示词系统
- 删除旧的智能提示词系统(smart_prompt.py)和相关参数模块(prompt_parameters.py)
- 将 prompt_builder.py 重命名为 prompt.py 并精简功能
- 更新所有模块的导入路径从 `src.chat.utils.prompt_builder` 到 `src.chat.utils.prompt`
- 统一提示词构建接口,使用新的 PromptContext 替代 SmartPromptParameters
- 移除重复和冗余代码,简化系统架构

BREAKING CHANGE: 旧的 SmartPrompt 系统已被完全移除,所有相关模块需要改用新的统一 Prompt 系统
2025-09-06 00:10:54 +08:00
Windpicker-owo
8149731925 修复代码格式和文件名大小写问题 2025-08-31 20:50:17 +08:00
Windpicker-owo
2e2fd90497 feat(plugin-system): 添加事件触发和订阅的白名单机制
为事件系统添加权限控制功能,包括:
- 在BaseEvent中新增allowed_subscribers和allowed_triggers白名单字段
- 事件管理器触发和订阅时进行白名单验证
- 为所有系统默认事件设置仅允许SYSTEM插件触发
- 在所有事件触发调用处显式传递plugin_name="SYSTEM"参数

确保只有授权插件可以触发特定事件和订阅处理器,增强系统安全性。
2025-08-28 18:25:33 +08:00
雅诺狐
1d48478e79 Add PlusCommand enhanced command system
Introduces the PlusCommand system for simplified command development, including new base classes, argument parsing utilities, and registration logic. Updates the plugin system, component registry, and bot message handling to support PlusCommand components alongside traditional commands. Adds documentation and configuration for command prefixes, and provides a developer guide for the new system.
2025-08-27 22:21:03 +08:00
Windpicker-owo
5a6415b5fd Merge branch 'master' into migrate-windpicker-changes 2025-08-25 17:47:50 +08:00
Windpicker-owo
cbf9a21c1f event重构暂时完成,待测试 2025-08-25 17:46:23 +08:00
雅诺狐
0bcc0ba8b5 feat: 添加视频处理多线程优化和消息切片重组功能
- 新增视频帧提取的线程池支持,提升大视频文件处理性能
- 集成消息切片重组器,支持长消息的自动重组处理
- 优化视频帧提取算法,使用numpy进行数值计算优化
- 重构权限管理插件,修复属性访问和方法签名问题
- 清理未使用的导入和代码,提升代码质量
- 默认启用插件管理功能
2025-08-25 16:16:33 +08:00
雅诺狐
f308adcf5b refactor: 清理代码质量和移除未使用文件
- 移除未使用的导入语句和变量
- 修复代码风格问题(空格、格式化等)
- 删除备份文件和测试文件
- 改进异常处理链式调用
- 添加权限系统数据库模型和配置
- 更新版本号至6.4.4
- 优化SQL查询使用正确的布尔表达式
2025-08-24 22:11:20 +08:00
雅诺狐
8d8d9fbda1 Refactor anti-injection system and remove command skip list
Removed the command skip list feature and related code from the anti-injection system, including configuration options, plugin command collection, and management commands. Refactored anti-injector logic to operate directly on message dictionaries and simplified whitelist and message content extraction. Updated response handling to perform anti-injection checks before reply generation, and removed skip list refresh logic from the plugin manager.
2025-08-22 15:48:21 +08:00
雅诺狐
f8ba0d0e43 Refactor web search plugin and clean up code
Refactored the web search plugin by removing the old Bing search implementation and reorganizing the plugin structure. Introduced modular search engine classes under 'web_search_tool/engines' and utility tools under 'web_search_tool/tools' and 'web_search_tool/utils'. Updated references and initialization logic to support multiple search engines and improved maintainability. Also performed minor code cleanups and replaced 'except ...: pass' with 'except ...: ...' for brevity.
2025-08-21 23:42:16 +08:00
雅诺狐
d26dd0fb2a Refactor anti-injection system into modular subpackages
Split the anti-prompt-injector module into core, processors, management, and decision submodules for better maintainability and separation of concerns. Moved and refactored detection, shielding, statistics, user ban, message processing, and counter-attack logic into dedicated files. Updated imports and initialization in __init__.py and anti_injector.py to use the new structure. No functional changes to detection logic, but code organization is significantly improved.
2025-08-20 14:57:37 +08:00
minecraft1024a
ec61a9ccf0 新增反击模式支持,允许在检测到提示词注入攻击时生成反击响应并发送。更新相关配置和处理逻辑,增强系统的防护能力。 2025-08-18 22:13:23 +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
雅诺狐
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
雅诺狐
d46d689c43 数据库重构 2025-08-16 23:43:45 +08:00
minecraft1024a
e19106b5b0 添加聊天类型限制功能,支持根据聊天类型过滤命令和动作,新增私聊和群聊专用命令及动作,优化相关日志记录。 2025-08-16 13:21:13 +08:00
雅诺狐
4da66f39c9 小修复 2025-08-12 22:38:26 +08:00
雅诺狐
05cba1bb09 添加了一个发送api 2025-08-12 17:32:45 +08:00
雅诺狐
2d4745cd58 初始化 2025-08-11 19:34:18 +08:00