refactor(server): steward 意图改用声明式注册表编排
- 新增 steward_intent_registry,IntentDescriptor 统一描述意图的识别关键词、动作步骤构建、字段白名单与副作用集合,替代分散的 if/else - 新增 steward_intent_bootstrap 注册 expense_application 等意图;新增 steward_query_executors 提供差旅标准查询的无副作用执行与城市/席别标签化输出 - action_contracts/action_executor/graph_planner/intent_agent/model_plan_builder/planner_extraction/fallback 适配注册表,识别与执行分发自动从注册表取数 - 新增 intent_registry/query_executors 测试,更新 intent_agent 测试
This commit is contained in:
@@ -26,8 +26,21 @@ class StewardActionPlanBuilder:
|
||||
return plan.model_copy(update={"tasks": tasks, "action_steps": plan_steps})
|
||||
|
||||
def build_task_action_steps(self, task: StewardTask) -> list[StewardActionStep]:
|
||||
from app.services.steward_intent_registry import get_intent
|
||||
|
||||
intent = get_intent(task.task_type)
|
||||
if intent is not None:
|
||||
return intent.action_steps_builder(task)
|
||||
if task.task_type == "expense_application":
|
||||
return self._build_application_steps(task)
|
||||
return self.build_application_steps(task)
|
||||
if task.task_type == "reimbursement":
|
||||
return self.build_reimbursement_steps(task)
|
||||
return []
|
||||
|
||||
def build_application_steps(self, task: StewardTask) -> list[StewardActionStep]:
|
||||
return self._build_application_steps(task)
|
||||
|
||||
def build_reimbursement_steps(self, task: StewardTask) -> list[StewardActionStep]:
|
||||
return self._build_reimbursement_steps(task)
|
||||
|
||||
def _build_application_steps(self, task: StewardTask) -> list[StewardActionStep]:
|
||||
|
||||
Reference in New Issue
Block a user