feat(chat): 添加机器人身份信息到提示词模板

在多个提示词模板中添加机器人名称和昵称信息,让AI能够正确识别自己的身份。同时更新PromptParameters类以支持这些新参数。
This commit is contained in:
Windpicker-owo
2025-10-07 17:50:18 +08:00
parent ee51976095
commit 8142a12acb
2 changed files with 16 additions and 0 deletions

View File

@@ -67,6 +67,9 @@ def init_prompt():
{moderation_prompt}
不要复读你前面发过的内容,意思相近也不行。
不要浮夸,不要夸张修辞,平淡且不要输出多余内容(包括前后缀冒号和引号括号表情包at或 @等 ),只输出一条回复就好。
*你叫{bot_name},也有人叫你{bot_nickname}*
现在,你说:
""",
"default_expressor_prompt",
@@ -147,6 +150,8 @@ def init_prompt():
请注意不要输出多余内容(包括前后缀冒号和引号at或 @等 )。只输出回复内容。
{moderation_prompt}
*你叫{bot_name},也有人叫你{bot_nickname}*
现在,你说:
""",
"s4u_style_prompt",
@@ -214,6 +219,9 @@ If you need to use the search tool, please directly call the function "lpmm_sear
2. 可以分享你的看法、提出相关问题,或者开个合适的玩笑。
3. 目的是让对话更有趣、更深入。
最终请输出一条简短、完整且口语化的回复。
*你叫{bot_name},也有人叫你{bot_nickname}*
现在,你说:
""",
"normal_style_prompt",
@@ -1399,6 +1407,8 @@ class DefaultReplyer:
reply_target_block=reply_target_block,
mood_prompt=mood_prompt,
action_descriptions=action_descriptions,
bot_name=global_config.bot.nickname,
bot_nickname=",".join(global_config.bot.alias_names) if global_config.bot.alias_names else "",
)
# 使用新的统一Prompt系统 - 使用正确的模板名称
@@ -1554,6 +1564,8 @@ class DefaultReplyer:
# 添加已构建的表达习惯和关系信息
expression_habits_block=expression_habits_block,
relation_info_block=relation_info,
bot_name=global_config.bot.nickname,
bot_nickname=",".join(global_config.bot.alias_names) if global_config.bot.alias_names else "",
)
# 使用新的统一Prompt系统 - Expressor模式

View File

@@ -35,6 +35,8 @@ class PromptParameters:
reply_to: str = ""
extra_info: str = ""
prompt_mode: Literal["s4u", "normal", "minimal"] = "s4u"
bot_name: str = ""
bot_nickname: str = ""
# 功能开关
enable_tool: bool = True
@@ -450,6 +452,8 @@ class Prompt:
"reply_target_block": self.parameters.reply_target_block,
"mood_state": self.parameters.mood_prompt,
"action_descriptions": self.parameters.action_descriptions,
"bot_name": self.parameters.bot_name,
"bot_nickname": self.parameters.bot_nickname,
}
)