From 61bcb2ef86a2e349fbcb023d2303cd3c0d3d5d9c Mon Sep 17 00:00:00 2001 From: meijiali <你的邮箱@xxx.com> Date: Fri, 3 Jul 2026 18:02:01 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BC=98=E5=8C=96=E6=8A=A5=E5=91=8A?= =?UTF-8?q?=E6=9C=AA=E7=94=9F=E6=88=90=E6=97=B6=E7=9A=84=E5=AF=BC=E5=87=BA?= =?UTF-8?q?=E6=8F=90=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/templates/hotspots/report.html | 1 + app/templates/items/detail.html | 1 + docs/MVP-WorkOrders.md | 26 ++++++++++++++++++++++++++ tests/integration/test_routes.py | 4 ++++ 4 files changed, 32 insertions(+) diff --git a/app/templates/hotspots/report.html b/app/templates/hotspots/report.html index 40d74c9..781e9d9 100644 --- a/app/templates/hotspots/report.html +++ b/app/templates/hotspots/report.html @@ -30,6 +30,7 @@

报告生成中,请稍候...

+

Markdown 报告将在分析完成后开放下载;评论 CSV 可先导出已抓取的数据。

{% endif %} {% endblock %} diff --git a/app/templates/items/detail.html b/app/templates/items/detail.html index 1741fbd..91b82a7 100644 --- a/app/templates/items/detail.html +++ b/app/templates/items/detail.html @@ -31,6 +31,7 @@

报告生成中,请稍候...

+

Markdown 报告将在分析完成后开放下载;评论 CSV 可先导出已抓取的数据。

{% endif %}
评论明细
diff --git a/docs/MVP-WorkOrders.md b/docs/MVP-WorkOrders.md index 7fa9b45..12723fd 100644 --- a/docs/MVP-WorkOrders.md +++ b/docs/MVP-WorkOrders.md @@ -1045,6 +1045,32 @@ fix: 修复报告和评论导出点击失效 - 评论为空时,用户希望“下载只有表头的 CSV”,还是“按钮禁用并提示暂无评论”。 +完成记录: + +- 完成日期:2026-07-03 +- 相关改动: + - 在热点报告页和内容详情页的报告生成中状态增加可见提示:`Markdown 报告将在分析完成后开放下载;评论 CSV 可先导出已抓取的数据。` + - 保留 Markdown 按钮的 disabled 状态和 title,避免报告未生成时误触。 + - 保留 CSV 导出入口,允许先导出已抓取评论。 + - 补充集成测试,覆盖报告缺失时的可见提示和 CSV 入口。 +- 验证命令: + - `docker cp app/. hot-comments-tool-app-1:/app/app/` + - `docker cp tests/. hot-comments-tool-app-1:/app/tests/` + - `docker exec hot-comments-tool-app-1 sh -lc 'python -m pytest /app/tests/integration/test_routes.py -q'` + - `curl -s http://localhost:8000/hotspots/6fea3e86-5954-43b6-b727-33a03d3b418a/report | rg -n "Markdown 报告|导出热点评论 CSV|报告生成中|导出 Markdown"` + - `curl -s -D /tmp/wo12-csv-headers.txt http://localhost:8000/api/export/hotspots/6fea3e86-5954-43b6-b727-33a03d3b418a/comments.csv -o /tmp/wo12-hotspot-comments.csv` +- 验证结果: + - 路由集成测试:`19 passed, 1 warning` + - 当前热点页显示 Markdown 未开放下载的解释文案。 + - 当前热点 CSV 导出接口 GET 返回 200,`Content-Disposition` 包含 UTF-8 文件名,文件大小 4978 bytes。 + - 当前热点 Markdown 导出仍返回 404 `报告不存在`,原因是该 running 任务尚未生成热点级报告;页面已给出可见解释。 +- 验收结论: + - 报告未生成时,导出 Markdown 不再表现为“点不动”而无解释。 + - CSV 可先导出已抓取评论。 +- 遗留问题: + - 评论为空时继续沿用“下载只有表头的 CSV”的既有策略;如需改为禁用按钮,需要用户另行确认。 + - 当前任务仍停在 AI 分析中,热点级 Markdown 需要任务完成并生成报告后才能下载;归入 WO-13 的进度透明化和卡住提示。 + ### WO-13 抓取任务进度透明化与耗时预期 优先级:P0 diff --git a/tests/integration/test_routes.py b/tests/integration/test_routes.py index c892da6..fee3dfe 100644 --- a/tests/integration/test_routes.py +++ b/tests/integration/test_routes.py @@ -312,9 +312,13 @@ def test_report_pages_render_empty_state_when_report_missing(): assert hotspot_response.status_code == 200 assert "报告生成中,请稍候" in hotspot_response.text assert 'title="报告尚未生成"' in hotspot_response.text + assert "Markdown 报告将在分析完成后开放下载" in hotspot_response.text + assert "downloadExport('/api/export/hotspots/hot-no-report/comments.csv'" in hotspot_response.text assert item_response.status_code == 200 assert "报告生成中,请稍候" in item_response.text assert 'title="报告尚未生成"' in item_response.text + assert "Markdown 报告将在分析完成后开放下载" in item_response.text + assert "downloadExport('/api/export/items/item-no-report/comments.csv'" in item_response.text def test_report_pages_warn_when_ai_sample_is_insufficient():