feat(supporters): 채널 발견+엔티티 검증 — discover_channels.mjs(사이트 전수·웹검색·핸들 변형·레지스트리·플랫폼 검색, 근거 점수 3-state), 워커 discover 단계 → surfaces/sameAs, 패널·리포트 발견 채널 표, 원진 리포트 갱신

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
Haewon KamandClaude Fable 5.1 committed 2026-09-08 10:06:28 +09:00
1 parent 388a4a5ea4
commit 995e1e7dfa
10 files changed
+2052 -4

No files matched your search

+2 -1
View File
@@ -3,7 +3,8 @@
병원 홈페이지 URL 하나로 근거 수집 → 팩트 시트·의료진 초안 → 첫 배치 기획 → 글 생성(GPT-4.1, 게이트·근거 대조) → Astro 빌드·발행 게이트 → Vercel 미리보기(noindex) 까지 돈다. 사람 게이트(의학 검토·게시 승인)는 자동화하지 않는다.
```
node workers/supporters-build/run.mjs --clinic <id> --url <https://...> [--name 상호] [--deploy] [--build-id <uuid>] [--max-cost-usd 10]
node workers/supporters-build/run.mjs --clinic <id> --url <https://...> [--name 상호] [--logo file.svg] [--youtube 채널] [--deploy] [--build-id <uuid>] [--max-cost-usd 10]
# 단계: evidence → data → discover(채널 발견·엔티티 검증) → youtube(로고·파비콘·채널 집계) → images(의료법 기준 이미지) → inputs → briefs → generate → build → deploy
node workers/supporters-build/poll.mjs [--loop 300] [--no-deploy] # supporter_builds 큐(status=queued)를 집어 run.mjs 실행
```
+31 -2
View File
@@ -26,7 +26,7 @@ const clinic = opt('clinic'); const url = opt('url');
if (!clinic || !url) { console.error('사용법: --clinic <id> --url <https://...>'); process.exit(2); }
const WORK = resolve(opt('work', join(homedir(), 'supporters-builds', clinic)));
const today = new Date().toISOString().slice(0, 10);
const PHASES = ['evidence', 'data', 'youtube', 'images', 'inputs', 'briefs', 'generate', 'build', 'deploy', 'done'];
const PHASES = ['evidence', 'data', 'discover', 'youtube', 'images', 'inputs', 'briefs', 'generate', 'build', 'deploy', 'done'];
const startFrom = opt('from', 'evidence');
(function loadEnv() { const p = join(ROOT, '.env'); if (!existsSync(p)) return; for (const line of readFileSync(p, 'utf8').split('\n')) { const m = line.match(/^\s*([A-Z0-9_]+)\s*=\s*(.*)\s*$/); if (m && !process.env[m[1]]) process.env[m[1]] = m[2].replace(/^["']|["']$/g, ''); } })();
@@ -121,7 +121,31 @@ await phase('data', () => {
return `${fact.shortName || '(상호 확인 대기)'} · 전화 ${fact.phone || '확인 대기'} · 의료진 ${doctors.length}명`;
});
// 2b. 로고·파비콘 (--logo <svg|png 파일>) + 유튜브 채널 집계 (--youtube <채널> 또는 근거의 유튜브 링크 자동 발견)
// 2a. 채널 발견 + 엔티티 검증 (datacrawling 스킬). 상호·URL 로 유튜브·인스타·페북·블로그·틱톡·카카오·강남언니·플레이스를 찾고, CONFIRMED 만 사이트에 반영한다. CANDIDATE 는 사람 확인 목록.
await phase('discover', () => {
if (flag('no-discover')) return '건너뜀 (--no-discover)';
const fact = readJson(join(DATA, 'factSheet.json'));
const argv = ['scripts/discover_channels.mjs', '--clinic', clinic, '--url', url, '--evidence', EV, '--out', join(WORK, 'channels.json')];
if (opt('name') || fact.shortName) argv.push('--name', opt('name') || fact.shortName);
const r = run('node', argv);
if (!r.ok || !existsSync(join(WORK, 'channels.json'))) throw new Error(`채널 탐색 실패\n${tail(r.out)}`);
const ch = readJson(join(WORK, 'channels.json'));
cpSync(join(WORK, 'channels.json'), join(DATA, 'channels.json'));
// CONFIRMED 첫 항목(구독자·점수 순)을 팩트 시트 surfaces 에. 유튜브는 youtube 단계가 이 값을 쓴다.
const top = (p) => (ch.platforms[p] ?? []).find((x) => x.status === 'CONFIRMED');
const LABEL = { youtube: '유튜브', instagram: '인스타그램', facebook: '페이스북', naverBlog: '네이버 블로그', tiktok: '틱톡', kakao: '카카오톡 채널', gangnamunni: '강남언니', naverPlace: '네이버 플레이스', babitalk: '바비톡' };
fact.surfaces = fact.surfaces ?? {};
for (const p of Object.keys(LABEL)) {
const x = top(p); if (!x) continue;
fact.surfaces[p] = { ...(fact.surfaces[p] ?? {}), label: LABEL[p], url: x.url, title: x.title ?? undefined, checked: ch.checkedAt, ...(x.subscribers ? { subscribers: x.subscribers, videos: x.videos } : {}) };
}
if (!fact.kakao && top('kakao')) fact.kakao = top('kakao').url;
writeJson(join(DATA, 'factSheet.json'), fact);
status.report = { ...(status.report ?? {}), channels: { inventory: ch.inventory, confirmed: Object.fromEntries(Object.entries(ch.platforms).map(([p, l]) => [p, l.filter((x) => x.status === 'CONFIRMED').map((x) => ({ key: x.key, url: x.url, title: x.title, subscribers: x.subscribers, evidence: x.evidence }))])), candidates: Object.fromEntries(Object.entries(ch.platforms).map(([p, l]) => [p, l.filter((x) => x.status === 'CANDIDATE').map((x) => ({ key: x.key, url: x.url, title: x.title, evidence: x.evidence }))])) } };
return ch.inventory.map((i) => `${i.platform} ${i.state}${i.confirmed ? `(${i.confirmed})` : ''}`).join(' · ');
});
// 2b. 로고·파비콘 (--logo <svg|png 파일>) + 유튜브 채널 집계 (--youtube <채널> 또는 발견 단계의 CONFIRMED 유튜브)
await phase('youtube', () => {
const notes = [];
// 로고: 헤더·푸터·카드 대체 이미지·파비콘. SVG 는 viewBox 를 정사각 파비콘으로 감싼다.
@@ -153,6 +177,11 @@ await phase('youtube', () => {
// 유튜브: 채널 인자 없으면 근거 페이지 링크에서 youtube.com/channel|@handle 을 찾는다
let channel = opt('youtube') ?? null;
if (!channel && existsSync(join(DATA, 'channels.json'))) {
// 발견 단계에서 CONFIRMED 된 유튜브 중 구독자가 가장 많은 채널
const yt = (readJson(join(DATA, 'channels.json')).platforms?.youtube ?? []).filter((x) => x.status === 'CONFIRMED').sort((a, b) => (b.subscribers ?? 0) - (a.subscribers ?? 0))[0];
if (yt) { channel = yt.channelId ?? yt.key; notes.push(`유튜브 채널 자동 선택: ${yt.title ?? yt.key}`); }
}
if (!channel) {
const idx = readJson(join(EV, 'index.json'));
outer: for (const p of idx.pages.slice(0, 30)) {