Large images (10MB+ PNG) create huge base64 payloads that cause
OpenRouter/Gemini API timeouts. Now resized to 1024px JPEG quality 85
before sending, reducing payload from ~15MB to ~100KB.
- _generate_openrouter: log request start, response time, timeout details
with httpx.Timeout (connect=15s, rest=AI_REQUEST_TIMEOUT)
- All AI functions: log error_type (exception class name) + truncated error
- _retry_with_backoff: log each attempt with wait time
- Clean rewrite of ai_vision.py
- process_image_pipeline: wrapped in try/finally to guarantee processing_status
is always updated, even on unexpected crashes/timeouts
- init_db: recovery query that marks images stuck in 'processing' for >10min
as ERROR on startup
- Clean rewrite of pipeline.py for consistent indentation
Backend:
- RuntimeAIConfig singleton: mutable in-memory overrides for provider/model
- PATCH /admin/api/ai/config: change active provider/model on the fly
- GET /admin/api/ai/config: read current runtime state
- ai_vision.py: uses runtime_ai_config before falling back to settings
- health/status endpoints reflect runtime overrides
Frontend:
- 'Définir comme actif' button in AI config section
- Live feedback message on save
Backend:
- Add ai_provider + ai_model columns to APIClient model
- New admin_ai router: GET /admin/api/ai/status + POST /admin/api/ai/test
- Update ai_vision.py: provider_override + model_override support
- Update pipeline: load client AI prefs for image processing
- ClientUpdate/ClientResponse schemas include ai_provider/ai_model
Frontend:
- New AIConfigSection component: provider list, model dropdowns,
test button with live results (no page refresh needed)
- AI types (ai.types.ts) + API (api/ai.ts)
- APIClient types extended with ai_provider/ai_model
Introduce an admin portal (React + Nginx), WebSocket routing, and
API versioning middleware with `/api/v1/` prefix deprecation.
Add master API key authentication, new Prometheus metrics for AI
token consumption and active WebSockets, and extend S3 config
with a public endpoint URL. Update test paths and fixtures to
align with the new routing structure.
- Implement tests for database generator to ensure proper session handling.
- Create tests for EXIF extraction and conversion functions.
- Add tests for image-related endpoints, ensuring proper data retrieval and isolation between clients.
- Develop tests for OCR functionality, including language detection and text extraction.
- Introduce tests for the image processing pipeline, covering success and failure scenarios.
- Validate rate limiting functionality and ensure independent counters for different clients.
- Implement scraper tests to verify HTML content fetching and error handling.
- Add unit tests for various services, including storage and filename generation.
- Establish worker entry point for ARQ to handle background image processing tasks.