From befdb796b9f94117731833716e2d71fd8595d963 Mon Sep 17 00:00:00 2001 From: minecraft1024a Date: Sat, 13 Sep 2025 12:59:44 +0800 Subject: [PATCH] =?UTF-8?q?refactor(at=5Fuser):=20=E4=BC=98=E5=8C=96?= =?UTF-8?q?=E6=8F=92=E4=BB=B6=E6=8F=8F=E8=BF=B0=E5=B9=B6=E4=BF=AE=E5=A4=8D?= =?UTF-8?q?=E8=81=8A=E5=A4=A9=E6=B5=81=E8=8E=B7=E5=8F=96=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 更新了 `action_parameters` 和 `action_require` 的描述,使其更加清晰和准确,提升了LLM在不同场景下判断的准确性。 - 修复了 `chat_stream` 的获取逻辑,优先使用 `self.chat_stream`,确保在不同调用路径下都能正确获取到聊天流实例。 --- src/plugins/built_in/at_user_plugin/plugin.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/plugins/built_in/at_user_plugin/plugin.py b/src/plugins/built_in/at_user_plugin/plugin.py index 7a80b8ab6..ba40903cd 100644 --- a/src/plugins/built_in/at_user_plugin/plugin.py +++ b/src/plugins/built_in/at_user_plugin/plugin.py @@ -26,11 +26,11 @@ class AtAction(BaseAction): chat_type_allow = ChatType.GROUP # === 功能描述(必须填写)=== - action_parameters = {"user_name": "需要艾特用户的名字", "at_message": "艾特用户时要发送的消,注意消息里不要有@"} + action_parameters = {"user_name": "需要艾特用户的名字", "at_message": "艾特用户时要发送的消息"} action_require = [ - "当需要艾特某个用户时使用", - "当你需要提醒特定用户查看消息时使用", - "在回复中需要明确指向某个用户时使用", + "当用户明确要求你去'叫'、'喊'、'提醒'或'艾特'某人时使用", + "当你判断,为了让特定的人看到消息,需要代表用户去呼叫他/她时使用", + "例如:'你去叫一下张三','提醒一下李四开会'", ] llm_judge_prompt = """ 判定是否需要使用艾特用户动作的条件: @@ -67,10 +67,10 @@ class AtAction(BaseAction): # 获取当前聊天流 chat_manager = get_chat_manager() - chat_stream = chat_manager.get_stream(self.chat_id) + chat_stream = self.chat_stream or chat_manager.get_stream(self.chat_id) if not chat_stream: - logger.error(f"找不到聊天流: {self.stream_id}") + logger.error(f"找不到聊天流: {self.chat_stream}") return False, "聊天流不存在" # 创建回复器实例