fix:优化no_reply间隔时间,修复模式切换

This commit is contained in:
SengokuCola
2025-06-14 15:35:23 +08:00
parent e15a9b29ff
commit 2674a6601e
5 changed files with 70 additions and 17 deletions

View File

@@ -150,7 +150,6 @@ class HeartFCMessageReceiver:
Args:
message_data: 原始消息字符串
"""
message = None
try:
# 1. 消息解析与初始化
groupinfo = message.message_info.group_info

View File

@@ -131,6 +131,12 @@ class ActionModifier:
f"{self.log_prefix}传统动作修改完成,当前使用动作: {list(self.action_manager.get_using_actions().keys())}"
)
# === chat_mode检查强制移除非auto模式下的exit_focus_chat ===
if global_config.chat.chat_mode != "auto":
if "exit_focus_chat" in self.action_manager.get_using_actions():
self.action_manager.remove_action_from_using("exit_focus_chat")
logger.info(f"{self.log_prefix}移除动作: exit_focus_chat原因: chat_mode不为auto当前模式: {global_config.chat.chat_mode}")
# === 第二阶段:激活类型判定 ===
# 如果提供了聊天上下文,则进行激活类型判定
if chat_content is not None:
@@ -194,8 +200,12 @@ class ActionModifier:
# 恢复exit_focus_chat动作如果之前存在
if exit_focus_action:
self.action_manager.add_action_to_using("exit_focus_chat")
logger.debug(f"{self.log_prefix}恢复exit_focus_chat动作")
# 只有在auto模式下才恢复exit_focus_chat动作
if global_config.chat.chat_mode == "auto":
self.action_manager.add_action_to_using("exit_focus_chat")
logger.debug(f"{self.log_prefix}恢复exit_focus_chat动作")
else:
logger.debug(f"{self.log_prefix}跳过恢复exit_focus_chat动作原因: chat_mode不为auto当前模式: {global_config.chat.chat_mode}")
logger.info(f"{self.log_prefix}激活类型判定完成,最终可用动作: {list(final_activated_actions.keys())}")

View File

@@ -22,13 +22,13 @@ Prompt(
"""这是qq群聊的聊天记录请总结以下聊天记录的主题
{chat_logs}
请概括这段聊天记录的主题和主要内容
主题:简短的概括,包括时间,人物和事件,不要超过10个字
内容:具体的信息内容,包括人物、事件和信息,不要超过100个字不要分点。
主题:简短的概括,包括时间,人物和事件,不要超过20个字
内容:具体的信息内容,包括人物、事件和信息,不要超过200个字不要分点。
请用json格式返回格式如下
{{
"theme": "主题",
"content": "内容"
"theme": "主题,例如 2025-06-14 10:00:00 群聊 麦麦 和 网友 讨论了 游戏 的话题",
"content": "内容,可以是对聊天记录的概括,也可以是聊天记录的详细内容"
}}
""",
"chat_summary_group_prompt", # Template for group chat

View File

@@ -184,12 +184,13 @@ class NormalChatActionModifier:
activated_actions = {}
# 特殊处理 change_to_focus_chat 动作
if "change_to_focus_chat" in actions_with_info:
# 检查是否满足切换到focus模式的条件
if await self._check_should_switch_to_focus(recent_replies):
activated_actions["change_to_focus_chat"] = actions_with_info["change_to_focus_chat"]
logger.debug(f"{self.log_prefix} 特殊激活 change_to_focus_chat 动作,原因: 满足切换到focus模式条件")
return activated_actions
if global_config.chat.chat_mode == "auto":
if "change_to_focus_chat" in actions_with_info:
# 检查是否满足切换到focus模式的条件
if await self._check_should_switch_to_focus(recent_replies):
activated_actions["change_to_focus_chat"] = actions_with_info["change_to_focus_chat"]
logger.debug(f"{self.log_prefix} 特殊激活 change_to_focus_chat 动作,原因: 满足切换到focus模式条件")
return activated_actions
# 分类处理不同激活类型的actions
always_actions = {}