feat(prompt): 添加动态群聊提醒并修复内存搜索
在系统提示中引入动态群聊提醒,使其具备上下文意识。现在仅在对话发生在群聊环境中时注入该提醒,从而防止在私聊中可能引起模型混淆。 这是通过向`PromptParameters`添加`group_chat_reminder_block`实现的,该模块会根据聊天类型有条件地填充。 此外,本次提交还包括修复在内存搜索过程中可能出现的`AttributeError`,确保在尝试使用内存模块之前先进行配置。
This commit is contained in:
@@ -910,6 +910,8 @@ class Prompt:
|
||||
or context_data.get("auth_role_prompt_block", ""),
|
||||
"chat_scene": self.parameters.chat_scene
|
||||
or "你正在一个QQ群里聊天,你需要理解整个群的聊天动态和话题走向,并做出自然的回应。",
|
||||
"group_chat_reminder_block": self.parameters.group_chat_reminder_block
|
||||
or context_data.get("group_chat_reminder_block", ""),
|
||||
}
|
||||
|
||||
def _prepare_normal_params(self, context_data: dict[str, Any]) -> dict[str, Any]:
|
||||
@@ -952,6 +954,8 @@ class Prompt:
|
||||
or "你正在一个QQ群里聊天,你需要理解整个群的聊天动态和话题走向,并做出自然的回应。",
|
||||
"bot_name": self.parameters.bot_name,
|
||||
"bot_nickname": self.parameters.bot_nickname,
|
||||
"group_chat_reminder_block": self.parameters.group_chat_reminder_block
|
||||
or context_data.get("group_chat_reminder_block", ""),
|
||||
}
|
||||
|
||||
def _prepare_default_params(self, context_data: dict[str, Any]) -> dict[str, Any]:
|
||||
|
||||
Reference in New Issue
Block a user