起草失败单独记一种状态,别再停在「起草中」

没有可用模型、模型回复读不懂时,草稿此前一直留在 drafting,界面会以为还在跑。现在置 failed
并把原因写进 error;补上真指标后 PATCH 仍能把它推回正常流程。
This commit is contained in:
ThearchyHelios
2026-11-03 23:07:01 +08:00
parent f697ab7ed2
commit 43a38e926c
6 changed files with 17 additions and 9 deletions
+1 -1
View File
@@ -220,7 +220,7 @@ async def test_a_model_that_is_unavailable_leaves_the_draft_with_an_error(client
monkeypatch.setattr(docdraft, "extract", unavailable)
body = (await client.post("/api/ledger/drafts/extract", json={"documents": [doc]})).json()
made = (await client.get(f"/api/ledger/drafts/{body['draft_id']}")).json()
assert made["status"] == "drafting" and made["error"] == "还没有接入可用的起草模型"
assert made["status"] == "failed" and made["error"] == "还没有接入可用的起草模型"
assert made["metric_count"] == 0 and not made.get("metrics")