From 47f887647bfdea892de1e789c54544c9498f5b4b Mon Sep 17 00:00:00 2001 From: bruce Date: Thu, 4 Jun 2026 04:41:09 +0800 Subject: [PATCH] =?UTF-8?q?test:=20=E8=A1=A5=E5=BC=BA=E5=AE=A1=E6=A0=B8?= =?UTF-8?q?=E6=99=BA=E8=83=BD=E4=BD=93=E5=85=B3=E9=94=AE=E4=B8=8A=E4=B8=8B?= =?UTF-8?q?=E6=96=87=E5=AD=97=E6=AE=B5=E8=AF=81=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tests/test_chat.py | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/tests/test_chat.py b/tests/test_chat.py index f1bd023..35daa87 100644 --- a/tests/test_chat.py +++ b/tests/test_chat.py @@ -475,6 +475,45 @@ def test_chat_page_shows_top_context_and_recommended_prompts(client, db): assert "请给出当前资料包的高风险项、责任人和整改建议" in content +def test_chat_page_explicitly_shows_batch_product_stage_and_export_context(client, db): + batch, conversation = _create_conversation_with_batch() + conversation.task_status = "processing" + 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": { + "can_export_formally": False, + } + } + conversation.save(update_fields=["task_status", "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 f"批次:{batch.batch_id}" in content + assert f"产品:{batch.product_name}" in content + assert "阶段:处理中" in content + assert "批次编号" in content + assert batch.batch_id in content + assert "产品名称" in content + assert batch.product_name in content + assert "当前审核阶段" in content + assert "处理中" in content + assert "当前最高风险等级" in content + assert ">高<" in content + assert "是否允许正式导出" in content + assert ">否<" in content + + def test_chat_page_shows_overview_card_from_conversation_summary(client, db): batch, conversation = _create_conversation_with_batch() conversation.latest_summary = {