feat: 增强处理历史页指标与上下文跳转
This commit is contained in:
@@ -144,6 +144,28 @@ def build_history_rows(logs) -> list[dict]:
|
||||
return rows
|
||||
|
||||
|
||||
def build_history_metrics(history_rows: list[dict]) -> list[dict]:
|
||||
"""
|
||||
为处理历史页生成顶部指标卡。
|
||||
|
||||
口径保持前台可讲解:
|
||||
- 处理任务数:当前筛选结果中的执行记录数
|
||||
- 成功执行:状态为 success 的记录数
|
||||
- 通知已发送:通知状态为 sent 的记录数
|
||||
- 高风险阻断:风险等级为 high 的记录数
|
||||
"""
|
||||
total_count = len(history_rows)
|
||||
success_count = sum(1 for row in history_rows if row["log"].status == "success")
|
||||
notify_sent_count = sum(1 for row in history_rows if row.get("notify_status") == "sent")
|
||||
blocked_count = sum(1 for row in history_rows if row.get("risk_status") == "high")
|
||||
return [
|
||||
{"label": "处理任务数", "value": total_count, "note": "按当前筛选条件回看执行留痕。"},
|
||||
{"label": "成功执行", "value": success_count, "note": "执行完成并写入审计快照。"},
|
||||
{"label": "通知已发送", "value": notify_sent_count, "note": "已生成 sent 状态的通知留痕。"},
|
||||
{"label": "高风险阻断", "value": blocked_count, "note": "风险等级为 high 的处理记录。"},
|
||||
]
|
||||
|
||||
|
||||
def build_detail_summary(log: AgentAuditLog, conversation, notifications) -> dict:
|
||||
"""
|
||||
组装处理历史详情页的导出摘要与通知回执信息。
|
||||
|
||||
Reference in New Issue
Block a user