feat:优化了了auto模式切换逻辑

This commit is contained in:
SengokuCola
2025-06-14 13:09:13 +08:00
parent 8158f2cda4
commit bf0e813142
11 changed files with 190 additions and 131 deletions

View File

@@ -250,11 +250,38 @@ class EmojiAction(BaseAction):
return reply_text
class ChangeToFocusChatAction(BaseAction):
"""切换到专注聊天动作 - 从普通模式切换到专注模式"""
focus_activation_type = ActionActivationType.NEVER
normal_activation_type = ActionActivationType.NEVER
mode_enable = ChatMode.NORMAL
parallel_action = False
# 动作参数定义
action_parameters = {}
# 动作使用场景
action_require = [
"你想要进入专注聊天模式",
"聊天上下文中自己的回复条数较多超过3-4条",
"对话进行得非常热烈活跃",
"用户表现出深入交流的意图",
"话题需要更专注和深入的讨论"
]
async def execute(self) -> Tuple[bool, str]:
"""执行切换到专注聊天动作"""
logger.info(f"{self.log_prefix} 决定切换到专注聊天: {self.reasoning}")
# 这里只做决策标记,具体切换逻辑由上层管理器处理
return True, "决定切换到专注聊天模式"
class ExitFocusChatAction(BaseAction):
"""退出专注聊天动作 - 从专注模式切换到普通模式"""
# 激活设置
focus_activation_type = ActionActivationType.LLM_JUDGE
focus_activation_type = ActionActivationType.NEVER
normal_activation_type = ActionActivationType.NEVER
mode_enable = ChatMode.FOCUS
parallel_action = False
@@ -354,6 +381,13 @@ class CoreActionsPlugin(BasePlugin):
),
ExitFocusChatAction,
),
# 切换到专注聊天动作
(
ChangeToFocusChatAction.get_action_info(
name="change_to_focus_chat", description="切换到专注聊天,从普通模式切换到专注模式"
),
ChangeToFocusChatAction,
),
# 示例Command - Ping命令
(PingCommand.get_command_info(name="ping", description="测试机器人响应,拦截后续处理"), PingCommand),
# 示例Command - Log命令

View File

@@ -8,11 +8,11 @@ description = "展示新插件系统完整功能的示例插件"
# 组件启用控制
[components]
enable_greeting = true
enable_help = true
enable_send = true
enable_echo = true
enable_info = true
enable_greeting = false
enable_help = false
enable_send = false
enable_echo = false
enable_info = false
# 智能问候配置
[greeting]