| 13-ai-field-placement-and-pre-fill |
01 |
ai |
| openai |
| pdfjs-dist |
| coordinate-conversion |
| tdd |
| gpt-4o-mini |
| structured-output |
|
| phase |
provides |
| 12.1-per-field-text-editing-and-quick-fill |
textFillData keyed by field UUID, DocumentPageClient state architecture |
|
| phase |
provides |
| 10-expanded-field-types-end-to-end |
SignatureFieldType union, SignatureFieldData interface |
|
|
| extractPdfText(filePath) — pdfjs-dist server-side text extraction returning PageText[] |
| aiCoordsToPagePdfSpace() — AI top-left pct to PDF bottom-left points with Y-axis flip |
| classifyFieldsWithAI() — GPT-4o-mini structured output call returning SignatureFieldData[] + textFillData |
| AiFieldCoords interface |
| Unit test for coordinate conversion (3 cases, US Letter dimensions) |
|
| 13-02-ai-route |
| 13-03-ui-button |
| 13-04-integration-test |
|
| added |
patterns |
|
|
| pdfjs-dist legacy build with GlobalWorkerOptions.workerSrc='' for Node.js server-side use |
| Manual json_schema response_format with strict=true (NOT zodResponseFormat — broken with Zod v4) |
| Standard field sizes override AI dimensions (checkbox=24x24pt, others=144x36pt) |
| textFillData keyed by crypto.randomUUID() field ID (not label) |
|
|
| created |
modified |
| teressa-copeland-homes/src/lib/ai/extract-text.ts |
| teressa-copeland-homes/src/lib/ai/field-placement.ts |
| teressa-copeland-homes/src/lib/pdf/__tests__/ai-coords.test.ts |
|
| teressa-copeland-homes/package.json (openai dependency added) |
| teressa-copeland-homes/package-lock.json |
|
|
| openai 6.32.0 installed as production dependency (not devDependency) |
| GlobalWorkerOptions.workerSrc = '' required for Node.js server-side pdfjs-dist — do NOT share with browser components |
| Manual json_schema response_format confirmed required — zodResponseFormat broken with Zod v4 (issues #1540 #1602 #1709) |
| Standard field sizes (checkbox=24x24, others=144x36pt) override AI widthPct/heightPct for consistency |
| textFillData keyed by UUID assigned in route handler — not by label — matches Phase 12.1 design |
|
| Pattern: lib/ai/* files carry // server-only guard comment — never imported from client components |
| Pattern: aiCoordsToPagePdfSpace is the single named utility for AI-to-PDF coord conversion — replicated from FieldPlacer.tsx formula |
|
|
2min |
2026-03-21 |