🤖 自动格式化代码 [skip ci]
This commit is contained in:
@@ -106,7 +106,7 @@ class NoReplyAction(BaseAction):
|
|||||||
while True:
|
while True:
|
||||||
current_time = time.time()
|
current_time = time.time()
|
||||||
elapsed_time = current_time - start_time
|
elapsed_time = current_time - start_time
|
||||||
|
|
||||||
if global_config.chat.chat_mode == "auto":
|
if global_config.chat.chat_mode == "auto":
|
||||||
# 检查是否超时
|
# 检查是否超时
|
||||||
if elapsed_time >= self._max_timeout:
|
if elapsed_time >= self._max_timeout:
|
||||||
@@ -121,14 +121,15 @@ class NoReplyAction(BaseAction):
|
|||||||
)
|
)
|
||||||
return True, exit_reason
|
return True, exit_reason
|
||||||
|
|
||||||
|
|
||||||
# **新增**:检查回复频率,决定是否退出专注模式
|
# **新增**:检查回复频率,决定是否退出专注模式
|
||||||
should_exit_focus = await self._check_frequency_and_exit_focus(current_time)
|
should_exit_focus = await self._check_frequency_and_exit_focus(current_time)
|
||||||
if should_exit_focus:
|
if should_exit_focus:
|
||||||
logger.info(f"{self.log_prefix} 检测到回复频率过高,退出专注模式")
|
logger.info(f"{self.log_prefix} 检测到回复频率过高,退出专注模式")
|
||||||
# 标记退出专注模式
|
# 标记退出专注模式
|
||||||
self.action_data["_system_command"] = "stop_focus_chat"
|
self.action_data["_system_command"] = "stop_focus_chat"
|
||||||
exit_reason = f"{global_config.bot.nickname}(你)发现自己回复太频繁了,决定退出专注模式,稍作休息"
|
exit_reason = (
|
||||||
|
f"{global_config.bot.nickname}(你)发现自己回复太频繁了,决定退出专注模式,稍作休息"
|
||||||
|
)
|
||||||
await self.store_action_info(
|
await self.store_action_info(
|
||||||
action_build_into_prompt=True,
|
action_build_into_prompt=True,
|
||||||
action_prompt_display=exit_reason,
|
action_prompt_display=exit_reason,
|
||||||
|
|||||||
Reference in New Issue
Block a user