refactor(server): steward 决策链路改用 LangGraph 编排
- 新增 StewardGraphPlannerService,用 LangGraph 状态图编排意图识别→流程判断→模型/规则分支→兜底,替代原 planner 内线性调用 - 新增 StewardGraphRuntimeService 编排运行时决策与槽位决策;StewardActionContracts/Executor 统一动作合约与执行 - steward_intent_agent/application_fact_resolver/runtime_chat 适配图执行器,config 暴露图相关开关 - pyproject/uv.lock 新增 langgraph 依赖 - 新增 graph_planner/graph_runtime/action_executor 测试,更新 intent_agent/planner/fact_resolver/runtime_chat/reimbursement 测试
This commit is contained in:
@@ -133,6 +133,7 @@ class StewardPlannerExtractionMixin:
|
||||
summary=self._build_task_summary(draft.segment, fields),
|
||||
status="needs_confirmation",
|
||||
confidence=self._resolve_task_confidence(draft.segment, fields, draft.task_type),
|
||||
requested_action=self._resolve_requested_action(draft.segment), # type: ignore[arg-type]
|
||||
ontology_fields=fields,
|
||||
missing_fields=missing_fields,
|
||||
confirmation_required=True,
|
||||
@@ -205,6 +206,15 @@ class StewardPlannerExtractionMixin:
|
||||
def _extract_transport_mode(segment: str) -> str:
|
||||
return ApplicationFactResolver.extract_transport_mode(segment)
|
||||
|
||||
@staticmethod
|
||||
def _resolve_requested_action(segment: str) -> str:
|
||||
compact = re.sub(r"\s+", "", segment)
|
||||
if re.search(r"直接提交|提交申请|确认提交|提交审批", compact):
|
||||
return "submit"
|
||||
if re.search(r"保存草稿|存草稿|先保存|保存", compact):
|
||||
return "save_draft"
|
||||
return "preview"
|
||||
|
||||
@staticmethod
|
||||
def _resolve_missing_fields(task_type: str, fields: dict[str, str]) -> list[str]:
|
||||
required = ["expense_type", "time_range", "reason"]
|
||||
@@ -575,4 +585,3 @@ class StewardPlannerExtractionMixin:
|
||||
@staticmethod
|
||||
def _clean_text(value: Any) -> str:
|
||||
return re.sub(r"\s+", " ", str(value or "")).strip()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user