fix: 방문자 리뷰 본문 없을 때 블로그 리뷰로 보충

This commit is contained in:
skkim committed 2026-08-27 10:34:23 +09:00
1 parent 5de5c7507d
commit 43709bf7e0
6 files changed
+153 -28

No files matched your search

+13 -6
View File
@@ -145,14 +145,21 @@ def main():
try:
rstore, reviews = NV.fetch_reviews(args.link, max_reviews=30)
except Exception as e:
sys.exit(f"[!] 리뷰 수집 실패: {type(e).__name__}: {e}")
# 리뷰 수집 실패로 생성 전체를 죽이지 않는다 — 가게명만으로라도 계속 간다.
print(f"[!] 리뷰 수집 실패(수집된 정보만으로 계속): {type(e).__name__}: {e}")
rstore, reviews = None, []
if rstore and not brief_store:
brief_store = rstore
bullets = NV.summarize_reviews(genai.Client(api_key=_key), brief_store, reviews)
if not bullets:
sys.exit(f"[!] '{brief_store or '이 가게'}'는 AI 브리핑도 리뷰도 못 얻었어요. "
"키워드를 직접 주거나 다른 링크를 쓰세요.")
print(f"■ 리뷰 {len(reviews)}개 수집 → 요약 {len(bullets)}줄 (브리핑 대체)")
bullets = (NV.summarize_reviews(genai.Client(api_key=_key), brief_store, reviews)
if reviews else [])
if bullets:
print(f"■ 리뷰 {len(reviews)}개 수집 → 요약 {len(bullets)}줄 (브리핑 대체)")
elif brief_store:
# 브리핑·방문자 리뷰·블로그 리뷰 모두 부실 — 에러로 끝내지 않고
# 그때까지 수집된 정보(가게명)만으로 생성을 계속한다.
print(f"■ 소재 부족 → 수집된 정보(가게명 '{brief_store}')만으로 생성 진행")
bullets = [brief_store]
# 가게명조차 없으면 bullets 가 비어 아래 product 가드에서 종료된다.
product = " ".join(bullets)
print(f"■ 가게: {brief_store or '?'} / 소재 {len(bullets)}줄 → 키워드로 사용")
for b in bullets: