refactor(planner): 移除大小脑规划器类型以简化决策流程
本次重构删除了`PlannerType`(大小脑规划器)的枚举及其在动作规划和组件定义中的相关逻辑。通过移除大小脑的概念,简化了`ActionPlanner`的决策过程,使其不再需要根据规划器类型来筛选可用动作。 这一变更统一了动作的处理方式,降低了系统的复杂性,使得未来的功能扩展和维护更加直接和清晰。
This commit is contained in:
committed by
Windpicker-owo
parent
eeca3a3dad
commit
474ab78002
@@ -28,7 +28,6 @@ from src.plugin_system.base.component_types import (
|
||||
ChatMode,
|
||||
ComponentType,
|
||||
ActionActivationType,
|
||||
PlannerType,
|
||||
)
|
||||
from src.plugin_system.core.component_registry import component_registry
|
||||
from src.schedule.schedule_manager import schedule_manager
|
||||
@@ -498,8 +497,6 @@ class ActionPlanner:
|
||||
try:
|
||||
sub_planner_actions: Dict[str, ActionInfo] = {}
|
||||
for action_name, action_info in available_actions.items():
|
||||
if action_info.planner_type not in [PlannerType.SMALL_BRAIN, PlannerType.ALL]:
|
||||
continue
|
||||
|
||||
if action_info.activation_type in [ActionActivationType.LLM_JUDGE, ActionActivationType.ALWAYS]:
|
||||
sub_planner_actions[action_name] = action_info
|
||||
@@ -548,15 +545,10 @@ class ActionPlanner:
|
||||
# --- 3. 大脑独立思考是否回复 ---
|
||||
action, reasoning, action_data, target_message = "no_reply", "大脑初始化默认", {}, None
|
||||
try:
|
||||
big_brain_actions = {
|
||||
name: info
|
||||
for name, info in available_actions.items()
|
||||
if info.planner_type in [PlannerType.BIG_BRAIN, PlannerType.ALL]
|
||||
}
|
||||
prompt, _ = await self.build_planner_prompt(
|
||||
is_group_chat=is_group_chat,
|
||||
chat_target_info=chat_target_info,
|
||||
current_available_actions=big_brain_actions,
|
||||
current_available_actions={},
|
||||
mode=mode,
|
||||
chat_content_block_override=chat_content_block,
|
||||
message_id_list_override=message_id_list,
|
||||
|
||||
@@ -6,7 +6,7 @@ from typing import Tuple, Optional, Dict, Any
|
||||
|
||||
from src.common.logger import get_logger
|
||||
from src.chat.message_receive.chat_stream import ChatStream
|
||||
from src.plugin_system.base.component_types import ActionActivationType, ChatMode, ActionInfo, ComponentType, ChatType,PlannerType
|
||||
from src.plugin_system.base.component_types import ActionActivationType, ChatMode, ActionInfo, ComponentType, ChatType,
|
||||
from src.plugin_system.apis import send_api, database_api, message_api
|
||||
|
||||
|
||||
@@ -92,7 +92,6 @@ class BaseAction(ABC):
|
||||
self.parallel_action: bool = getattr(self.__class__, "parallel_action", True)
|
||||
self.associated_types: list[str] = getattr(self.__class__, "associated_types", []).copy()
|
||||
self.chat_type_allow: ChatType = getattr(self.__class__, "chat_type_allow", ChatType.ALL)
|
||||
self.planner_type: PlannerType = getattr(self.__class__, "planner_type", ChatType.ALL)
|
||||
|
||||
|
||||
# =============================================================================
|
||||
|
||||
@@ -51,17 +51,6 @@ class ChatMode(Enum):
|
||||
|
||||
|
||||
# 聊天类型枚举
|
||||
class PlannerType(Enum):
|
||||
"""规划器类型枚举"""
|
||||
|
||||
BIG_BRAIN = "big_brain" # 大脑,负责宏观决策
|
||||
SMALL_BRAIN = "small_brain" # 小脑,负责具体动作
|
||||
ALL = "all" # 通用
|
||||
|
||||
def __str__(self):
|
||||
return self.value
|
||||
|
||||
|
||||
class ChatType(Enum):
|
||||
"""聊天类型枚举,用于限制插件在不同聊天环境中的使用"""
|
||||
|
||||
@@ -152,7 +141,6 @@ class ActionInfo(ComponentInfo):
|
||||
mode_enable: ChatMode = ChatMode.ALL
|
||||
parallel_action: bool = False
|
||||
chat_type_allow: ChatType = ChatType.ALL # 允许的聊天类型
|
||||
planner_type: PlannerType = PlannerType.ALL
|
||||
|
||||
def __post_init__(self):
|
||||
super().__post_init__()
|
||||
|
||||
Reference in New Issue
Block a user