feat(regulatory): 展示法规核查工作流卡片
This commit is contained in:
@@ -26,6 +26,7 @@ def batch_status(request, batch_id: int):
|
||||
"status": batch.status,
|
||||
"source_summary_batch_id": batch.source_summary_batch_id,
|
||||
"risk_summary": batch.risk_summary,
|
||||
"risk_summary_text": _format_risk_summary(batch.risk_summary or {}),
|
||||
"error_message": batch.error_message,
|
||||
},
|
||||
"nodes": [
|
||||
@@ -40,3 +41,18 @@ def batch_status(request, batch_id: int):
|
||||
],
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
def _format_risk_summary(risk_summary: dict) -> str:
|
||||
labels = [
|
||||
("blocking", "阻断项"),
|
||||
("high", "高风险"),
|
||||
("medium", "中风险"),
|
||||
("low", "低风险"),
|
||||
("info", "提示"),
|
||||
]
|
||||
return " · ".join(
|
||||
f"{label} {int(risk_summary.get(key) or 0)}"
|
||||
for key, label in labels
|
||||
if int(risk_summary.get(key) or 0)
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user