16 Commits
Author SHA1 Message Date
Alex-GilbertandClaude Opus 4.6 672bdc3223 fix: batch LLM validation, stream results, improve scoring prompt
- Batch candidates in groups of 50 (was 200) to avoid output token
  truncation that caused all-zero scores
- Stream scored results via SSE as each batch completes instead of
  waiting for all batches to finish
- Include solve_id in done event so validate works when results fit
  in a single page
- Rewrite prompt to judge sentence coherence ("does it make sense")
  rather than word predictability ("is it expected")
- Frontend inserts results in score-sorted order as they arrive

Co-Authored-By: Claude Opus 4.6 <[email protected]>
2026-02-23 21:17:00 -06:00
Alex-GilbertandClaude Opus 4.6 f7dd5a342a feat: add POST /api/solve/{id}/validate endpoint
Co-Authored-By: Claude Opus 4.6 <[email protected]>
2026-02-23 16:19:21 -06:00
Alex-GilbertandClaude Opus 4.6 b51dc18d9c feat: clean up solve buffer on cancel
Co-Authored-By: Claude Opus 4.6 <[email protected]>
2026-02-23 14:50:40 -06:00
Alex-GilbertandClaude Opus 4.6 6341bcdfa3 feat: add GET /api/solve/{id}/results pagination endpoint
Co-Authored-By: Claude Opus 4.6 <[email protected]>
2026-02-23 14:50:07 -06:00
Alex-GilbertandClaude Opus 4.6 f0b444d26c feat: cap SSE stream at PAGE_SIZE and buffer remaining results
Co-Authored-By: Claude Opus 4.6 <[email protected]>
2026-02-23 14:49:30 -06:00
Alex-GilbertandClaude Opus 4.6 2783ed2615 feat: spot endpoint returns full analysis data
Enrich POST /api/doc/{doc_id}/page/{page}/spot to call
analyze_spot_redaction when OCR data is cached, returning full
analysis JSON (segments, gap, font, line, offsets) alongside the
bounding box. This makes spot redactions first-class, matching the
analysis format returned by get_page_data for auto-detected redactions.

Co-Authored-By: Claude Opus 4.6 <[email protected]>
2026-02-20 12:42:18 -06:00
Alex-GilbertandClaude Opus 4.6 ced68f2321 feat: add /api/doc/{id}/ocr SSE endpoint for cached OCR
Co-Authored-By: Claude Opus 4.6 <[email protected]>
2026-02-20 12:36:46 -06:00
Alex-GilbertandClaude Opus 4.6 4a92cb8463 fix: update app tests for mode/charset restructuring
Replaced test_solve_endpoint_dictionary and test_dictionary_crud with
test_solve_endpoint_name_mode testing the new name mode.

Co-Authored-By: Claude Opus 4.6 <[email protected]>
2026-02-18 13:16:57 -06:00
Alex-GilbertandClaude Opus 4.6 3c867de6aa feat: add offset_x/offset_y to analyze response for alignment guess
Co-Authored-By: Claude Opus 4.6 <[email protected]>
2026-02-16 15:20:11 -06:00
Alex-GilbertandClaude Opus 4.6 4a8716539d feat: add /api/redaction/analyze endpoint for on-demand OCR + font detection
When a user clicks a redaction, this endpoint crops the surrounding line,
runs Tesseract OCR, detects the font, and returns text segments (before/after
the redaction), gap width, font info, and character-level bounding boxes.

Co-Authored-By: Claude Opus 4.6 <[email protected]>
2026-02-16 14:40:17 -06:00
Alex-GilbertandClaude Opus 4.6 c0f52772ee refactor: simplify upload endpoint to use redaction detection instead of OCR
Replace upfront OCR + font detection + overlay rendering with lightweight
OpenCV-based redaction detection. Upload now just rasterizes and detects
black rectangles, making it significantly faster. Remove the overlay
endpoint and update the data endpoint to return redaction bboxes.

Co-Authored-By: Claude Opus 4.6 <[email protected]>
2026-02-16 14:37:54 -06:00
Alex-GilbertandClaude Opus 4.6 4bfe7c85a7 feat: add GET /api/associates endpoint
Lazy-loads associates.json from data dir and serves it at /api/associates,
with fallback to empty dicts if file is missing.

Co-Authored-By: Claude Opus 4.6 <[email protected]>
2026-02-16 07:51:07 -06:00
Alex-GilbertandClaude Opus 4.6 d391bfa6d6 feat: SSE solve endpoint with dictionary and enumerate modes
Add POST /api/solve endpoint that streams results via Server-Sent Events,
supporting both enumerate (brute-force) and dictionary solve modes. Add
dictionary CRUD endpoints (POST/GET/DELETE /api/dictionary) and solve
cancellation (DELETE /api/solve/{id}). Move static files mount to end of
app.py so API routes take priority.

Co-Authored-By: Claude Opus 4.6 <[email protected]>
2026-02-15 22:20:20 -06:00
Alex-GilbertandClaude Opus 4.6 b9df273521 Add interactive font tuning UI with split-panel layout
Replace static overlay with client-side canvas rendering. Left panel
shows clickable OCR lines with font controls (dropdown + size slider).
Right panel renders green text overlay on the document via canvas.
Fonts loaded from backend TTF files using the FontFace API.

New endpoints: GET /api/fonts, GET /api/font/{id}

Co-Authored-By: Claude Opus 4.6 <[email protected]>
2026-02-15 20:17:57 -06:00
Alex-GilbertandClaude Opus 4.6 d2b149f1ba feat: per-line font detection with prior bias
Instead of detecting one font per page, detect the font for each line
independently. The previous line's font is used as a prior — if it
scores within 15% of the best candidate, it's kept for consistency.
This handles documents with mixed fonts (bold headers, regular body,
different sections).

Also: redirect / to the static UI, fix data endpoint to return
per-line font info.

Co-Authored-By: Claude Opus 4.6 <[email protected]>
2026-02-15 19:24:48 -06:00
Alex-GilbertandClaude Opus 4.6 c95b6cb9d7 feat: FastAPI backend with upload, overlay, and data endpoints
Adds POST /api/upload (runs full pipeline: rasterize, OCR, font detect,
overlay), GET endpoints for original/overlay images and OCR data JSON.
Also adds python-multipart, anyio, and pytest-anyio dependencies.

Co-Authored-By: Claude Opus 4.6 <[email protected]>
2026-02-15 18:53:48 -06:00