Strengthened system prompts and Zod schema descriptions in both ai-ocr.ts
and ollama.ts with explicit checkbox rules: only mark as checked when a
visible X/checkmark/fill is inside the box, treat empty boxes as unchecked,
and err on the side of unchecked when uncertain. Clarified the ambiguous
nextStep field to distinguish the two checkbox options from the section
heading.
Made-with: Cursor
Rate limiting:
- Retry with exponential backoff (5s, 10s, 20s, 40s) on rate limit errors
- Reduce concurrent OCR jobs from 2 to 1
- Add 2s delay between AI calls within a card (response vs survey side)
- Add 3s delay between cards in a multi-page PDF
- Add 3s delay between jobs in the processing queue
Batch reprocess:
- New /api/cards/reprocess-batch endpoint processes cards sequentially
with delays to respect rate limits
- Reprocess button added to selection toolbar on dashboard
Made-with: Cursor
Replace individual provider SDKs (@ai-sdk/openai, @ai-sdk/google,
@ai-sdk/anthropic) with the Vercel AI Gateway. Cloud models are now
accessed via a single AI_GATEWAY_API_KEY with provider/model strings
(e.g. openai/gpt-4o-mini, google/gemini-2.5-flash). Ollama remains
available as a local fallback via @ai-sdk/openai-compatible.
Made-with: Cursor
Replace the raw Ollama fetch-based OCR with the Vercel AI SDK,
adding support for OpenAI, Google Gemini, Anthropic, and Ollama
as selectable providers from the Settings page. Uses generateText
with Output.object() and Zod schemas for type-safe structured
data extraction.
Made-with: Cursor