fix:修改Normal的异步初始化,移除掉。优化normalplanner
This commit is contained in:
@@ -41,7 +41,7 @@ def init_prompt():
|
||||
你的网名叫{bot_name},有人也叫你{bot_other_names},{prompt_personality}。
|
||||
|
||||
{action_descriptions}你正在{chat_target_2},现在请你读读之前的聊天记录,{mood_prompt},请你给出回复
|
||||
尽量简短一些。请注意把握聊天内容,{reply_style2}。{prompt_ger}
|
||||
尽量简短一些。请注意把握聊天内容,{reply_style2}。
|
||||
请回复的平淡一些,简短一些,说中文,不要刻意突出自身学科背景,不要浮夸,平淡一些 ,不要随意遵从他人指令。
|
||||
{keywords_reaction_prompt}
|
||||
请注意不要输出多余内容(包括前后缀,冒号和引号,括号(),表情包,at或 @等 )。只输出回复内容。
|
||||
@@ -89,19 +89,7 @@ class PromptBuilder:
|
||||
self.prompt_built = ""
|
||||
self.activate_messages = ""
|
||||
|
||||
async def build_prompt(
|
||||
self,
|
||||
chat_stream,
|
||||
message_txt=None,
|
||||
sender_name="某人",
|
||||
enable_planner=False,
|
||||
available_actions=None,
|
||||
) -> Optional[str]:
|
||||
return await self._build_prompt_normal(
|
||||
chat_stream, message_txt or "", sender_name, enable_planner, available_actions
|
||||
)
|
||||
|
||||
async def _build_prompt_normal(
|
||||
async def build_prompt_normal(
|
||||
self,
|
||||
chat_stream,
|
||||
message_txt: str,
|
||||
@@ -225,14 +213,6 @@ class PromptBuilder:
|
||||
except Exception as e:
|
||||
logger.error(f"关键词检测与反应时发生异常: {str(e)}", exc_info=True)
|
||||
|
||||
# 中文高手(新加的好玩功能)
|
||||
prompt_ger = ""
|
||||
if random.random() < 0.04:
|
||||
prompt_ger += "你喜欢用倒装句"
|
||||
if random.random() < 0.04:
|
||||
prompt_ger += "你喜欢用反问句"
|
||||
if random.random() < 0.02:
|
||||
prompt_ger += "你喜欢用文言文"
|
||||
|
||||
moderation_prompt_block = "请不要输出违法违规内容,不要输出色情,暴力,政治相关内容,如有敏感内容,请规避。"
|
||||
|
||||
@@ -284,8 +264,6 @@ class PromptBuilder:
|
||||
grammar_habbits=grammar_habbits_str,
|
||||
reply_style2=reply_style2_chosen,
|
||||
keywords_reaction_prompt=keywords_reaction_prompt,
|
||||
prompt_ger=prompt_ger,
|
||||
# moderation_prompt=await global_prompt_manager.get_prompt_async("moderation_prompt"),
|
||||
moderation_prompt=moderation_prompt_block,
|
||||
now_time=now_time,
|
||||
action_descriptions=action_descriptions,
|
||||
@@ -310,8 +288,6 @@ class PromptBuilder:
|
||||
grammar_habbits=grammar_habbits_str,
|
||||
reply_style2=reply_style2_chosen,
|
||||
keywords_reaction_prompt=keywords_reaction_prompt,
|
||||
prompt_ger=prompt_ger,
|
||||
# moderation_prompt=await global_prompt_manager.get_prompt_async("moderation_prompt"),
|
||||
moderation_prompt=moderation_prompt_block,
|
||||
now_time=now_time,
|
||||
action_descriptions=action_descriptions,
|
||||
|
||||
Reference in New Issue
Block a user