POD 趋势感知 Agent:缓存热点模式 + 三图合成 + 热点去重/风格去重 + review 兜底

- 缓存热点批量流程(有采集缓存不触发 Google)
- 简报不足直接从采集缓存生成(轻量补齐)
- 三图合成(模特/印花/底图)+ 底图压缩 <2MB
- 热点去重→风格去重自动切换 + 不适合类目 review 兜底
- 透明背景(background=transparent)+ 提示词清洗(敏感词/背景描述)
- 任务前 basemap 校验 + 模板国家校验 + 模特任务级分配
This commit is contained in:
2026-08-22 14:14:01 +08:00
commit f493bde8a9
98 changed files with 10280 additions and 0 deletions
+180
View File
@@ -0,0 +1,180 @@
# ===== POD 热点抓取 Agent 配置(LangGraph 工程化版)=====
# 目标国家(Google Trends 地区代码:US / GB / JP / AU / MX ...
countries:
- US
- GB
- JP
- AU
- MX
# —— 可插拔数据源 ——
# 在 graph/sources/ 注册表里登记;这里列出要启用的。
# 每个国家的具体种子词/limit 写在 configs/countries/<country>.yaml。
sources:
- google_trends
# - pinterest # 需要 Pinterest 商业 token + API Review 通过后才启用
# —— 动态种子词(seed 节点,在 fetch 之前运行)——
# 收集「trending 派生 + 上一轮 safe 历史热点 + 月份/节日」上下文,
# 由 LLM 后端生成动态种子词,与 yaml 静态种子合并后注入 style.seeds / related.seed_keywords。
# 只适配 OpenAI 兼容协议:openai(真 LLM,自定义 model/base_url/api_key 见 llm_screen/ mock(规则生成,零 API 成本)。
# static: 仅用 yaml 写死种子,零动态(保留兼容,UI 未列出)。
seed_provider: mock
seed_provider_cfg:
max_style_seeds: 12 # style 种子总数上限(动态分配:固定种子优先 → 节日/月份主题 → 动态补位)
max_related_seeds: 12 # related 种子总数上限(同上)
trending_context_limit: 15
history_limit: 20
# —— Pinterest(官方 API v5,可选;默认关闭)——
pinterest:
enabled: false
access_token: "" # 填 Bearer Token,或用环境变量 PINTEREST_ACCESS_TOKEN
search_keywords:
- "trending fashion"
- "streetwear"
- "cottagecore"
page_size: 25
# 跨源融合权重(按 source 标签,无需和为 1)
# 已下调 gt_trending(泛国家热点只作微弱信号),主力偏向 style+related(可印花型词)。
weights:
gt_trending: 0.15
gt_style: 0.55
gt_related: 0.30
pinterest: 0.0
# 合规黑名单(全局,生效于所有国家;各国专属侵权盲区写在 prompts/<country>/aesthetics.yaml 的 extra_blacklist
blacklist:
- disney
- marvel
- nfl
- nba
- mlb
- nhl
- fifa
- olympics
- bernie sanders
# —— 真实人物过滤(肖像权 right of publicity)——
# 显式名单(子串匹配)+ Firstname Lastname 模式(仅对 gt_trending 源,避免误删风格词)。
name_filter:
enabled: true
exemptions: [] # 留空用内置默认豁免(new album / red cross 等)
# —— 设计相关性过滤(让关键词更聚焦可印主体,剔除泛新闻/科技/赛事词)——
relevance:
enabled: true
drop_patterns:
- "iphone|ipad|android|ps5|xbox|macbook|windows|samsung|pixel|tesla"
- "pro max|firmware|software version|os update|app update"
- "election|debate|summit|treaty|sanction|parliament|congress|prime minister"
- "stock|crypto|bitcoin|earnings|inflation|interest rate|market crash|nasdaq"
- "score|vs |quarter-final|semi-final|final match|match result|fixture|grand prix"
- "episode|trailer|release date|box office|watch online|full movie|streaming"
- "breaking news|headline|live update|press conference"
keep_patterns: []
# —— 查询噪声过滤(问句/命名清单/损坏碎片/模糊名词,非可印花设计概念)——
# 这些词进入 screen 会被 Mock 误标 safe,故在过滤阶段直接丢弃。
query_noise:
enabled: true
# —— LLM 筛选(印花设计合规筛 + 生图提示词构造,第二阶段)——
# 只适配 OpenAI 兼容协议:自定义 model / base_url / api_keyUI 的「OpenAI 配置」区或此处均可填)。
llm_screen:
enabled: true
provider: openai # openai(真 LLM,需 key/ mock(无 key 启发式兜底)
api_key: "sk-ws-H.EPXPIER.vRMT.MEUCIQDji_AHGl-EekYOftdLxEvFl2ZqCNtLDSp3Bqnaz0SRpgIgI4qPeVyIMMzutl9JakuYRv3zmFxkwc12c4aBcIL1gqE" # 留空则自动读取环境变量 LLM_API_KEY / OPENAI_API_KEY(推荐,避免密钥入库)
base_url: "https://ws-5rfjflubus647o7t.cn-beijing.maas.aliyuncs.com/compatible-mode/v1" # 自定义网关地址,也可用环境变量 LLM_BASE_URL 覆盖
model: "qwen3.7-max-preview" # 自定义模型名(任意 OpenAI 兼容模型)
temperature: 0.6
max_topics_per_call: 12
min_score: 0.0
keep_review: false # false = 待复核(review)直接过滤、不生成设计提示词,只留 safe
# —— 固定提示词模板(规则写死,保证每条一致)——
# 由 motif + art_style + color_palette + composition 四要素按模板确定性拼出。
# v3countries.<CODE> 按国家覆盖 image_prompt(每国设计风格不同),顶层为兜底。
# 文字规则统一:英文可加可不加、适配印花即可;任何文字严禁政治/宗教/仇恨/暴力/性/品牌/商标/真实人物等敏感内容。
prompt_templates:
image_prompt: "{motif}, {art_style}, {color_palette}, {composition}, standalone pure print design, print-ready artwork, flat vector-like graphic, crisp clean edges, high resolution, ultra sharp, high contrast, US-market aesthetic: bold confident statement graphic, high contrast, clean modern vector, sporty or humorous mood, size: choose freely between a MINIMUM print area of about 15x18 cm and a MAXIMUM of 26x32 cm, any size in this range fits, pick the one that best suits the design, keep proportions, scale naturally to the content, do NOT stretch, do NOT fill the entire canvas, do NOT force full-bleed, leave balanced margins around the artwork, no garment, no shirt, no model, no mannequin, no watermark, text: optional - add short original English words or a small slogan ONLY if they fit the print, or keep it text-free; any text must be safe, short and original; no brand names, no logos, no trademarked phrases, no real people names"
wearable_prompt: "{motif}, {art_style}, {color_palette}, {composition}, printed centered on the chest of a flat-lay plain white t-shirt, print sized freely between about 15x18 cm and a max of 26x32 cm, scaled naturally to the artwork, not stretched, not full-bleed, studio lighting, e-commerce product photo, no human model"
composite_prompt: "【图片角色,按提交顺序】图1=模特实拍图(基底);图2=纯印花设计稿;图3=平铺衣服底图(只取衣服本身的底色与面料材质,忽略平铺图背景/桌面/场景,只保留面料颜色与质感)。
TASK: 把图2的印花设计印到图3底色的衣服上,并让图1的模特穿上“图3底色+图2印花”的衣服。
RULES:/n1.底色锁定:从图3提取衣服底色与面料,最终合成中必须100%保持不变,严禁偏色。
2.印花提取:从图2精准提取纯印花图案(线条/色号/比例),叠加到图3底色上形成合成面料。3.印花尺寸适配:印花整体尺寸与衣服面料面积成合理比例,居中印在胸/背/衣身主体区域,占衣身面积约30%-45%,四周留白,严禁过大撑满整件或过小(低于20%)。
3.主体遮罩:识别图1模特服装穿着区域(忽略皮肤/头发/背景/配饰),用合成面料完整覆盖,清除原衣服颜色与图案。
4.精准贴合:合成面料严格跟随图1衣服立体结构,褶皱/扭转处印花相应变形,杜绝“贴纸感”与“平面涂色感”。
5.光影融合:按图1环境光方向调整亮度/对比度,印花受光影响产生明暗变化但色号不偏移。
6.纯净输出:仅输出一张最终合成图;图1背景/人物/构图/光影100%不变,仅替换衣服印花与底色。
DESIGN CONTENT: {motif}, {art_style}, {color_palette}, {composition}."
composite_negative: "garment changed, wrong color, distorted print, blurry, low-res, human model, body, extra objects, watermark, glow, 3d render, text unless part of design"
countries:
US:
image_prompt: "{motif}, {art_style}, {color_palette}, {composition}, standalone pure print design, print-ready artwork, flat vector-like graphic, crisp clean edges, high resolution, ultra sharp, high contrast, US-market aesthetic: bold confident statement graphic, high contrast, clean modern vector, sporty or humorous mood, size: choose freely between a MINIMUM print area of about 15x18 cm and a MAXIMUM of 26x32 cm, any size in this range fits, pick the one that best suits the design, keep proportions, scale naturally to the content, do NOT stretch, do NOT fill the entire canvas, do NOT force full-bleed, leave balanced margins around the artwork, no garment, no shirt, no model, no mannequin, no watermark, text: optional - add short original English words or a small slogan ONLY if they fit the print, or keep it text-free; any text must be safe, short and original; no brand names, no logos, no trademarked phrases, no real people names"
GB:
image_prompt: "{motif}, {art_style}, {color_palette}, {composition}, standalone pure print design, print-ready artwork, flat vector-like graphic, crisp clean edges, high resolution, ultra sharp, high contrast, UK-market aesthetic: witty understated British charm, heritage-inspired motifs, retro sportswear or punk-zine mood, size: choose freely between a MINIMUM print area of about 15x18 cm and a MAXIMUM of 26x32 cm, any size in this range fits, pick the one that best suits the design, keep proportions, scale naturally to the content, do NOT stretch, do NOT fill the entire canvas, do NOT force full-bleed, leave balanced margins around the artwork, no garment, no shirt, no model, no mannequin, no watermark, text: optional - add short original English words or a small slogan ONLY if they fit the print, or keep it text-free; any text must be safe, short and original; no brand names, no logos, no trademarked phrases, no real people names"
JP:
image_prompt: "{motif}, {art_style}, {color_palette}, {composition}, standalone pure print design, print-ready artwork, flat vector-like graphic, crisp clean edges, high resolution, ultra sharp, high contrast, JP-market aesthetic: kawaii cute or clean minimal, soft pastel-friendly, polished neat lines, small cute mascot mood, size: choose freely between a MINIMUM print area of about 15x18 cm and a MAXIMUM of 26x32 cm, any size in this range fits, pick the one that best suits the design, keep proportions, scale naturally to the content, do NOT stretch, do NOT fill the entire canvas, do NOT force full-bleed, leave balanced margins around the artwork, no garment, no shirt, no model, no mannequin, no watermark, text: optional - add short original English words or a small slogan ONLY if they fit the print, or keep it text-free; any text must be safe, short and original; no brand names, no logos, no trademarked phrases, no real people names"
AU:
image_prompt: "{motif}, {art_style}, {color_palette}, {composition}, standalone pure print design, print-ready artwork, flat vector-like graphic, crisp clean edges, high resolution, ultra sharp, high contrast, AU-market aesthetic: laid-back coastal and outdoor vibe, nature-inspired, bright fresh energy, size: choose freely between a MINIMUM print area of about 15x18 cm and a MAXIMUM of 26x32 cm, any size in this range fits, pick the one that best suits the design, keep proportions, scale naturally to the content, do NOT stretch, do NOT fill the entire canvas, do NOT force full-bleed, leave balanced margins around the artwork, no garment, no shirt, no model, no mannequin, no watermark, text: optional - add short original English words or a small slogan ONLY if they fit the print, or keep it text-free; any text must be safe, short and original; no brand names, no logos, no trademarked phrases, no real people names"
MX:
image_prompt: "{motif}, {art_style}, {color_palette}, {composition}, standalone pure print design, print-ready artwork, flat vector-like graphic, crisp clean edges, high resolution, ultra sharp, high contrast, MX-market aesthetic: vibrant mexican folk art, sugar skull / loteria / aztec motifs, fiesta colors, festive cultural pride mood, size: choose freely between a MINIMUM print area of about 15x18 cm and a MAXIMUM of 26x32 cm, any size in this range fits, pick the one that best suits the design, keep proportions, scale naturally to the content, do NOT stretch, do NOT fill the entire canvas, do NOT force full-bleed, leave balanced margins around the artwork, no garment, no shirt, no model, no mannequin, no watermark, text: optional - add short original English words or a Spanish slogan ONLY if they fit the print, or keep it text-free; any text must be safe, short and original; no brand names, no logos, no trademarked phrases, no real people names"
# —— 第三阶段 compose:生成纯印花设计稿 + 导出简报包(在 product 之前)——
# 用前 N 个 safe 简报的 image_prompt 调图像后端文生图,产物 output/<country>/designs/
# product 节点取第一张设计稿作为图2 复用(多款号共用同一设计)。
# backend 留空则不生成设计稿(product 节点会自行回退生成)。
compose:
backend: "openai" # 生成设计稿的图像后端:openai(需 api_key/ mock(占位);留空=不生成
api_key: "sk-ef1f251f059f9c2f8cc397de4a84e96d65775e1f2d32bb13b69b23dafc24d111"
base_url: "https://api.tofastcode.xyz" # 自定义图像网关地址(默认 OpenAI)
model: "gpt-image-2"
size: "1536×2048"
background: "transparent" # 生成透明背景 PNG(gpt-image 系列支持);留空=默认背景
design_count: 1 # 用前 N 个 safe 简报生成设计稿(product 取第一个复用)
# —— 第五阶段 oss_upload:压缩(3:4 / ≥1340×1785 / <2MB+ 上传阿里云 OSS 图床 ——
# 产物(composite/printed/design/basemap)逐个压缩上传,URL 写回 *_url 字段。
# key_id/key_secret 也可用环境变量 OSS_ACCESS_KEY_ID / OSS_ACCESS_KEY_SECRET 覆盖。
oss:
oss_bucket: "image-taotu"
oss_endpoint: "oss-cn-beijing.aliyuncs.com"
oss_key_id: "LTAI5t6tN2k2dznmdBmDJebh"
oss_key_secret: "2Q25JohOI4GmovszvIw1NuVvUzM6PB"
enabled: true # false = 跳过上传(本地仅压缩或完全跳过)
# —— 第六阶段 seed_shot:种草图生成(在 oss_upload 之后)——
# 模板:configs/seed_shot_templates.yaml(提示词,占位符 [商品名称]/[材质]/[模特特征],可自定义添加)
# 模特特征:configs/model_features.yaml(随机取一条,可自定义添加)
# [商品名称] ← product 的 cn_title[材质] ← db SPU.material[模特特征] ← yaml 随机
# 种草图同样压缩上传 OSS(货号计数与 oss_upload 共用续接)。
seed_shot:
enabled: true
count: 1 # 每个产品生成几张种草图(传入数量即可)
size: "1536×2048" # 种草图尺寸(统一读取此配置,不再硬编码)
# —— 第四阶段 product:热点 → SPU/颜色选品 → 底图 → 三图合成(图1模特+图2设计稿+图3底图)→ 模板 ——
# 数据关系:SPU.code=款号,SKU.code="款号-颜色编码"(如 DG004-BL01),
# 底图在 basemap/<款号>/<SKU.code>/,模特图在 material_library/<品类>/。
# 设计稿优先用 compose 节点生成的(compose.backend),本节点 backend 负责三图/两图合成。
# backend: openai(真合成,需 compose.api_key) / mock(Pillow 占位,无 key 演示) / 留空=仅导出模板。
product:
enabled: true
db_path: "db/spu_sku.db"
basemap_dir: "basemap"
material_library_dir: "material_library"
model_category: "T-shirt" # 模特目录优先品类;为空/无图时取 material_library 第一个有图的子目录;SPU.mark==1 才启用模特试穿
brief_index: 0 # 用第几个 safe 简报的提示词生成(0=第一个)
spu_code: "" # 款号(留空自动选第一个有本地底图的)
sku_code: "" # 颜色编码(留空自动选该款第一个有底图的);多个颜色用逗号分隔(如 "DG015-VT01,DG015-DARK HEATHER"
spu_per_color: # 留空自动判定:单色=每色一SPU;多色=单SPU多色(UI 不选择模板模式);CLI --single-spu 可显式覆盖
markup_percent: 0 # 加价百分比(按 SKU 最低价,供后续定价使用)
code_prefix: "DG" # 货号前缀(OSS 上传 key:{国家}/{时间戳}/{前缀+3位计数}_{4位随机}.jpg000 起最多 999
backend: "mock" # openai / mock / 留空=跳过生成
background: "transparent" # 设计稿透明背景(product 后端生图时也传 background=transparent
template_dir: "templates" # template_router.py 所在目录(项目内自包含)
template_path: "templates/商品上传模版.xlsx" # 商品上传模板(可改为自由上传)