fix(13): switch to GPT-4o vision — render PDF pages as images for accurate field placement

- extractPdfText now renders each page to JPEG via @napi-rs/canvas + pdfjs-dist (108dpi)
- field-placement.ts sends rendered page images to GPT-4o with vision (detail: high)
- AI can now visually identify underlines, signature blocks, date fields, initials boxes
- System prompt focuses on visual cues (blank lines, boxes) not text pattern matching
- Handles multi-field lines: separate fields for signature blank and date blank on same line

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Chandler Copeland
2026-03-21 17:40:47 -06:00
parent b5216a8542
commit e7bf5abb9f
4 changed files with 75 additions and 86 deletions

View File

@@ -18,6 +18,7 @@
"@cantoo/pdf-lib": "^2.6.3",
"@dnd-kit/core": "^6.3.1",
"@dnd-kit/utilities": "^3.2.2",
"@napi-rs/canvas": "^0.1.97",
"@react-email/components": "^1.0.10",
"@react-email/render": "^2.0.4",
"@vercel/blob": "^2.3.1",