fix: 修复图片补图删除回填
This commit is contained in:
@@ -1215,10 +1215,13 @@ class ImageConversationTests(TestCase):
|
||||
conv_id = first.json()["conversation_id"]
|
||||
batch_id = first.json()["batch_id"]
|
||||
self.assertTrue(batch_id)
|
||||
failed_task = AITask.objects.filter(conversation_id=conv_id).order_by("created_at").first()
|
||||
failed_task.status = AITask.Status.FAILED
|
||||
failed_task.save(update_fields=["status"])
|
||||
# 重跑一张:带原对话 + 原 batch_id → 归回原批次
|
||||
second = self.client.post(
|
||||
"/api/ai/generate-image/",
|
||||
{"prompt": "一只猫", "mode": "image", "count": 1, "conversation_id": conv_id, "batch_id": batch_id},
|
||||
{"prompt": "一只猫", "mode": "image", "count": 1, "conversation_id": conv_id, "batch_id": batch_id, "retry_of_task_id": str(failed_task.id)},
|
||||
format="json",
|
||||
)
|
||||
self.assertEqual(second.status_code, 202, second.content)
|
||||
@@ -1227,6 +1230,7 @@ class ImageConversationTests(TestCase):
|
||||
self.assertEqual(len(tasks), 3)
|
||||
self.assertTrue(all(t["batch_id"] == batch_id for t in tasks))
|
||||
self.assertEqual([t["rerun"] for t in tasks], [False, False, True])
|
||||
self.assertEqual(tasks[-1]["retry_of_task_id"], str(failed_task.id))
|
||||
# 非法 batch_id(不是 UUID):不沿用,铸新批次,不打 append 标记
|
||||
third = self.client.post(
|
||||
"/api/ai/generate-image/",
|
||||
|
||||
Reference in New Issue
Block a user