初始化参数防止报错

pull/937/head
Bakadax 2025-05-15 11:00:29 +08:00
parent 8d2f71f9fe
commit 8fe0b4a133
1 changed files with 8 additions and 4 deletions

View File

@ -255,6 +255,10 @@ async def _build_prompt_focus(reason, current_mind_info, structured_info, chat_s
truncate=True, truncate=True,
) )
reply_style1_chosen = ""
reply_style2_chosen = ""
style_habbits_str = ""
grammar_habbits_str = ""
if is_group_chat and global_config.enable_expression_learner: if is_group_chat and global_config.enable_expression_learner:
# 从/data/expression/对应chat_id/expressions.json中读取表达方式 # 从/data/expression/对应chat_id/expressions.json中读取表达方式
( (
@ -347,13 +351,13 @@ async def _build_prompt_focus(reason, current_mind_info, structured_info, chat_s
prompt_personality=prompt_personality, prompt_personality=prompt_personality,
chat_target_2=chat_target_2, # Used in group template chat_target_2=chat_target_2, # Used in group template
current_mind_info=current_mind_info, current_mind_info=current_mind_info,
reply_style2=reply_style2_chosen if reply_style2_chosen else "", reply_style2=reply_style2_chosen,
reply_style1=reply_style1_chosen if reply_style1_chosen else "", reply_style1=reply_style1_chosen,
reason=reason, reason=reason,
prompt_ger=prompt_ger, prompt_ger=prompt_ger,
moderation_prompt=await global_prompt_manager.get_prompt_async("moderation_prompt"), moderation_prompt=await global_prompt_manager.get_prompt_async("moderation_prompt"),
style_habbits=style_habbits_str if style_habbits_str else "", style_habbits=style_habbits_str,
grammar_habbits=grammar_habbits_str if grammar_habbits_str else "", grammar_habbits=grammar_habbits_str,
# sender_name is not used in the group template # sender_name is not used in the group template
) )
else: # Private chat else: # Private chat