style: 对齐审核智能体节点与信息卡原型
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user