Add client-side image resize and server-side image token budgeting
Client (useFileUpload.js):
- Resize images to max 1024px on longest side via Canvas before upload
- JPEG quality 0.9, preserves EXIF orientation
- Reduces typical phone photos from 8 MB → ~400-900 KB

Server (websocket.py):
- Increase limit to 8 images, 50 MB total payload

Server (agent.py):
- Before adding user message to session.context, estimate how many images
  fit in remaining context (500 tok/img, up to 80% of max_context_tokens)
- Images that don't fit are saved as resized JPEGs to session_files/
- References to saved images are appended to the user message text
  so Navi can view them later via image_view tool
- session.messages keeps ALL images for full UI history

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
1 parent 2303c2c commit aff07b139e7787b1c26cfc4cdcf6a248c2e99e54
@Eugene Sukhodolskiy Eugene Sukhodolskiy authored on 25 May
Showing 6 changed files
View
navi/api/websocket.py
View
navi/core/agent.py
View
webclient/dist/assets/index-CbnyFB94.js 100644 → 0
Not supported
View
webclient/dist/assets/index-DJBtbgOt.js 0 → 100644
Not supported
View
webclient/dist/index.html
View
webclient/src/composables/useFileUpload.js