feat(supporters): 홈페이지 이미지 단계 — 의료법 기준 이미지 규칙 문서, collect_images.mjs+img_process.py(법 조건부 이미지 자동 제외, 글자 이미지 검사), 워커 images 단계, 글별 히어로·갤러리 매칭. 원진 66장 반영 재배포
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
1 parent
eb873bc43a
commit
dc0d233b58
9 files changed
+397
-14
No files matched your search
@@ -116,11 +116,25 @@ function matchVideos(c) {
|
||||
if (!kws.length) return [];
|
||||
return longs.filter((v) => kws.some((k) => v.title.includes(k))).slice(0, 3).map((v) => ({ id: v.id, title: v.title, published: v.published }));
|
||||
}
|
||||
const posts = candidates.filter((c) => c.pages.length).slice(0, max).map(({ pages: pg, reviewer, area, ...c }) => ({
|
||||
...c, avoid: AVOID, reviewerCandidate: reviewer ?? undefined,
|
||||
evidence: { pages: [...new Set(pg)], shorts: [], news: [], regulation: [], platform: false },
|
||||
videos: matchVideos({ ...c, area }), gallery: [],
|
||||
}));
|
||||
// 글 ↔ 이미지: images.json(collect_images.mjs)의 시술 도해·장비 중 근거 페이지에서 나온 것을 히어로 1 + 갤러리 최대 3. 병원 소개 글은 시설 사진.
|
||||
const imagesPath = join(SITE, 'src/data/images.json');
|
||||
const imgs = existsSync(imagesPath) ? JSON.parse(readFileSync(imagesPath, 'utf8')).items ?? [] : [];
|
||||
const norm = (u) => String(u).replace(/\/$/, '').toLowerCase();
|
||||
function matchImages(c, pg) {
|
||||
const pages = new Set(pg.map(norm));
|
||||
let pool = c.id === 'what-is-clinic' ? imgs.filter((i) => i.category === 'clinic') : imgs.filter((i) => ['procedure', 'equipment'].includes(i.category) && pages.has(norm(i.page.url)));
|
||||
if (c.id === 'visit-guide' || c.id === 'consult-questions') pool = imgs.filter((i) => i.category === 'clinic').slice(0, 2);
|
||||
const pick = pool.slice(0, 4).map((i) => ({ src: i.src, alt: i.alt, caption: i.caption }));
|
||||
return { hero: pick[0], gallery: pick.slice(1, 4) };
|
||||
}
|
||||
const posts = candidates.filter((c) => c.pages.length).slice(0, max).map(({ pages: pg, reviewer, area, ...c }) => {
|
||||
const { hero, gallery } = matchImages(c, pg);
|
||||
return {
|
||||
...c, avoid: AVOID, reviewerCandidate: reviewer ?? undefined,
|
||||
evidence: { pages: [...new Set(pg)], shorts: [], news: [], regulation: [], platform: false },
|
||||
videos: matchVideos({ ...c, area }), ...(hero ? { hero, thumbnail: hero.src } : {}), gallery,
|
||||
};
|
||||
});
|
||||
|
||||
const out = { clinic, generatedAt: new Date().toISOString().slice(0, 10), note: '근거 수집 결과에서 자동 제안한 첫 배치. 사람이 확인·수정한 뒤 생성기에 넣는다(v2 §3-11).', evidenceTypes: index.byType, posts };
|
||||
const outPath = resolve(opt('out', join(SITE, 'briefs.json')));
|
||||
|
||||
Reference in new issue
Block a user