- Install openai 6.32.0 (npm package, listed in dependencies) - Create src/lib/ai/extract-text.ts — pdfjs-dist legacy build server-side text extraction - extractPdfText(filePath) returning PageText[] with page, text, width, height - GlobalWorkerOptions.workerSrc = '' for Node.js fake-worker mode - Text per page capped at 2000 chars for GPT-4o-mini context limit - Create src/lib/ai/field-placement.ts — GPT-4o-mini structured output + coord conversion - aiCoordsToPagePdfSpace() converts AI top-left pct coords to PDF bottom-left points - classifyFieldsWithAI() uses manual json_schema (NOT zodResponseFormat — broken with Zod v4) - Standard field sizes: checkbox=24x24pt, others=144x36pt - textFillData keyed by field UUID (not label) per Phase 12.1 design - All 3 unit tests pass (GREEN phase confirmed)
484 KiB
484 KiB