fix(branding): logo URL 컬럼 일관성 + 잘못된 로고 묘사 회피

- 채널 collectors (instagram/facebook/youtube/tiktok) 가 profileImage 를 raw_info.logo_url 컬럼에도 저장
- collect_brand_basics 가 공식 로고 URL 을 branding row 가 아니라 mainpage row 의 logo_url 컬럼에 저장
- select_branding_logo_url 가 mainpage row 의 logo_url 조회하도록 SQL 수정
- select_run_raw_data 가 logo_url 컬럼도 반환 (_logo_url 합성키) → branding._describe_channel_logos 가 컬럼에서 통일된 이름으로 읽음
- _describe_logo candidates 에서 firecrawl ogImage 제거 (이벤트 배너 잘못 잡히던 케이스)
- extra_channels (tiktok/kakaotalk/naver_cafe) language='KR' 박음

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
minaChoiandClaude Opus 4.7 committed 2026-06-02 13:12:58 +09:00
1 parent af61713697
commit 9a9ce1319f
4 files changed
+28 -16

No files matched your search

+6 -4
View File
@@ -63,9 +63,8 @@ async def select_run_sources(analysis_run_id: str) -> list[dict]:
async def select_run_raw_data(analysis_run_id: str) -> dict:
# language='EN' 인 row 는 dict key 를 "<source_type>_en" 으로 합성 (KR/EN 동시 수집 시 키 충돌 방지).
rows = await fetchall(
"SELECT rs.source_type, rs.language, ri.raw_data"
"SELECT rs.source_type, rs.language, ri.raw_data, ri.logo_url"
" FROM raw_info ri JOIN remote_source rs USING (source_id)"
" WHERE ri.analysis_run_id = %s",
(analysis_run_id,),
@@ -76,7 +75,10 @@ async def select_run_raw_data(analysis_run_id: str) -> dict:
key = row["source_type"]
if (row.get("language") or "").upper() == "EN":
key = f"{key}_en"
result[key] = json.loads(raw) if isinstance(raw, str) else raw
data = json.loads(raw) if isinstance(raw, str) else (raw or {})
if isinstance(data, dict) and row.get("logo_url"):
data["_logo_url"] = row["logo_url"]
result[key] = data
return result
@@ -118,7 +120,7 @@ async def select_branding_info_id(analysis_run_id: str) -> int | None:
async def select_branding_logo_url(analysis_run_id: str) -> str | None:
row = await fetchone(
"SELECT ri.logo_url FROM raw_info ri JOIN remote_source rs USING (source_id)"
" WHERE ri.analysis_run_id = %s AND rs.source_type = 'branding' LIMIT 1",
" WHERE ri.analysis_run_id = %s AND rs.source_type = 'mainpage' LIMIT 1",
(analysis_run_id,),
)
return (row or {}).get("logo_url")