diff --git a/src/plugins/built_in/at_user_plugin/plugin.py b/src/plugins/built_in/at_user_plugin/plugin.py index 8329480a7..5e24458ef 100644 --- a/src/plugins/built_in/at_user_plugin/plugin.py +++ b/src/plugins/built_in/at_user_plugin/plugin.py @@ -80,6 +80,13 @@ class AtAction(BaseAction): reply_to = f"{user_name}:{at_message}" extra_info = f"你需要艾特用户 {user_name} 并回复他们说: {at_message}" + from src.plugin_system.core.event_manager import event_manager + from src.plugin_system import EventType + # 触发post_llm + result = await event_manager.trigger_event(EventType.POST_LLM,plugin_name="SYSTEM") + if not result.all_continue_process(): + return False, f"被组件{result.get_summary().get("stopped_handlers","")}打断" + # 使用回复器生成回复 success, llm_response, prompt = await replyer.generate_reply_with_context( reply_to=reply_to, diff --git a/test_plugin_config_fix.py b/test_plugin_config_fix.py deleted file mode 100644 index a5e6c77b0..000000000 --- a/test_plugin_config_fix.py +++ /dev/null @@ -1,53 +0,0 @@ -#!/usr/bin/env python3 -""" -测试脚本用于验证LauchNapcatAdapterHandler的plugin_config修复 -""" - -import sys -import os -from pathlib import Path - -# 添加项目根目录到Python路径 -project_root = Path(__file__).parent -sys.path.insert(0, str(project_root)) - -from src.plugins.built_in.napcat_adapter_plugin.plugin import LauchNapcatAdapterHandler - -def test_plugin_config_fix(): - """测试plugin_config修复""" - print("测试LauchNapcatAdapterHandler的plugin_config修复...") - - # 创建测试配置 - test_config = { - "napcat_server": { - "mode": "reverse", - "host": "localhost", - "port": 8095 - }, - "maibot_server": { - "host": "localhost", - "port": 8000 - } - } - - # 创建处理器实例 - handler = LauchNapcatAdapterHandler() - - # 设置插件配置(模拟事件管理器注册时的行为) - handler.plugin_config = test_config - - print(f"设置的plugin_config: {handler.plugin_config}") - - # 测试配置访问 - if handler.plugin_config is not None and handler.plugin_config == test_config: - print("✅ plugin_config修复成功!") - print(f"✅ 可以正常访问配置: napcat_server.mode = {handler.plugin_config.get('napcat_server', {}).get('mode')}") - return True - else: - print("❌ plugin_config修复失败!") - print(f"❌ 当前plugin_config: {handler.plugin_config}") - return False - -if __name__ == "__main__": - success = test_plugin_config_fix() - sys.exit(0 if success else 1) \ No newline at end of file