feat: 生图模型可选(火山/gpt-image) + 工作台图「加入资产库」收纳 + 任务中心排序修复
- AI 工作室生图支持显式选模型:resolve_image_model 解析 volcano(Seedream 图生图, 无 image_edit 时走 image_generation 带参考图)/ gpt-image(image_edit 多图编辑), 未选回落系统默认;enqueue_standalone_images 透传 image_model - 资产库收纳:Asset 加 in_library 字段(迁移 0007,既有资产 db_default=True 不动); 工作台生成图默认 in_library=False,只在工作台展示,用户「加入资产库」后才进库列表; assets 视图/序列化器/library 页/types 配套 - 任务中心修复:AITaskViewSet 默认 order_by(-created_at),前端 aiTasks 取 page_size=200。 原因:列表无排序时 MySQL 按 UUID 主键乱序返回,把一批旧失败记录顶到首页, 前端又只取首页 20 条算 全部/已完成/失败 → 误显示「全部失败」(实为 421 成功/少量失败) Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -141,6 +141,39 @@ class VideoPacksTests(TestCase):
|
||||
self.assertEqual(len(data[0]["clips"]), 1)
|
||||
|
||||
|
||||
class AssetBatchesTests(TestCase):
|
||||
"""图片趴(模特上身图)按生成批次成组:同 metadata.batch_id 的多张图 = 一批;
|
||||
无 batch_id 的旧图各自成单图批。summary 也按批次计数。"""
|
||||
|
||||
def setUp(self):
|
||||
self.user, self.team = _mk_team("ubt", "TeamBT")
|
||||
self.client = APIClient()
|
||||
self.client.force_authenticate(self.user)
|
||||
# 一批 3 张(同 batch_id)
|
||||
for i in range(3):
|
||||
Asset.objects.create(
|
||||
team=self.team, name=f"AI 生成 · 模特上身图 · {i + 1}", asset_type="image",
|
||||
source="ai_generated", category=Asset.Category.MODEL_TRYON, metadata={"batch_id": "B1"},
|
||||
)
|
||||
# 一张旧图(无 batch_id)→ 自己成一批
|
||||
Asset.objects.create(
|
||||
team=self.team, name="AI 生成 · 模特上身图 · 1", asset_type="image",
|
||||
source="ai_generated", category=Asset.Category.MODEL_TRYON,
|
||||
)
|
||||
|
||||
def test_batches_grouped(self):
|
||||
data = self.client.get("/api/assets/batches/?tab=tryon&page_size=10").json()
|
||||
self.assertEqual(data["count"], 2) # 一批 3 张 + 一张单图批
|
||||
by_count = sorted(b["count"] for b in data["results"])
|
||||
self.assertEqual(by_count, [1, 3])
|
||||
big = next(b for b in data["results"] if b["count"] == 3)
|
||||
self.assertEqual(big["name"], "AI 生成 · 模特上身图") # 去掉「· 序号」
|
||||
self.assertEqual(len(big["items"]), 3)
|
||||
|
||||
def test_summary_counts_batches(self):
|
||||
self.assertEqual(self.client.get("/api/assets/summary/").json()["tryon"], 2)
|
||||
|
||||
|
||||
class SubmitReviewTests(TestCase):
|
||||
"""手动兜底:灰盾点击 → 提交审核;只对送审类放行,非送审类 400。"""
|
||||
|
||||
|
||||
Reference in New Issue
Block a user