fix: 自由创作分类入库区分视频与图片展示
This commit is contained in:
@@ -50,7 +50,11 @@ def _tab_q(tab: str) -> Q:
|
||||
return Q(category="model_tryon")
|
||||
if tab == "kits": # 平台套图(图片趴)
|
||||
return Q(category="platform_kit")
|
||||
if tab == "creations": # 自由创作(图片趴)
|
||||
if tab == "image_creations": # 图片自由创作
|
||||
return Q(category="free_create", asset_type="image")
|
||||
if tab == "video_creations": # 视频自由创作
|
||||
return Q(category="free_create", asset_type="video")
|
||||
if tab == "creations": # 自由创作(兼容旧入口:图片+视频)
|
||||
return Q(category="free_create")
|
||||
if tab == "uploads":
|
||||
return Q(category="upload")
|
||||
@@ -64,7 +68,7 @@ def _tab_q(tab: str) -> Q:
|
||||
|
||||
|
||||
# 图片趴三类按「生成批次」成组展示:同一次提交的 N 张图共享 metadata.batch_id。
|
||||
BATCH_TABS = {"tryon", "kits", "creations"}
|
||||
BATCH_TABS = {"tryon", "kits", "creations", "image_creations"}
|
||||
|
||||
# 资产名形如「AI 生成 · 模特上身图 · 4」,去掉尾部的「· 序号」得到批次名「AI 生成 · 模特上身图」。
|
||||
_BATCH_NAME_RE = re.compile(r"\s*·\s*\d+\s*$")
|
||||
@@ -180,6 +184,7 @@ class AssetViewSet(TeamScopedViewSetMixin, ModelViewSet):
|
||||
for row in rows:
|
||||
seen.add(_batch_key((row["metadata"] or {}).get("batch_id"), row["origin_task_id"], row["id"]))
|
||||
out[t] = len(seen)
|
||||
out["video_creations"] = base.filter(_tab_q("video_creations")).count()
|
||||
out["others"] = base.filter(_tab_q("others")).count()
|
||||
return Response(out)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user