Amirali/overlay#7
Conversation
Emphasize pixel-perfect preservation of original document. The model should only ADD red handwritten overlays on blank fields, never modify or regenerate any existing content. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Two-step deterministic approach: 1. Qwen-VL detects blank form fields + coordinates (% of image) 2. Pillow draws red placeholder boxes + English text at those positions No image regeneration — original document preserved pixel-perfect. Robust JSON parsing handles LLM quirks (single quotes, trailing commas, malformed coordinate pairs). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…ction Two-step approach: 1. Qwen-VL-Max detects blank form fields → bbox_2d [x1,y1,x2,y2] in 0-1000 range 2. Pillow draws red highlight boxes + English placeholder text at exact positions Tested on tax form (data/fields.png): all 8 form fields detected and annotated. Original image preserved pixel-perfect — only red overlays added. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…lution Qwen-VL returns bbox_2d in its internal processing resolution, not a fixed 0-1000 range. Now derives scale factors from the max coordinate values in the response, mapping accurately to actual image pixels. Tested on data/fields.png: all 8 form fields correctly overlaid. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Boxes now measured from the actual text width instead of the full detected bbox — no more covering existing printed labels. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…d/ and ai/ Remove unused imports (json, re, datetime, os, sys, timedelta, List, Dict, Optional, Any, RagHit, generate_reply_text), replace bare except with except Exception, move module-level imports to top of file, remove unused variable assignments (classification_data, action_titles), strip extraneous f-string prefixes, and apply ruff formatting throughout. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
mytestingaccount2026
left a comment
There was a problem hiding this comment.
🔍 TODO/FIXME Scan Results
I scanned all added lines in this PR (lines beginning with +, excluding +++ file headers) across the following changed files:
| File | TODO/FIXME Found? |
|---|---|
.github/workflows/lint.yml |
✅ None |
ai/form_fill.py |
✅ None |
ai/rag/retrieval.py |
✅ None |
backend/app/services/risk.py |
✅ None |
No TODO or FIXME comments were introduced in this PR. 🎉
🔍 Automated Security & Quality Review — PR #7 (amirali/overlay)Diff reviewed:
1. Security vulnerabilities / unsafe patterns
2. Project-convention / image-library usage
3. Hardcoded values that should move to config
4. Summary / recommendationNo committed secrets and no critical injection/traversal vectors. The two items worth blocking on before merge:
Then address conventions ( 🤖 Generated automatically. Note: |
🤖 Automated PR Review —
|
aircode610
left a comment
There was a problem hiding this comment.
Migration Safety Review ✅
No new database migrations found in this PR. This PR is safe to run on production data.
What was checked
-
No migration files added or modified — There are no Alembic migration files, SQL scripts, or any other migration artifacts in this PR. The repository does not use a formal migration framework (it uses
SQLModel.metadata.create_all()for schema creation). -
No schema changes in
models.py— The changes tobackend/app/models.pyare purely cosmetic formatting (ruff auto-formatting). Specifically:- Whitespace alignment changes in
DocumentCategoryenum values (e.g.,"health_insurance" #→"health_insurance" #) - Comment alignment changes in
Lettermodel fields (e.g.,letter_type: str = "" #→letter_type: str = "" #) - Line wrapping of the
GOVERNMENT_BENEFITSenum value - No columns added, removed, renamed, or type-changed
- No table names changed
- No relationship or index modifications
- Whitespace alignment changes in
-
No schema changes in
database.py— The only change is an added blank line (formatting).SQLModel.metadata.create_all(engine)call is unchanged. -
No schema changes in
schemas.py— Changes are formatting only (line wrapping ofField()kwargs, removing unusedAnyimport). These are Pydantic response schemas, not ORM/DB models.
Summary of actual PR changes
This PR contains:
ai/form_fill.py: Refactored to use Pillow overlay instead of image generation (Qwen-VL field detection + deterministic drawing).github/workflows/lint.yml: New CI workflow for ruff linting- All other files: Ruff auto-formatting (whitespace, import sorting, line wrapping) and removal of unused imports/variables — no behavioral changes to DB layer
Verdict: Safe to deploy. No database schema changes, no migrations needed.
No description provided.