feat(supporters): 회복 일정 플래너를 템플릿·워커에 통합 (/plan·/en/plan), /recovery·/stay 를 /plan 으로 정리
- 템플릿: Planner.astro, lib/plan.ts·tour.ts, styles/plan.css, planStrings, pages plan·en/plan·404. Base 내비 회복 일정 → /plan, 언어 짝 /plan↔/en/plan, 옛 주소 리다이렉트(vercel.json), 사이트맵 - 워커 planner 단계(recovery 다음): scripts/build_planner_data.mjs 가 업종별 기본 규칙표(scripts/template/planner/procedures.plastic|derm.json)에 병원 시술 페이지 원문(recoveryNotes)을 matchKeywords 로 붙이고, 장소는 briefs/<clinic>/planner.places.json(큐레이션) 또는 범용 기본표(관광공사 기준 좌표)로 만든다 - 브리프: viewclinic·oracle 큐레이션 장소. 빈 템플릿(관광 데이터 없음)도 빌드·검증 통과(plan.test 14건) - 이전 세션의 미커밋 작업(피부과 수집·OCR·게이트·언어 스위치, stay 페이지 제거)도 이 커밋에 함께 들어감. docs/prd 변경은 제외 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
1 parent
5c08fa97ab
commit
aa5b05227f
126 files changed
+12916
-2068
No files matched your search
@@ -14,7 +14,12 @@ export function normUrl(u) {
|
||||
const x = new URL(u);
|
||||
let s = x.host.replace(/^www\./, '') + x.pathname;
|
||||
try { s = decodeURIComponent(s); } catch { /* 그대로 */ }
|
||||
return s.replace(/\/+$/, '').toLowerCase();
|
||||
s = s.replace(/\/+$/, '').toLowerCase();
|
||||
// 쿼리가 곧 페이지인 사이트(오라클 index.php?doc=N)를 위해 추적 파라미터를 뺀 쿼리를 키에 넣는다. collect_evidence.normalize 와 같은 규칙.
|
||||
// 2026-09-10: 쿼리를 지우자 시술 페이지 84개가 마지막 한 페이지(휴지기탈모)로 겹쳐 글 근거가 전부 틀렸다.
|
||||
const keep = [...x.searchParams.entries()].filter(([k]) => !/^(utm_|fbclid|gclid|ref$|_ga)/i.test(k)).sort(([a], [b]) => a.localeCompare(b));
|
||||
if (keep.length) s += '?' + keep.map(([k, v]) => `${k}=${v}`).join('&').toLowerCase();
|
||||
return s;
|
||||
} catch { return String(u).replace(/\/+$/, '').toLowerCase(); }
|
||||
}
|
||||
|
||||
@@ -35,7 +40,10 @@ export function loadEvidence(evDir) {
|
||||
return { clinic: index.clinic, start: index.start, fetchedAt: index.fetchedAt, pages, byUrl, doctors, homeText };
|
||||
}
|
||||
|
||||
/** 페이지 items → 읽기용 텍스트. 표는 마크다운 행으로. */
|
||||
/** ocr_evidence.mjs 가 붙인 OCR 섹션(source: "ocr"). 이미지 글자를 기계로 읽은 것이라 원문(HTML)과 구분해 표기한다 */
|
||||
export const ocrSections = (p) => (p.sections ?? []).filter((s) => s?.source === 'ocr' && s.text);
|
||||
|
||||
/** 페이지 items → 읽기용 텍스트. 표는 마크다운 행으로. OCR 섹션은 뒤에 출처 표기와 함께 붙인다. */
|
||||
export function pageToText(p, { maxChars = 9000 } = {}) {
|
||||
const lines = [];
|
||||
for (const it of p.items ?? []) {
|
||||
@@ -45,6 +53,7 @@ export function pageToText(p, { maxChars = 9000 } = {}) {
|
||||
else if (it.kind === 'table') for (const row of it.rows ?? []) lines.push('| ' + row.map((c) => String(c).replace(/\|/g, '/')).join(' | ') + ' |');
|
||||
else lines.push(it.text);
|
||||
}
|
||||
for (const s of ocrSections(p)) lines.push('', `[병원 페이지 이미지 글자 OCR] ${s.heading ?? ''} (이미지 ${s.images?.length ?? 1}장을 기계로 읽은 병원 페이지 원문. 병원이 공개한 자료로 취급해 근거로 쓴다. 글자가 깨졌거나 문맥이 맞지 않는 부분만 쓰지 않고, 수치·제품명은 문장이 온전할 때만 옮긴다)`, s.text);
|
||||
let t = lines.join('\n').replace(/\n{3,}/g, '\n\n').trim();
|
||||
if (t.length > maxChars) t = t.slice(0, maxChars) + `\n…(이 페이지는 ${t.length - maxChars}자가 더 있으나 생략됨. 생략된 부분의 사실은 쓰지 않는다)`;
|
||||
return t;
|
||||
@@ -71,8 +80,9 @@ export function buildContext(brief, { ev, fact, authors, videos, news, answers,
|
||||
const p = ev.byUrl.get(normUrl(url));
|
||||
if (!p) { missing.push(`병원 페이지가 근거 수집 결과에 없음: ${url}`); return; }
|
||||
const imgText = Array.isArray(p.flags) ? p.flags.includes('textInImages') : Boolean(p.flags?.textInImages);
|
||||
if (!p.items?.length) { missing.push(`병원 페이지 본문 0자${imgText ? ' (이미지 글자)' : ''}: ${url}`); return; }
|
||||
cparts.push(`### [C${cparts.length + 1}] ${p.title ?? ''}\nURL: ${p.url}\n수집일: ${p.fetchedAt}\n\n${pageToText(p)}`);
|
||||
const ocr = ocrSections(p);
|
||||
if (!p.items?.length && !ocr.length) { missing.push(`병원 페이지 본문 0자${imgText ? ' (이미지 글자, OCR 없음)' : ''}: ${url}`); return; }
|
||||
cparts.push(`### [C${cparts.length + 1}] ${p.title ?? ''}\nURL: ${p.url}\n수집일: ${p.fetchedAt}${ocr.length ? ' · 본문 일부 또는 전부가 이미지 글자 OCR' : ''}\n\n${pageToText(p)}`);
|
||||
pushSource({ label: `${clinicName} 홈페이지 · ${cleanTitle(p.title, clinicName)}`, url: p.url, accessed: p.fetchedAt ?? today, type: 'clinic' });
|
||||
});
|
||||
parts.push(`## 1. 병원 공식 페이지 원문 (문장을 그대로 옮기지 말 것. 40자 이상 연속 일치는 발행 차단)\n\n${cparts.length ? cparts.join('\n\n') : '(제공된 페이지 없음)'}`);
|
||||
|
||||
Reference in new issue
Block a user