feat: 收口通知原因语义与留痕校验
This commit is contained in:
@@ -181,8 +181,9 @@ def _build_node_results(output_type: str, structured_output: dict) -> list[dict]
|
||||
|
||||
|
||||
def _build_notification_payload(structured_output: dict, options: dict, status: str) -> dict:
|
||||
notify_reason = structured_output.get("notify_reason") or (
|
||||
"task_completed" if status == "success" else "task_failed"
|
||||
notify_reason = _normalize_notify_reason(
|
||||
structured_output.get("notify_reason"),
|
||||
status=status,
|
||||
)
|
||||
owners = structured_output.get("owner_roles") or []
|
||||
if not owners:
|
||||
@@ -202,6 +203,15 @@ def _build_notification_payload(structured_output: dict, options: dict, status:
|
||||
}
|
||||
|
||||
|
||||
def _normalize_notify_reason(notify_reason: str | None, *, status: str) -> str:
|
||||
"""
|
||||
将通知原因收口到 Demo 固定支持的两类语义。
|
||||
"""
|
||||
if notify_reason in {"task_completed", "task_failed"}:
|
||||
return notify_reason
|
||||
return "task_completed" if status == "success" else "task_failed"
|
||||
|
||||
|
||||
def _build_registration_node_results(output_type: str, structured_output: dict) -> list[dict]:
|
||||
nodes = [
|
||||
{"code": "package_import", "label": "资料包导入", "status": "已完成"},
|
||||
|
||||
Reference in New Issue
Block a user