Files
pod_trend_agent/graph/state.py
T
3218485270 f493bde8a9 POD 趋势感知 Agent:缓存热点模式 + 三图合成 + 热点去重/风格去重 + review 兜底
- 缓存热点批量流程(有采集缓存不触发 Google)
- 简报不足直接从采集缓存生成(轻量补齐)
- 三图合成(模特/印花/底图)+ 底图压缩 <2MB
- 热点去重→风格去重自动切换 + 不适合类目 review 兜底
- 透明背景(background=transparent)+ 提示词清洗(敏感词/背景描述)
- 任务前 basemap 校验 + 模板国家校验 + 模特任务级分配
2026-08-22 14:14:01 +08:00

31 lines
2.2 KiB
Python
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
"""LangGraph 共享状态定义。
所有节点都读写 AgentState。键全部 optionaltotal=False),
因此单个节点崩溃 / 返回空时不会破坏整图,下游可用上一节点的残余数据继续。
"""
from typing import TypedDict, List, Dict, Any, Optional
class AgentState(TypedDict, total=False):
# —— 路由 / 配置 ——
country: str # 当前处理的国家代码(US/GB/JP/AU
config: Dict[str, Any] # 全局配置(config.yaml
country_config: Dict[str, Any] # 该国合并后的配置(全局 + configs/countries/*.yaml + prompts/<country>/aesthetics.yaml
prompts_dir: str # prompts/<country> 绝对路径
output_dir: str # output/<country> 绝对路径
# —— 流水线数据(逐节点累积)——
raw_rows: List[Dict[str, Any]] # fetch 产出:各源原始行(统一格式)
filtered_rows: List[Dict[str, Any]] # filter 产出:去黑名单/人名/泛词后
scored_rows: List[Dict[str, Any]] # score 产出:归一化 + 融合 + 综合分
screened: List[Dict[str, Any]] # screen 产出:合规风险 + 结构化四要素
briefs: List[Dict[str, Any]] # prompt_build 产出:含最终 image/wearable/composite 提示词
composite: List[Dict[str, Any]] # compose 产出:封装提示词包(= briefs 子集,便于下游印图)
designs: List[Dict[str, Any]] # compose 产出:纯印花设计稿 [{topic, path}]product 用它做图2
product: List[Dict[str, Any]] # product 产出:产品图生成(SPU/SKU/底图/印花/模特合成)
seed_words: Dict[str, Any] # seed 产出:动态种子词(含 llm_style_seeds / llm_related_seeds
# —— 可观测性 ——
errors: List[Dict[str, Any]] # 各节点兜底捕获的错误:{node, type, message, trace}
stats: Dict[str, Any] # 各阶段统计:{fetch, filter, score, screen, prompt, compose}