refactor(at_user): 优化插件描述并修复聊天流获取逻辑
- 更新了 `action_parameters` 和 `action_require` 的描述,使其更加清晰和准确,提升了LLM在不同场景下判断的准确性。 - 修复了 `chat_stream` 的获取逻辑,优先使用 `self.chat_stream`,确保在不同调用路径下都能正确获取到聊天流实例。
This commit is contained in:
committed by
Windpicker-owo
parent
31bdaa3747
commit
c682c6ceab
@@ -26,11 +26,11 @@ class AtAction(BaseAction):
|
|||||||
chat_type_allow = ChatType.GROUP
|
chat_type_allow = ChatType.GROUP
|
||||||
|
|
||||||
# === 功能描述(必须填写)===
|
# === 功能描述(必须填写)===
|
||||||
action_parameters = {"user_name": "需要艾特用户的名字", "at_message": "艾特用户时要发送的消,注意消息里不要有@"}
|
action_parameters = {"user_name": "需要艾特用户的名字", "at_message": "艾特用户时要发送的消息"}
|
||||||
action_require = [
|
action_require = [
|
||||||
"当需要艾特某个用户时使用",
|
"当用户明确要求你去'叫'、'喊'、'提醒'或'艾特'某人时使用",
|
||||||
"当你需要提醒特定用户查看消息时使用",
|
"当你判断,为了让特定的人看到消息,需要代表用户去呼叫他/她时使用",
|
||||||
"在回复中需要明确指向某个用户时使用",
|
"例如:'你去叫一下张三','提醒一下李四开会'",
|
||||||
]
|
]
|
||||||
llm_judge_prompt = """
|
llm_judge_prompt = """
|
||||||
判定是否需要使用艾特用户动作的条件:
|
判定是否需要使用艾特用户动作的条件:
|
||||||
@@ -67,10 +67,10 @@ class AtAction(BaseAction):
|
|||||||
|
|
||||||
# 获取当前聊天流
|
# 获取当前聊天流
|
||||||
chat_manager = get_chat_manager()
|
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:
|
if not chat_stream:
|
||||||
logger.error(f"找不到聊天流: {self.stream_id}")
|
logger.error(f"找不到聊天流: {self.chat_stream}")
|
||||||
return False, "聊天流不存在"
|
return False, "聊天流不存在"
|
||||||
|
|
||||||
# 创建回复器实例
|
# 创建回复器实例
|
||||||
|
|||||||
Reference in New Issue
Block a user