feat: 增强审核智能体页风险与通知能力卡展示
This commit is contained in:
@@ -487,6 +487,62 @@ def test_chat_page_shows_word_export_field_table_and_governance_entries(client,
|
||||
assert "维护字段映射" in content
|
||||
|
||||
|
||||
def test_chat_page_shows_risk_and_notification_cards_from_conversation_summary(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_risk_report",
|
||||
"summary": "存在高风险项,需人工复核。",
|
||||
"highest_risk_level": "high",
|
||||
"pass_status": "blocked",
|
||||
"manual_review_items": ["CH1.11.5 沟通记录缺失"],
|
||||
"risk_items": [{"title": "产品名称跨文档不一致", "risk_level": "high"}],
|
||||
"owner_roles": [
|
||||
{
|
||||
"owner_role": "注册资料负责人",
|
||||
"owner_name": "张三",
|
||||
"department": "注册事务部",
|
||||
"chapter_scope": "CH1",
|
||||
"risk_scope": "字段冲突",
|
||||
"feishu_user_id": "ou_demo_1",
|
||||
"feishu_open_id": "on_demo_1",
|
||||
"feishu_name": "张三",
|
||||
"notify_enabled": True,
|
||||
}
|
||||
],
|
||||
"notify_reason": "task_completed",
|
||||
"mentioned_users": ["ou_demo_1"],
|
||||
"message_status": "sent",
|
||||
"web_detail_url": "https://example.com/audit/1",
|
||||
}
|
||||
}
|
||||
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 "风险预警能力卡" in content
|
||||
assert "总风险等级" in content
|
||||
assert "high" in content
|
||||
assert "注册资料负责人" in content
|
||||
assert "CH1.11.5 沟通记录缺失" in content
|
||||
assert "飞书通知能力卡" in content
|
||||
assert "task_completed" in content
|
||||
assert "sent" in content
|
||||
assert "ou_demo_1" 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(
|
||||
|
||||
Reference in New Issue
Block a user