上传区
-资料包导入入口在资料包页统一维护,当前会话只展示绑定关系。
+右侧保留资料包上传入口和当前会话的资料上下文。
{% if batch %}- @@ -120,6 +120,7 @@
动态信息卡
-
+
-
+ 最高风险等级
+ {{ workspace_summary.highest_risk_level }}+
+
-
+ 是否允许正式导出
+ {{ workspace_summary.export_allowed }}+
+
-
+ 通知状态
+ {{ workspace_summary.notify_status }}+
+
-
+ 导出状态
+ {{ workspace_summary.export_status }}+
- 当前会话围绕 `conversation_id / batch_id / product_name` 串联。 -
- 任务模式:目录汇总、完整性检查、字段抽取、一致性核查、风险预警。 {% if audit_log %}
- 查看本次处理历史 {% endif %} diff --git a/tests/test_chat.py b/tests/test_chat.py index 5477878..e314a49 100644 --- a/tests/test_chat.py +++ b/tests/test_chat.py @@ -4,6 +4,7 @@ from agent_core.results import AgentResult from apps.audit.models import AgentAuditLog from apps.audit.models import NotificationRecord from apps.chat.models import Conversation +from apps.chat.services import create_conversation_for_batch from apps.documents.models import SubmissionBatch, UploadedDocument @@ -169,3 +170,56 @@ 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 + + +def test_create_conversation_for_batch_initializes_eight_workflow_nodes(db): + conversation = create_conversation_for_batch( + "SUB-20260604-001", + "新型冠状病毒 2019-nCoV 核酸检测试剂盒", + ) + + labels = [node["label"] for node in conversation.node_results] + assert len(labels) == 8 + assert labels == [ + "资料包导入", + "目录汇总", + "法规完整性检查", + "字段抽取", + "一致性核查", + "风险预警", + "Word 回填导出", + "飞书通知", + ] + + +def test_chat_page_shows_upload_entry_and_dynamic_context_cards(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.save(update_fields=["node_results"]) + UploadedDocument.objects.create( + batch=batch, + scenario_id="document_review", + original_name="说明书.md", + file_type="md", + size=1, + status=UploadedDocument.STATUS_INDEXED, + ) + + 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 "是否允许正式导出" in content + assert "通知状态" in content + assert "飞书通知 / 待处理" in content