#!/bin/bash
# 重生成 social_hotspots_4 直到「无人物」（豆包生成是随机的，实测需重试）
cd /data/news
for i in 1 2 3; do
  echo "########## 第 $i 次生成 ##########"
  python3.12 scripts/regen_no_person.py json/0926data.json images/0926/ social_hotspots_4 2>&1 | grep -E "prompt:|✅ 已写入"
  echo "--- 视觉复核 ---"
  OUT=$(RELEVANCE_TIMEOUT=120 RELEVANCE_TRY=3 python3.12 scripts/image_relevance_guard.py \
         --scan json/yes_data/0925data.json images/0926/ --only social_hotspots_4 --flag-people 2>&1)
  echo "$OUT" | grep -E "social_hotspots\[4\]|画面:|不匹配"
  if echo "$OUT" | grep -q "含人物"; then
    echo ">>> 第 $i 次仍含人物，继续重试"
  else
    echo ">>> ✅ 第 $i 次通过（无人物）"
    break
  fi
done
