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

27 lines
908 B
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.
"""节点 3/6:打分(score)。
归一化(按 source/kind 分组 min-max-> 跨源融合(combine-> 综合分阈值预筛。
纯逻辑节点,with_fallback 兜底。
"""
from typing import Any, Dict, List
from graph.scoring import combine, normalize
from graph.validate import with_fallback
@with_fallback("score")
def score_node(state: Dict[str, Any]) -> Dict[str, Any]:
rows: List[Dict[str, Any]] = state.get("filtered_rows") or []
config = state["config"]
weights = config.get("weights") or {}
llm_cfg = config.get("llm_screen") or {}
min_score = float(llm_cfg.get("min_score", 0.0))
normalize(rows)
combined = combine(rows, weights)
combined = [c for c in combined if float(c.get("score", 0)) >= min_score]
stats = dict(state.get("stats") or {})
stats["score"] = {"combined": len(combined)}
return {"scored_rows": combined, "stats": stats}