v106-v109 童装支持 + 标题模板外部化 + 模板导出增强
- 新增男童/女童检测(gender_from_category 优先判童装)与童装场景图生成
(configs/kids_features.yaml:模特/场景/服装风格,同一商品固定同一组)
- 童装 SPU 字段映射:kids_type→SPU商品属性-类型、kids_age→适用年龄段、
target_audience 按性别映射、kids_type_map 女童「上衣」→「针织上衣」
- 标题生成提示词外部化:prompts/title_prompt_{1,2,3}.md + config.yaml 路由表
- 模板多站点匹配:经营站点可配多个,命中任意一个即匹配
- 种草图生成失败自动重试(seed_shot.retries,换场景/模特/风格)
- 模板导出新增 Preview 文件夹(成功产品 _composite.oss.jpg + result.xlsx)
- 修复 SKU 尺码未按从小到大排序(_size_rank 支持单一年龄码 6Y/10Y)
This commit is contained in:
@@ -105,7 +105,8 @@ class PinterestPipeline:
|
||||
category = read_template_category(tp)
|
||||
self._gender = gender_from_category(category)
|
||||
if self._gender:
|
||||
print(f"[pinterest_pipeline] 类目「{category[:30]}…」含{'男' if self._gender == 'male' else '女'} → 固定 {self._gender} 模特")
|
||||
label = {"male": "男", "female": "女", "boy_kids": "男童", "girl_kids": "女童"}.get(self._gender, self._gender)
|
||||
print(f"[pinterest_pipeline] 类目「{category[:30]}…」检测到 {label} → 固定 {self._gender} 模特")
|
||||
elif category:
|
||||
print(f"[pinterest_pipeline] 类目「{category[:30]}…」无男/女 → 男女模特随机")
|
||||
|
||||
@@ -240,8 +241,7 @@ class PinterestPipeline:
|
||||
if not pool:
|
||||
continue
|
||||
img, kind = _random.choice(pool) # 每任务独立随机抽一张(含 kind)
|
||||
assign[key] = {"img": img, "kind": kind,
|
||||
"prompts": (mark_dirs.get(mark) or mark_dirs.get("1") or {})}
|
||||
assign[key] = {"img": img, "kind": kind}
|
||||
return assign
|
||||
|
||||
def _load_materials(self) -> Dict[str, str]:
|
||||
@@ -674,8 +674,7 @@ class PinterestPipeline:
|
||||
if spu is not None and int(spu.get("mark") or 0) != 1:
|
||||
return {"model_img": img} # 非 mark=1 走旧逻辑(不传 kind,product_node 按其 mark 自行判定)
|
||||
return {"model_img": img,
|
||||
"model_kind": src.get("kind", "model"),
|
||||
"prompts": src.get("prompts") or {}}
|
||||
"model_kind": src.get("kind", "model")}
|
||||
|
||||
def _process_spu(self, brief: Dict[str, Any], spu, skus: str, img_code: str,
|
||||
design_path: str, task_idx: int = 0) -> Optional[Dict[str, Any]]:
|
||||
@@ -769,7 +768,8 @@ class PinterestPipeline:
|
||||
try:
|
||||
generated = generate_seed_shots(self._ib, base, cn, material, n, str(shot_dir),
|
||||
r.get("composite_negative", ""),
|
||||
size=size, prefix=pfx, gender=self._gender)
|
||||
size=size, prefix=pfx, gender=self._gender,
|
||||
retries=int(ss_cfg.get("retries", 3)))
|
||||
except Exception as e: # noqa: BLE001
|
||||
if self.is_fatal_503(e):
|
||||
self.record_503()
|
||||
|
||||
Reference in New Issue
Block a user