feat: 增强注册审核节点式结果输出
This commit is contained in:
@@ -167,6 +167,8 @@ def _format_tool_calls(tool_calls: list[dict]) -> str:
|
||||
|
||||
|
||||
def _build_node_results(output_type: str, structured_output: dict) -> list[dict]:
|
||||
if output_type.startswith("registration_") or output_type == "feishu_notification_report":
|
||||
return _build_registration_node_results(output_type, structured_output)
|
||||
return [
|
||||
{
|
||||
"code": output_type,
|
||||
@@ -190,3 +192,58 @@ def _build_notification_payload(structured_output: dict, options: dict, status:
|
||||
"owners": owners,
|
||||
"status": status,
|
||||
}
|
||||
|
||||
|
||||
def _build_registration_node_results(output_type: str, structured_output: dict) -> list[dict]:
|
||||
nodes = [
|
||||
{"code": "package_import", "label": "资料包导入", "status": "已完成"},
|
||||
{"code": "overview", "label": "目录汇总", "status": "待处理"},
|
||||
{"code": "completeness", "label": "法规完整性检查", "status": "待处理"},
|
||||
{"code": "field_extraction", "label": "字段抽取", "status": "待处理"},
|
||||
{"code": "consistency", "label": "一致性核查", "status": "待处理"},
|
||||
{"code": "risk", "label": "风险预警", "status": "待处理"},
|
||||
{"code": "word_export", "label": "Word 回填导出", "status": "待处理"},
|
||||
{"code": "feishu_notify", "label": "飞书通知", "status": "待处理"},
|
||||
]
|
||||
progression_map = {
|
||||
"registration_overview_report": 1,
|
||||
"registration_completeness_report": 2,
|
||||
"registration_field_extraction_report": 3,
|
||||
"registration_consistency_report": 4,
|
||||
"registration_risk_report": 5,
|
||||
"registration_word_export_report": 6,
|
||||
"feishu_notification_report": 7,
|
||||
}
|
||||
completed_index = progression_map.get(output_type, 0)
|
||||
for index in range(1, completed_index + 1):
|
||||
nodes[index]["status"] = "已完成"
|
||||
|
||||
if output_type == "registration_risk_report":
|
||||
pass_status = structured_output.get("pass_status", "")
|
||||
if pass_status in {"blocked", "failed"}:
|
||||
nodes[5]["status"] = "已阻断"
|
||||
elif pass_status in {"review_required", "manual_review"}:
|
||||
nodes[5]["status"] = "待复核"
|
||||
else:
|
||||
nodes[5]["status"] = "已完成"
|
||||
return nodes
|
||||
|
||||
if output_type == "registration_word_export_report":
|
||||
export_status = structured_output.get("export_status", "")
|
||||
if export_status in {"blocked", "draft_only"}:
|
||||
nodes[6]["status"] = "已阻断" if export_status == "blocked" else "待复核"
|
||||
else:
|
||||
nodes[6]["status"] = "已完成"
|
||||
return nodes
|
||||
|
||||
if output_type == "feishu_notification_report":
|
||||
message_status = structured_output.get("message_status", "")
|
||||
if message_status in {"failed", "error"}:
|
||||
nodes[7]["status"] = "失败"
|
||||
elif message_status in {"sent", "success"}:
|
||||
nodes[7]["status"] = "已完成"
|
||||
else:
|
||||
nodes[7]["status"] = "待处理"
|
||||
return nodes
|
||||
|
||||
return nodes
|
||||
|
||||
Reference in New Issue
Block a user