|
@@ -827,12 +827,12 @@ async def get_ads_for_review(
|
|
|
metrics_csv: str = "",
|
|
metrics_csv: str = "",
|
|
|
end_date: str = "yesterday",
|
|
end_date: str = "yesterday",
|
|
|
roi_review_factor: float = 0.8,
|
|
roi_review_factor: float = 0.8,
|
|
|
- min_spend_for_class_a: float = 1.0,
|
|
|
|
|
|
|
+ min_spend_for_class_a: float = 10.0,
|
|
|
) -> ToolResult:
|
|
) -> ToolResult:
|
|
|
"""
|
|
"""
|
|
|
不做决策,将广告分为三类,返回结构化摘要供 LLM 推理。
|
|
不做决策,将广告分为三类,返回结构化摘要供 LLM 推理。
|
|
|
|
|
|
|
|
- 类别 A【已确认异常,建议直接关停】:7日均消耗 < 1元(几乎零活动)
|
|
|
|
|
|
|
+ 类别 A【已确认异常,建议直接关停】:7日均消耗 < 10元(几乎零活动)
|
|
|
类别 B【待LLM评估】:消耗有意义但指标异常(ROI偏低或衰退信号)
|
|
类别 B【待LLM评估】:消耗有意义但指标异常(ROI偏低或衰退信号)
|
|
|
类别 C【正常运行】:仅返回摘要统计
|
|
类别 C【正常运行】:仅返回摘要统计
|
|
|
|
|
|
|
@@ -840,7 +840,7 @@ async def get_ads_for_review(
|
|
|
metrics_csv: ROI 指标 CSV 路径(calculate_roi_metrics 输出)
|
|
metrics_csv: ROI 指标 CSV 路径(calculate_roi_metrics 输出)
|
|
|
end_date: 结束日期
|
|
end_date: 结束日期
|
|
|
roi_review_factor: 动态ROI < 全体均值 × 此值 → 进入 B 类(默认 0.8)
|
|
roi_review_factor: 动态ROI < 全体均值 × 此值 → 进入 B 类(默认 0.8)
|
|
|
- min_spend_for_class_a: 7日均消耗低于此值(元)→ A 类(默认 1.0)
|
|
|
|
|
|
|
+ min_spend_for_class_a: 7日均消耗低于此值(元)→ A 类(默认 10.0)
|
|
|
"""
|
|
"""
|
|
|
try:
|
|
try:
|
|
|
# 加载策略参数(动态阈值,不写死在代码中)
|
|
# 加载策略参数(动态阈值,不写死在代码中)
|
|
@@ -899,7 +899,7 @@ async def get_ads_for_review(
|
|
|
stable_days = float(row.get("stable_spend_days_30d", 0) or 0)
|
|
stable_days = float(row.get("stable_spend_days_30d", 0) or 0)
|
|
|
bid_amount = float(row.get("bid_amount", 0) or 0)
|
|
bid_amount = float(row.get("bid_amount", 0) or 0)
|
|
|
|
|
|
|
|
- # 零消耗待关停:7日均消耗 < 1元,几乎无活动
|
|
|
|
|
|
|
+ # 零消耗待关停:7日均消耗 < 10元,几乎无活动
|
|
|
if cost_7d_avg < min_spend_for_class_a:
|
|
if cost_7d_avg < min_spend_for_class_a:
|
|
|
zero_spend_ads.append({
|
|
zero_spend_ads.append({
|
|
|
"ad_id": int(row["ad_id"]),
|
|
"ad_id": int(row["ad_id"]),
|
|
@@ -1027,7 +1027,7 @@ async def apply_decisions(
|
|
|
接收 LLM 的决策,合并 A 类广告(自动关停)和 C 类广告(自动保持),保存到 llm_decisions_{date}.csv。
|
|
接收 LLM 的决策,合并 A 类广告(自动关停)和 C 类广告(自动保持),保存到 llm_decisions_{date}.csv。
|
|
|
|
|
|
|
|
决策分类:
|
|
决策分类:
|
|
|
- - 零消耗待关停:7日均消耗 < 1元,几乎无活动 → 规则判断自动关停
|
|
|
|
|
|
|
+ - 零消耗待关停:7日均消耗 < 10元,几乎无活动 → 规则判断自动关停
|
|
|
- 待优化评估:ROI 偏低、衰退信号、出价调整候选 → 智能判断
|
|
- 待优化评估:ROI 偏低、衰退信号、出价调整候选 → 智能判断
|
|
|
- 正常运行:ROI 正常且无异常信号 → 规则判断自动保持
|
|
- 正常运行:ROI 正常且无异常信号 → 规则判断自动保持
|
|
|
|
|
|
|
@@ -1062,7 +1062,7 @@ async def apply_decisions(
|
|
|
df_metrics = pd.read_csv(metrics_csv)
|
|
df_metrics = pd.read_csv(metrics_csv)
|
|
|
for _, row in df_metrics.iterrows():
|
|
for _, row in df_metrics.iterrows():
|
|
|
cost_7d_avg = float(row.get("cost_7d_avg", 0) or 0)
|
|
cost_7d_avg = float(row.get("cost_7d_avg", 0) or 0)
|
|
|
- if cost_7d_avg < 1.0:
|
|
|
|
|
|
|
+ if cost_7d_avg < 10.0:
|
|
|
# 优化reason表达:避免"0.00元"显示,改用"几乎无消耗"
|
|
# 优化reason表达:避免"0.00元"显示,改用"几乎无消耗"
|
|
|
if cost_7d_avg == 0:
|
|
if cost_7d_avg == 0:
|
|
|
reason_text = "7日几乎无消耗,长期无活动"
|
|
reason_text = "7日几乎无消耗,长期无活动"
|