fix(core): 管线参考图 #1 — 商品参考图走主图兜底(原先无商品基础资产组就丢)
诊断:实测 _storyboard_reference_images,资产齐全的项目 3/3 全中,链路本身对; 断点在上游资产没配齐/标签错。其中商品最明确:系统非要"商品基础资产组"才认, 但商品天生有真实主图 → 匹配不到商品组时直接用 _product_cover_url(project.product) 当参考。 实测:项目 37197c57 镜0 从 2/3 → 3/3(商品参考图补上);有商品组的项目不重复加。 回归:apps.ai+projects 测试仍 7 个预存 image-provider 失败,零新增。未碰脚本 agent。 附完整诊断 docs/todo/管线参考图链路诊断-2026-06-19.md(根因 #1商品兜底 / #2实体没全生成 / #3标签对齐)。 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.8
parent
fb04bf05ae
commit
e9626d943f
@@ -774,6 +774,8 @@ def _storyboard_reference_images(project, segment) -> list[dict]:
|
||||
groups = list(project.base_asset_groups.filter(adopted_asset__isnull=False).select_related("adopted_asset"))
|
||||
out: list[dict] = []
|
||||
used: set = set()
|
||||
# 商品天生有真实主图,不必先生成"商品基础资产":匹配不到商品组时直接拿主图当参考(原先这里会丢掉商品参考图)
|
||||
product_cover = _product_cover_url(project.product)
|
||||
for rid in (segment.entity_refs or []):
|
||||
ent = entities.get(rid)
|
||||
if not ent:
|
||||
@@ -789,6 +791,8 @@ def _storyboard_reference_images(project, segment) -> list[dict]:
|
||||
url = _asset_preview_url(match.adopted_asset)
|
||||
if url:
|
||||
out.append({"url": url, "label": name or _ENTITY_TYPE_CN.get(ent.get("type"), "参考"), "type": ent.get("type")})
|
||||
elif ent.get("type") == "product" and product_cover and product_cover not in {r["url"] for r in out}:
|
||||
out.append({"url": product_cover, "label": name or "商品", "type": "product"})
|
||||
if len(out) >= 4:
|
||||
break
|
||||
if not out:
|
||||
@@ -797,6 +801,8 @@ def _storyboard_reference_images(project, segment) -> list[dict]:
|
||||
url = _asset_preview_url(pg.adopted_asset)
|
||||
if url:
|
||||
out.append({"url": url, "label": "商品", "type": "product"})
|
||||
elif product_cover:
|
||||
out.append({"url": product_cover, "label": "商品", "type": "product"})
|
||||
# 规范 @图N 顺序:角色 → 商品 → 场景(与下游 image_edit 传图顺序一致,标注不错位)
|
||||
_ord = {"character": 0, "product": 1, "scene": 2}
|
||||
out.sort(key=lambda r: _ord.get(r.get("type"), 9))
|
||||
|
||||
Reference in New Issue
Block a user