fix(ai,pdf): heal malformed section content and add PDF export fallback
#87 — "打不开修好的简历" / AI generation errors:
- Add src/lib/resume/normalize-content.ts: coerce inner list fields
(highlights/technologies/skills) to arrays so AI-written strings can't
crash the template renderers. - Apply on read (resume-store, preview page) to heal already-corrupted
resumes, and on write (updateSection/rewriteText/translateResume,
generate-resume route) to prevent new corruption. - Wrap the preview in a PreviewErrorBoundary and harden isSectionEmpty so
a bad section degrades to an inline message instead of the full-page
error screen. - generate-resume robustness: raise output token cap, retry without
json_object for OpenAI-compatible endpoints that reject it, surface the
real error message.
#85 — PDF / 智能一页 export 502:
- Add a client-side "print to PDF" fallback in the export dialog for when
server-side Chromium is unavailable/OOM (fetches print HTML into a
hidden iframe and opens the browser print dialog). - getBrowser() no longer blindly trusts CHROME_PATH (verify + fall through
to candidates); export route returns the real error. - Remove stray UTF-8 BOM from generate-pdf.ts.
Tests: normalize-content unit tests + updateSection regression cases.
Co-Authored-By: Claude Opus 4.8 (1M context) noreply@anthropic.com