refactor(chat): 调整消息选择的优先级
在确定 `action_message` 时,优先使用 `target_message` 而不是 `message_data`。 这一变更优化了消息处理流程,确保在存在明确的目标消息时,系统能够正确地选择它,从而避免了潜在的逻辑冲突,使行为更加符合预期。 Co-authored-by: 雅诺狐 <212194964+foxcyber907@users.noreply.github.com> Co-authored-by: tt-P607 <68868379+tt-P607@users.noreply.github.com>
This commit is contained in:
committed by
Windpicker-owo
parent
31b06fb4a3
commit
58f58144d0
@@ -634,23 +634,22 @@ class HeartFChatting:
|
|||||||
logger.info(
|
logger.info(
|
||||||
f"{self.log_prefix}{global_config.bot.nickname} 原本想要回复:{content},但选择执行{action_type},不发表回复"
|
f"{self.log_prefix}{global_config.bot.nickname} 原本想要回复:{content},但选择执行{action_type},不发表回复"
|
||||||
)
|
)
|
||||||
|
else:
|
||||||
|
logger.warning(f"{self.log_prefix} 预生成的回复任务未生成有效内容")
|
||||||
|
|
||||||
return {
|
action_message = target_message or message_data
|
||||||
"action_type": "no_reply",
|
if action_type == "reply":
|
||||||
"success": True,
|
# 等待回复生成完毕
|
||||||
"reply_text": "",
|
if self.loop_mode == ChatMode.NORMAL:
|
||||||
"command": ""
|
# 只有在gen_task存在时才等待
|
||||||
}
|
if not gen_task:
|
||||||
elif action_info["action_type"] != "reply":
|
reply_to_str = await self.build_reply_to_str(message_data)
|
||||||
# 执行普通动作
|
gen_task = asyncio.create_task(
|
||||||
with Timer("动作执行", cycle_timers):
|
self._generate_response(
|
||||||
success, reply_text, command = await self._handle_action(
|
message_data=message_data,
|
||||||
action_info["action_type"],
|
available_actions=available_actions,
|
||||||
action_info["reasoning"],
|
reply_to=reply_to_str,
|
||||||
action_info["action_data"],
|
request_type="chat.replyer.normal",
|
||||||
cycle_timers,
|
|
||||||
thinking_id,
|
|
||||||
action_info["action_message"]
|
|
||||||
)
|
)
|
||||||
return {
|
return {
|
||||||
"action_type": action_info["action_type"],
|
"action_type": action_info["action_type"],
|
||||||
|
|||||||
Reference in New Issue
Block a user