diff --git a/apps/audit/services.py b/apps/audit/services.py
index fcabe6d..be7ee39 100644
--- a/apps/audit/services.py
+++ b/apps/audit/services.py
@@ -1,4 +1,6 @@
from agent_core.results import AgentResult
+from apps.chat.models import Conversation
+from apps.documents.models import SubmissionBatch
from .models import AgentAuditLog, NotificationRecord
@@ -106,13 +108,32 @@ def build_history_rows(logs) -> list[dict]:
(item.batch_id, item.conversation_id): item
for item in NotificationRecord.objects.order_by("-created_at")
}
+ batch_map = {
+ item.batch_id: item
+ for item in SubmissionBatch.objects.filter(
+ batch_id__in=[log.batch_id for log in logs if log.batch_id]
+ )
+ }
+ conversation_map = {
+ item.conversation_id: item
+ for item in Conversation.objects.filter(
+ conversation_id__in=[log.conversation_id for log in logs if log.conversation_id]
+ )
+ }
rows = []
for log in logs:
notification = notification_map.get((log.batch_id, log.conversation_id))
+ batch = batch_map.get(log.batch_id)
+ conversation = conversation_map.get(log.conversation_id)
structured_output = log.structured_output or {}
rows.append(
{
"log": log,
+ "batch": batch,
+ "conversation": conversation,
+ "batch_scale": f"{batch.file_count} 份 / {batch.page_count} 页" if batch else "-",
+ "batch_status": batch.get_import_status_display_text() if batch else "-",
+ "conversation_status": conversation.task_status if conversation else "-",
"risk_status": structured_output.get("highest_risk_level")
or structured_output.get("risk_level")
or "-",
diff --git a/templates/audit/log_list.html b/templates/audit/log_list.html
index db3cdb2..9444d6f 100644
--- a/templates/audit/log_list.html
+++ b/templates/audit/log_list.html
@@ -61,6 +61,9 @@
产品名称 |
批次号 |
会话 |
+ 资料规模 |
+ 资料包状态 |
+ 会话状态 |
输入摘要 |
状态 |
风险状态 |
@@ -79,6 +82,9 @@
{{ row.log.product_name|default:"-" }} |
{{ row.log.batch_id|default:"-" }} |
{{ row.log.conversation_id|default:"-" }} |
+ {{ row.batch_scale }} |
+ {{ row.batch_status }} |
+ {{ row.conversation_status }} |
{{ row.log.get_user_input_summary }} |
{{ row.log.get_status_display_text }}
@@ -91,7 +97,7 @@
| 查看详情 |
{% empty %}
- | 暂无处理历史,先去执行一次审核任务。 |
+ | 暂无处理历史,先去执行一次审核任务。 |
{% endfor %}
diff --git a/tests/test_audit.py b/tests/test_audit.py
index be7f2b1..b6341bf 100644
--- a/tests/test_audit.py
+++ b/tests/test_audit.py
@@ -4,6 +4,7 @@ from agent_core.results import AgentResult
from apps.audit.models import AgentAuditLog, DemoBusinessRecord, NotificationRecord
from apps.audit.services import create_audit_log, create_notification_record
from apps.chat.models import Conversation
+from apps.documents.models import SubmissionBatch
from agent_core.tools.builtin_tools import query_demo_records
@@ -354,3 +355,45 @@ def test_audit_detail_page_shows_conversation_node_results(client, db):
assert "会话节点结果" in content
assert "风险预警 / 已阻断" in content
assert "飞书通知 / 失败" in content
+
+
+def test_audit_list_shows_batch_scale_and_conversation_status(client, db):
+ SubmissionBatch.objects.create(
+ batch_id="SUB-20260604-001",
+ product_name="产品A",
+ workflow_type="registration",
+ conversation_id="conv-001",
+ file_count=4,
+ page_count=26,
+ import_status="review_required",
+ )
+ Conversation.objects.create(
+ conversation_id="conv-001",
+ title="产品A",
+ product_name="产品A",
+ batch_id="SUB-20260604-001",
+ task_status="failed",
+ node_results=[
+ {"label": "风险预警", "status": "已阻断"},
+ {"label": "飞书通知", "status": "失败"},
+ ],
+ )
+ create_audit_log(
+ "document_review",
+ "注册审核智能体",
+ "问题一",
+ AgentResult(answer="回答一", status="failed"),
+ batch_id="SUB-20260604-001",
+ conversation_id="conv-001",
+ product_name="产品A",
+ )
+
+ response = client.get(reverse("audit:list"))
+
+ content = response.content.decode("utf-8")
+ assert response.status_code == 200
+ assert "资料规模" in content
+ assert "4 份 / 26 页" in content
+ assert "会话状态" in content
+ assert "failed" in content
+ assert "待复核" in content