style: 统一飞书通知节点状态语义
This commit is contained in:
@@ -241,6 +241,28 @@ def build_detail_summary(log: AgentAuditLog, conversation, notifications) -> dic
|
||||
}
|
||||
|
||||
|
||||
def normalize_conversation_node_results(node_results: list[dict] | None) -> list[dict]:
|
||||
"""
|
||||
统一处理历史详情页的节点状态展示口径。
|
||||
|
||||
兼容历史上遗留的“飞书通知 / 已完成”节点状态,
|
||||
页面展示时统一映射为“已发送”。
|
||||
"""
|
||||
normalized = []
|
||||
for node in node_results or []:
|
||||
item = dict(node)
|
||||
if item.get("label") == "飞书通知":
|
||||
status = item.get("status", "")
|
||||
if status in {"已完成", "success", "sent"}:
|
||||
item["status"] = "已发送"
|
||||
elif status in {"failed", "error"}:
|
||||
item["status"] = "失败"
|
||||
elif status in {"pending", "processing"}:
|
||||
item["status"] = "待处理"
|
||||
normalized.append(item)
|
||||
return normalized
|
||||
|
||||
|
||||
def _get_risk_status_display_text(status: str) -> str:
|
||||
return RISK_STATUS_DISPLAY.get(status, status or "-")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user