feat: 支持处理历史按风险状态筛选
This commit is contained in:
@@ -117,6 +117,7 @@ def build_history_rows(logs) -> list[dict]:
|
||||
or structured_output.get("risk_level")
|
||||
or "-",
|
||||
"notify_status": notification.message_status if notification else "-",
|
||||
"notify_reason": notification.notify_reason if notification else "-",
|
||||
}
|
||||
)
|
||||
return rows
|
||||
|
||||
@@ -10,6 +10,7 @@ def log_list(request):
|
||||
scenario_id = (request.GET.get("scenario_id") or "").strip()
|
||||
keyword = (request.GET.get("keyword") or "").strip()
|
||||
notify_status = (request.GET.get("notify_status") or "").strip()
|
||||
risk_status = (request.GET.get("risk_status") or "").strip()
|
||||
logs = AgentAuditLog.objects.all()
|
||||
if scenario_id:
|
||||
logs = logs.filter(scenario_id=scenario_id)
|
||||
@@ -27,6 +28,13 @@ def log_list(request):
|
||||
for log in logs
|
||||
if (log.batch_id, log.conversation_id) in matched_pairs
|
||||
]
|
||||
if risk_status:
|
||||
logs = [
|
||||
log
|
||||
for log in logs
|
||||
if (log.structured_output or {}).get("highest_risk_level") == risk_status
|
||||
or (log.structured_output or {}).get("risk_level") == risk_status
|
||||
]
|
||||
return render(
|
||||
request,
|
||||
"audit/log_list.html",
|
||||
@@ -35,6 +43,7 @@ def log_list(request):
|
||||
"selected_scenario_id": scenario_id,
|
||||
"keyword": keyword,
|
||||
"notify_status": notify_status,
|
||||
"risk_status": risk_status,
|
||||
},
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user