通知留痕
diff --git a/tests/test_audit.py b/tests/test_audit.py
index 75fdcdb..36d690b 100644
--- a/tests/test_audit.py
+++ b/tests/test_audit.py
@@ -3,6 +3,7 @@ from django.urls import reverse
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 agent_core.tools.builtin_tools import query_demo_records
@@ -194,3 +195,35 @@ def test_audit_list_supports_batch_and_product_filters(client, db):
assert response.status_code == 200
assert "产品A" in content
assert "产品B" not in content
+
+
+def test_audit_detail_page_shows_conversation_node_results(client, db):
+ 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": "已阻断"},
+ {"label": "飞书通知", "status": "失败"},
+ ],
+ )
+ log = 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:detail", args=[log.id]))
+
+ content = response.content.decode("utf-8")
+ assert response.status_code == 200
+ assert "会话节点结果" in content
+ assert "风险预警 / 已阻断" in content
+ assert "飞书通知 / 失败" in content
diff --git a/tests/test_chat.py b/tests/test_chat.py
index a8daa12..c53923c 100644
--- a/tests/test_chat.py
+++ b/tests/test_chat.py
@@ -170,6 +170,7 @@ def test_chat_execution_creates_notification_record_from_agent_result(client, db
record = NotificationRecord.objects.get()
assert record.notify_reason == "task_completed"
assert record.batch_id == batch.batch_id
+ assert record.web_detail_url.endswith(f"/audit/{AgentAuditLog.objects.get().id}/")
def test_chat_execution_creates_failed_notification_record_and_updates_conversation(client, db, monkeypatch):
@@ -220,6 +221,7 @@ def test_chat_execution_creates_failed_notification_record_and_updates_conversat
conversation.refresh_from_db()
assert record.notify_reason == "task_failed"
assert record.message_status == "failed"
+ assert record.web_detail_url.endswith(f"/audit/{AgentAuditLog.objects.get().id}/")
assert conversation.task_status == "failed"
assert conversation.node_results[-1]["label"] == "飞书通知"