feat: 增强审核智能体页Word导出能力卡展示

This commit is contained in:
2026-06-04 02:49:27 +08:00
parent 08dcb62834
commit 20f3883b8c
3 changed files with 141 additions and 1 deletions

View File

@@ -433,6 +433,60 @@ def test_chat_page_uses_structured_formal_export_flag_when_node_status_is_comple
assert "/downloads/review-only.docx" in content
def test_chat_page_shows_word_export_field_table_and_governance_entries(client, db):
batch, conversation = _create_conversation_with_batch()
conversation.node_results = [
{"label": "资料包导入", "status": "已完成"},
{"label": "目录汇总", "status": "已完成"},
{"label": "法规完整性检查", "status": "已完成"},
{"label": "字段抽取", "status": "已完成"},
{"label": "一致性核查", "status": "已完成"},
{"label": "风险预警", "status": "已阻断"},
{"label": "Word 回填导出", "status": "待复核"},
{"label": "飞书通知", "status": "待处理"},
]
conversation.latest_summary = {
"structured_output": {
"output_type": "registration_word_export_report",
"template_name": "注册证导出模板",
"template_version": "V1.0",
"export_status": "draft_only",
"filled_fields": [
{
"placeholder": "{{ product_name }}",
"field_name": "产品名称",
"field_value": "新型冠状病毒 2019-nCoV 核酸检测试剂盒",
"source": "资料包主信息",
"fill_status": "filled",
"required": True,
}
],
"blocked_fields": [
{
"field_name": "产品名称跨文档不一致",
"block_reason": "待人工复核",
"risk_source": "registration_risk_report",
}
],
"download_url": "/media/exports/20260604/SUB-20260604-001-draft.docx",
}
}
conversation.save(update_fields=["node_results", "latest_summary", "updated_at"])
response = client.get(reverse("chat:detail", args=[conversation.conversation_id]))
content = response.content.decode("utf-8")
assert response.status_code == 200
assert "Word 导出能力卡" in content
assert "回填字段表" in content
assert "产品名称" in content
assert "资料包主信息" in content
assert "拦截项区" in content
assert "产品名称跨文档不一致" in content
assert "维护 Word 模板" in content
assert "维护字段映射" in content
def test_chat_upload_keeps_existing_conversation_binding_and_adds_documents(client, db):
batch, conversation = _create_conversation_with_batch()
existing_document = UploadedDocument.objects.create(