diff --git a/apps/audit/services.py b/apps/audit/services.py
index 1262555..7eb9013 100644
--- a/apps/audit/services.py
+++ b/apps/audit/services.py
@@ -151,6 +151,7 @@ def build_detail_summary(log: AgentAuditLog, conversation, notifications) -> dic
详情页模板只负责展示,字段拼装与优先级判断统一放在服务层。
"""
structured_output = log.structured_output or {}
+ output_file = structured_output.get("output_file") or {}
export_node = None
if conversation and conversation.node_results:
export_node = next(
@@ -161,6 +162,13 @@ def build_detail_summary(log: AgentAuditLog, conversation, notifications) -> dic
return {
"export_status": structured_output.get("export_status") or (export_node or {}).get("status", "-"),
"download_url": structured_output.get("download_url", ""),
+ "output_file_name": output_file.get("file_name", ""),
+ "output_file_relative_path": output_file.get("relative_path", ""),
+ "export_mode": output_file.get("export_mode", ""),
+ "template_name": structured_output.get("template_name", ""),
+ "template_version": structured_output.get("template_version", ""),
+ "draft_export_status": structured_output.get("draft_export_status", ""),
+ "formal_export_status": structured_output.get("formal_export_status", ""),
"blocked_items": structured_output.get("blocked_items") or [],
"notification_receipt": latest_notification.receipt if latest_notification else {},
}
diff --git a/templates/audit/log_detail.html b/templates/audit/log_detail.html
index 7a15396..e23020b 100644
--- a/templates/audit/log_detail.html
+++ b/templates/audit/log_detail.html
@@ -57,6 +57,12 @@
导出状态摘要
- 导出状态
{{ detail_summary.export_status|default:"-" }}
+ - 输出文件名
{{ detail_summary.output_file_name|default:"-" }}
+ - 导出模式
{{ detail_summary.export_mode|default:"-" }}
+ - 模板名称
{{ detail_summary.template_name|default:"-" }}
+ - 模板版本
{{ detail_summary.template_version|default:"-" }}
+ - 草稿导出状态
{{ detail_summary.draft_export_status|default:"-" }}
+ - 正式导出状态
{{ detail_summary.formal_export_status|default:"-" }}
- 下载地址
{{ detail_summary.download_url|default:"-" }}
-
阻断项
diff --git a/tests/test_audit.py b/tests/test_audit.py
index b783dc1..1969f6e 100644
--- a/tests/test_audit.py
+++ b/tests/test_audit.py
@@ -451,3 +451,51 @@ def test_audit_detail_page_shows_export_summary_and_notification_receipt(client,
assert "风险项未清零" in content
assert "通知回执" in content
assert "msg-9" in content
+
+
+def test_audit_detail_page_shows_export_file_name_and_mode(client, db):
+ Conversation.objects.create(
+ conversation_id="conv-003",
+ title="产品C",
+ product_name="产品C",
+ batch_id="SUB-20260604-003",
+ task_status="success",
+ node_results=[
+ {"label": "Word 回填导出", "status": "待复核"},
+ {"label": "飞书通知", "status": "已完成"},
+ ],
+ )
+ log = create_audit_log(
+ "document_review",
+ "Word 回填导出",
+ "导出任务",
+ AgentResult(
+ answer="已生成导出草稿",
+ status="success",
+ structured_output={
+ "export_status": "draft_only",
+ "template_name": "注册证导出模板",
+ "template_version": "V1.0",
+ "download_url": "/media/exports/20260604/SUB-20260604-003-draft.docx",
+ "output_file": {
+ "file_name": "SUB-20260604-003-draft.docx",
+ "relative_path": "exports/20260604/SUB-20260604-003-draft.docx",
+ "export_mode": "draft",
+ },
+ },
+ ),
+ batch_id="SUB-20260604-003",
+ conversation_id="conv-003",
+ product_name="产品C",
+ )
+
+ response = client.get(reverse("audit:detail", args=[log.id]))
+
+ content = response.content.decode("utf-8")
+ assert response.status_code == 200
+ assert "输出文件名" in content
+ assert "SUB-20260604-003-draft.docx" in content
+ assert "导出模式" in content
+ assert "draft" in content
+ assert "模板版本" in content
+ assert "V1.0" in content