- Search input + Find/Clear buttons above the map
- Partial match search against all marker machine_ids
- Matched markers get amber pulsing highlight icon (22px)
- Auto-zoom to fit matched markers
- Clear button restores original view
- Store _exifGpsPhotos globally for search
- Store machineId on each marker at creation time
- Store default icon reference for proper restore on clear
- CSS: animated amber pulse ring around highlighted markers
Adds a toggle switch in the summary bar to quickly hide non-GPS
photos from the gallery grid. More discoverable than filter chips.
- Toggle switch with clean CSS animation (sliding pill)
- Renders inline in summary grid next to GPS/no-GPS counts
- Overrides filter chips when active (GPS-only supremacy)
- Persists across photo additions (DOM state, not reset)
- Gallery, detail card, and upload functions all respect it
- Extracted updateFilterChips() helper to decouple chip visual state from
the brittle event.target dependency in setFilter()
- Call updateFilterChips() inside renderGallery() so chip visual state
always matches currentFilter when gallery re-renders
- Reset chip classes in resetAll() to prevent stale active state from
persisting across sessions
- Fixes a bug where resetAll() set currentFilter='all' but left a
previous chip (e.g. '📍 GPS') visually active
saveMachineIdInline used wrong field names when rendering the
location info div after a successful assignment:
'location_name', 'building', 'zone' — none of which exist in
the asset dict returned by lookup_machine_id().
Replaced with the correct fields matching lookupPrevAsset():
building_name, floor, room, address, make, model
Now pressing Enter on an inline machine ID edit correctly shows
the asset's building, floor, room, address, and make/model.
Three changes:
1. renderPrevCard: always render prevAsset/prevMachineInfo divs
(not conditional on GPS coordinates)
2. loadPreviousPhotos: call lookupPrevAsset for ALL photos with
machine_id, not just those with GPS coords
3. saveMachineIdInline: dynamically create asset info divs on
the card if they don't exist yet (defensive fallback)
Previously, manually entering a machine ID on a card without GPS
would silently succeed but never show the asset name/location
because the display elements only existed on GPS-equipped cards.
Tap any machine ID in the Previous Photos list to edit it inline.
- Replaces static text with editable input on click/tap
- Enter/blur saves via /api/assign-machine-id
- Esc restores original value
- Shows ✏️ indicator on hover
- Saves new ID to DB, refreshes asset info and badge instantly
- resetPhoto() now downloads the photo blob before calling the reset endpoint,
then re-shows it in the detail view with preview and manual entry
- resetAndReupload() same treatment, with fallback to server fetch
- Added Reset button to ALL server results (not just duplicates)
- Preview in Previous Photos cards with lightbox (prev-thumb + openLightbox)
- Always show manual entry field regardless of OCR result or GPS presence
- Context-sensitive label: different text when OCR found digits vs none
- Add Assign button to manual lookup result (POST /api/assign-machine-id)
- Add Push GPS button when GPS available after assign
- Store _lastPhotoId / _lastPhotoGps for manual entry functions
- Add lightbox: full-screen photo viewer with pinch/scroll/double-tap zoom
When OCR finds 5+ digits (match_5plus) but no 5-6 pattern, the frontend
now extracts the first 5 digits as the candidate machine ID, shows it,
and calls lookupAsset() to check the canteen DB — same behavior as the
5dash6 path. Eliminates the confusing '(no 5-6 pattern)' message.
- PhotoQueue class with IndexedDB store (queued/uploading/done/failed)
- uploadSelected() and startBulkProcess() check navigator.onLine and queue offline
- Online event auto-drains queue via /api/bulk-process with exponential backoff
- Offline banner shows queued count, hides when empty
- Service Worker: cache-first static, network-first API, background sync listener
- Exponential backoff: 2s → 5s → 15s, then mark failed after 3 retries
- server.py now auto-loads .env file directly (robust key loading)
- Strip whitespace from all env var values
- Add POST /api/photos/{id}/reset endpoint to delete + allow re-upload
- Frontend: Reset button on prev-photo-cards + duplicate banners
- Improved mini-map rendering with better popups and zoom control
- Machine info panel shows building/floor/room/address/model details
- Added resetAndReupload() for in-place re-processing after reset
- SQLite DB (photos.db) — persists all processed photo records
- Dedup by SHA256 hash — same file upload returns duplicate: true
- /api/photos — list previously processed photos
- /api/photos/{id} — get single record
- /api/photos/{id}/file — serve saved image
- /api/photos/{id}/reprocess — re-run OCR with different engine/model
- Google Gemini OCR engine (gemini-2.5-flash, free tier) alongside
OpenCode Go LLM and Tesseract
- Sticker mode — specialized LLM/Google prompt for green/orange/yellow
equipment stickers with 2D barcode + machine ID
- Manual machine ID entry — when GPS exists but OCR fails, show text
input for manual lookup
- Frontend: Previous Photos section, Re-run OCR per photo, duplicate
badges, engine dropdown, sticker toggle
- Add run_ocr_llm_batch() — sends N images in a single vision API call
with structured JSON prompt, up to 20 images per batch
- Add _resize_for_llm() — downscales images to 1600px max dimension
before sending to LLM, reducing per-image token cost
- Update bulk_process() to pre-read all files and batch-OCR in one call
- Graceful fallback: if batch JSON parsing fails, retries individually
- Frontend shows llm_batch engine badge
Without batch: N photos = N API calls (each with full prompt overhead)
With batch: N photos = ceil(N/20) API calls + image downscaling savings
Adds optional LLM-based OCR as an alternative to Tesseract for reading
machine IDs from photos.
Backend (server.py):
- New run_ocr_llm() function calls OpenCode Go API (mimo-v2-omni model)
- Auto-falls back to Tesseract if API key missing or call fails
- Endpoints /api/analyze and /api/bulk-process accept ?ocr_engine=llm
query param (default: tesseract) and ?ocr_model for model override
- Configurable via env vars: OPENCODE_GO_API_KEY, LLM_OCR_MODEL
- Requires User-Agent: Hermes-Agent/1.0 header for OpenCode Go API
Frontend (static/index.html):
- Toggle checkbox 'Use LLM OCR' in the UI
- OCR engine badge shown in results (llm vs tesseract + model name)
- getOcrParams() helper appends ?ocr_engine=llm to API calls
Infrastructure:
- .gitignore for uploads/ directory
Closes: #2
Root cause: FileReader.readAsDataURL() loads the entire file into memory
as a base64 string. With 50+ iPhone photos (3-12 MB each), this exceeds
iOS Safari's per-tab memory limit and freezes the tab.
Changes:
- Replace readAsDataURL with URL.createObjectURL(file) — zero-copy file
reference, no memory bloat (static/index.html)
- Reduce batch size from 4 to 2 — gentler on memory-constrained devices
- Add URL.revokeObjectURL() on reset — prevent blob URL leaks
- Add HEIC/HEIF support to server.py — iPhone format compatibility
Closes#1