From 77759678a7adbb43205ea104dab7395fa84021de Mon Sep 17 00:00:00 2001 From: zyc <1439655764@qq.com> Date: Tue, 30 Jun 2026 11:40:23 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E5=95=86=E5=93=81=E5=BA=93=E7=94=9F?= =?UTF-8?q?=E6=88=90=E7=9A=84=E4=B8=89=E8=A7=86=E5=9B=BE=E6=89=93=20view?= =?UTF-8?q?=3Dthree=5Fview=20=E6=A0=87=E8=AE=B0,=E5=88=B7=E6=96=B0?= =?UTF-8?q?=E4=B8=8D=E4=B8=A2=20(ZWQ#5=20=E7=BB=AD)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 真因:商品库点「AI生成三视图」走 reference_product 路径,产出资产 name=「图片创作」、 metadata 只有 mode/product_id —— 没有 view=three_view,也非 tri_view 类。导致: ①商品库详情三视图面板刷新后认不出(显示「尚未生成」、采用也丢); ②视频项目第二步基础资产读不到「商品已有三视图」。 修:reference_product 资产与视频项目基础资产阶段生成的商品三视图同款标记 —— category=product_image + 名字含「商品三视图」+ metadata.view=three_view + product_id。 这样 products is_triview(排除 product_image 不误入角色区)、商品库前端回填(view===three_view)、 视频项目商品三视图判定都能认出。需部署生效;存量旧资产无标记不追溯。 Co-Authored-By: Claude Opus 4.8 --- core/backend/apps/ai/services.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/core/backend/apps/ai/services.py b/core/backend/apps/ai/services.py index 729c45d..439d105 100644 --- a/core/backend/apps/ai/services.py +++ b/core/backend/apps/ai/services.py @@ -2419,9 +2419,16 @@ def run_standalone_image_task(*, task_id: str) -> None: asset_id = uuid.uuid4() object_key = f"teams/{team.id}/standalone/{asset_id}{suffix}" stored = TosStorage().upload_fileobj(fileobj=fileobj, object_key=object_key, content_type=content_type) - asset_label = {"model": "模特上身图", "cover": "平台套图", "image": "图片创作"}.get(mode, mode) + # 商品三视图(reference_product):与视频项目基础资产阶段生成的商品三视图同款标记 —— + # category=product_image + 名字含「商品三视图」+ metadata.view=three_view + product_id。 + # 否则商品库自己生成的三视图认不出(无 view 标记),刷新即丢、视频项目第二步也读不到「商品已有三视图」(ZWQ#5 续)。 + is_product_triview = bool(payload.get("reference_product")) + asset_label = "商品三视图" if is_product_triview else {"model": "模特上身图", "cover": "平台套图", "image": "图片创作"}.get(mode, mode) + asset_category = Asset.Category.PRODUCT_IMAGE if is_product_triview else category # 资产元数据:product_id(商品详情页据此只展示该商品素材)+ batch_id(成组)+ mode + model_entity_id(上身图溯源模特库) asset_meta: dict = {"mode": mode} + if is_product_triview: + asset_meta["view"] = "three_view" if product_id: asset_meta["product_id"] = str(product_id) if payload.get("batch_id"): @@ -2430,7 +2437,7 @@ def run_standalone_image_task(*, task_id: str) -> None: asset_meta["model_entity_id"] = str(payload["model_entity_id"]) asset = Asset.objects.create( id=asset_id, team=team, created_by=user, name=f"AI 生成 · {asset_label} · {index + 1}", - asset_type=Asset.Type.IMAGE, source=Asset.Source.AI_GENERATED, category=category, origin_task=task, + asset_type=Asset.Type.IMAGE, source=Asset.Source.AI_GENERATED, category=asset_category, origin_task=task, metadata=asset_meta, # 工作台生成的图默认不进资产库列表,只在工作台展示;用户「加入资产库」后才置 True in_library=False,