feat(prompt): 添加动态群聊提醒并修复内存搜索

在系统提示中引入动态群聊提醒,使其具备上下文意识。现在仅在对话发生在群聊环境中时注入该提醒,从而防止在私聊中可能引起模型混淆。

这是通过向`PromptParameters`添加`group_chat_reminder_block`实现的,该模块会根据聊天类型有条件地填充。

此外,本次提交还包括修复在内存搜索过程中可能出现的`AttributeError`,确保在尝试使用内存模块之前先进行配置。
This commit is contained in:
tt-P607
2025-11-13 11:10:16 +08:00
parent b16b57b232
commit 5326c69163
3 changed files with 31 additions and 14 deletions

View File

@@ -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]: