style: 对齐审核智能体节点与信息卡原型

This commit is contained in:
2026-06-04 00:58:11 +08:00
parent cac9a4aaeb
commit b8381b3ba1
4 changed files with 105 additions and 6 deletions

View File

@@ -14,13 +14,23 @@ def create_conversation_for_batch(batch_id: str, product_name: str) -> Conversat
product_name=product_name,
batch_id=batch_id,
task_status=Conversation.STATUS_PENDING,
node_results=[
{"code": "package_import", "label": "资料包导入", "status": "已完成"},
{"code": "overview", "label": "目录汇总", "status": "处理中"},
],
node_results=_build_initial_node_results(),
)
return conversation
def _generate_conversation_id() -> str:
return f"conv-{Conversation.objects.count() + 1:03d}"
def _build_initial_node_results() -> list[dict]:
return [
{"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": "待处理"},
]

View File

@@ -72,6 +72,7 @@ def detail(request, conversation_id: str):
)
_persist_notification_records(result)
active_node = "risk"
workspace_summary = _build_workspace_summary(conversation, batch)
return render(
request,
@@ -88,6 +89,7 @@ def detail(request, conversation_id: str):
"task_modes": task_modes,
"node_results": conversation.node_results,
"active_node": active_node,
"workspace_summary": workspace_summary,
},
)
@@ -110,3 +112,20 @@ def _persist_notification_records(result: AgentResult) -> None:
web_detail_url="",
receipt={"status": result.status},
)
def _build_workspace_summary(conversation: Conversation, batch: SubmissionBatch | None) -> dict:
node_status_map = {node.get("label"): node.get("status", "") for node in conversation.node_results}
risk_status = node_status_map.get("风险预警", "待处理")
notify_status = node_status_map.get("飞书通知", "待处理")
export_status = node_status_map.get("Word 回填导出", "待处理")
highest_risk_level = "" if risk_status in {"已阻断", "待复核"} else ""
export_allowed = "" if risk_status in {"已阻断", "待复核"} else ""
return {
"highest_risk_level": highest_risk_level,
"export_allowed": export_allowed,
"notify_status": notify_status,
"export_status": export_status,
"file_count": batch.file_count if batch else 0,
"page_count": batch.page_count if batch else 0,
}