feat: Vision Analysis — screenshot capture + Gemini Vision extraction

WP-V1: Multi-page screenshot capture via Firecrawl
  - Captures 6+ pages: main, doctors, surgery, YouTube, Instagram, 강남언니
  - Runs in parallel within collect-channel-data Phase 2

WP-V2: Gemini Vision analysis per screenshot
  - Page-specific prompts (main page OCR, doctor profiles, channel stats)
  - Extracts: founding year, doctors, certifications, services, social icons,
    brand colors, slogans, YouTube/Instagram stats from screenshots

WP-V3: Vision data pipeline integration
  - channel_data.visionAnalysis: merged structured data
  - channel_data.screenshots[]: evidence for report EvidenceGallery
  - generate-report embeds screenshots as report.screenshots[]
  - buildChannelSummary includes Vision data in AI prompt

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Haewon KamandClaude Opus 4.6 committed 2026-04-04 23:59:19 +09:00
1 parent 494dc186c5
commit 6a3390840d
3 files changed
+348

No files matched your search

@@ -132,6 +132,19 @@ ${JSON.stringify(scrapeData.branding || {}, null, 2).slice(0, 1000)}
report.channelEnrichment = channelData;
report.enrichedAt = new Date().toISOString();
// Embed screenshots as evidence for frontend EvidenceGallery
const screenshots = (channelData.screenshots || []) as Record<string, unknown>[];
if (screenshots.length > 0) {
report.screenshots = screenshots.map((ss: Record<string, unknown>) => ({
id: ss.id,
url: ss.url, // data URI or Storage URL
channel: ss.channel,
capturedAt: ss.capturedAt,
caption: ss.caption,
sourceUrl: ss.sourceUrl,
}));
}
// Embed verified handles
const igHandles = (verified.instagram || []).filter((v: { verified: boolean }) => v.verified).map((v: { handle: string }) => v.handle);
report.socialHandles = {
@@ -344,5 +357,27 @@ function buildChannelSummary(channelData: Record<string, unknown>, verified: Rec
parts.push(`### 네이버 플레이스: ${np.name} (${np.category})`);
}
// Vision Analysis (from Gemini Vision on screenshots)
const vision = channelData.visionAnalysis as Record<string, unknown> | undefined;
if (vision) {
parts.push("\n### Vision Analysis (스크린샷 기반 추출 데이터)");
if (vision.foundingYear) parts.push(`- 개원 연도: ${vision.foundingYear}`);
if (vision.operationYears) parts.push(`- 운영 기간: ${vision.operationYears}년`);
const doctors = vision.doctors as { name: string; specialty: string; position?: string }[] | undefined;
if (doctors?.length) {
parts.push(`- 의료진 (스크린샷 확인): ${doctors.map(d => `${d.name}(${d.specialty}${d.position ? ', ' + d.position : ''})`).join(', ')}`);
}
const certs = vision.certifications as string[] | undefined;
if (certs?.length) parts.push(`- 인증: ${certs.join(', ')}`);
const services = vision.serviceCategories as string[] | undefined;
if (services?.length) parts.push(`- 시술 카테고리: ${services.join(', ')}`);
const slogans = vision.slogans as string[] | undefined;
if (slogans?.length) parts.push(`- 슬로건: ${slogans.join(' / ')}`);
const ytStats = vision.youtubeStats as Record<string, string> | undefined;
if (ytStats) parts.push(`- YouTube (스크린샷): 구독자 ${ytStats.subscribers || '?'}, 영상 ${ytStats.videos || '?'}`);
const igStats = vision.instagramStats as Record<string, string> | undefined;
if (igStats) parts.push(`- Instagram (스크린샷): 팔로워 ${igStats.followers || '?'}, 게시물 ${igStats.posts || '?'}`);
}
return parts.join("\n");
}