feat: 增强处理历史页指标与上下文跳转

This commit is contained in:
2026-06-04 03:13:28 +08:00
parent 0f989f4c95
commit 5a4a176108
4 changed files with 140 additions and 10 deletions

View File

@@ -399,6 +399,66 @@ def test_audit_list_shows_batch_scale_and_conversation_status(client, db):
assert "待复核" in content
def test_audit_list_shows_history_metrics_and_context_links(client, db):
SubmissionBatch.objects.create(
batch_id="SUB-20260604-009",
product_name="产品C",
workflow_type="registration",
conversation_id="conv-009",
file_count=5,
page_count=31,
import_status="completed",
)
Conversation.objects.create(
conversation_id="conv-009",
title="产品C",
product_name="产品C",
batch_id="SUB-20260604-009",
task_status="success",
node_results=[
{"label": "风险预警", "status": "已完成"},
{"label": "飞书通知", "status": "已完成"},
],
)
create_audit_log(
"document_review",
"注册审核智能体",
"产品C 审核",
AgentResult(
answer="完成",
status="success",
structured_output={"highest_risk_level": "medium"},
),
batch_id="SUB-20260604-009",
conversation_id="conv-009",
product_name="产品C",
)
create_notification_record(
batch_id="SUB-20260604-009",
conversation_id="conv-009",
product_name="产品C",
trigger_source="risk_report",
notify_reason="task_completed",
owner_role="注册资料负责人",
feishu_user_id="ou_demo_9",
message_status="sent",
web_detail_url="https://example.com/detail/9",
receipt={"message_id": "msg-9"},
)
response = client.get(reverse("audit:list"))
content = response.content.decode("utf-8")
assert response.status_code == 200
assert "处理任务数" in content
assert "成功执行" in content
assert "通知已发送" in content
assert "高风险阻断" in content
assert reverse("chat:detail", args=["conv-009"]) in content
assert f"{reverse('documents:list')}?keyword=SUB-20260604-009" in content
assert f"{reverse('audit:list')}?keyword=产品C" in content
def test_audit_detail_page_shows_export_summary_and_notification_receipt(client, db):
Conversation.objects.create(
conversation_id="conv-002",