解决UnboundLocalError
This commit is contained in:
@@ -651,9 +651,11 @@ class DefaultReplyer:
|
||||
action_name = action_plan_info.action_type
|
||||
if action_name == "reply":
|
||||
continue
|
||||
action_description: str = "无描述"
|
||||
reasoning: str = "无原因"
|
||||
if action := available_actions.get(action_name):
|
||||
action_description = action.description or "无描述"
|
||||
reasoning = action_plan_info.reasoning or "无原因"
|
||||
action_description = action.description or action_description
|
||||
reasoning = action_plan_info.reasoning or reasoning
|
||||
|
||||
chosen_action_descriptions += f"- {action_name}: {action_description},原因:{reasoning}\n"
|
||||
|
||||
@@ -705,22 +707,22 @@ class DefaultReplyer:
|
||||
is_group_chat = bool(chat_stream.group_info)
|
||||
platform = chat_stream.platform
|
||||
|
||||
user_id = "用户ID"
|
||||
person_name = "用户"
|
||||
sender = "用户"
|
||||
target = "消息"
|
||||
|
||||
if reply_message:
|
||||
user_id = reply_message.user_info.user_id
|
||||
person = Person(platform=platform, user_id=user_id)
|
||||
person_name = person.person_name or user_id
|
||||
sender = person_name
|
||||
target = reply_message.processed_plain_text
|
||||
else:
|
||||
person_name = "用户"
|
||||
sender = "用户"
|
||||
target = "消息"
|
||||
|
||||
mood_prompt: str = ""
|
||||
if global_config.mood.enable_mood:
|
||||
chat_mood = mood_manager.get_mood_by_chat_id(chat_id)
|
||||
mood_prompt = chat_mood.mood_state
|
||||
else:
|
||||
mood_prompt = ""
|
||||
|
||||
target = replace_user_references(target, chat_stream.platform, replace_bot_name=True)
|
||||
|
||||
@@ -939,9 +941,7 @@ class DefaultReplyer:
|
||||
else:
|
||||
chat_target_name = "对方"
|
||||
if self.chat_target_info:
|
||||
chat_target_name = (
|
||||
self.chat_target_info.person_name or self.chat_target_info.user_nickname or "对方"
|
||||
)
|
||||
chat_target_name = self.chat_target_info.person_name or self.chat_target_info.user_nickname or "对方"
|
||||
chat_target_1 = await global_prompt_manager.format_prompt(
|
||||
"chat_target_private1", sender_name=chat_target_name
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user