Implements comprehensive batch upload system with real-time progress tracking:
Backend Infrastructure:
- Add batch_jobs global dict for batch orchestration
- Add BatchFileInfo and BatchJob TypedDicts to utils/types.py
- Create run_batch_sequential() worker function with thread.join() synchronization
- Modify /upload POST route to detect single vs multi-file uploads
- Add 3 batch API routes: /upload/batch/progress, /status, /result
- Add timestamp_to_date Jinja2 template filter
Frontend:
- Update upload.html with 'multiple' attribute and file counter
- Create upload_batch_progress.html: Real-time dashboard with SSE per file
- Create upload_batch_result.html: Final summary with statistics
Architecture:
- Backward compatible: single-file upload unchanged
- Sequential processing: one file after another (respects API limits)
- N parallel SSE connections: one per file for real-time progress
- Polling mechanism to discover job IDs as files start processing
- 1-hour timeout per file with error handling and continuation
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Modifications:
- flask_app.py:
* Ajout de "docx" dans ALLOWED_EXTENSIONS
* Nouvelle fonction run_word_processing_job() avec:
- Gestion tempfile pour python-docx (besoin d'un path)
- Intégration du callback de progression SSE
- Nettoyage automatique du fichier temporaire
* Modification upload() route:
- Détection du type de fichier (PDF/Word)
- Routage vers le bon processeur (run_processing_job vs run_word_processing_job)
- Messages d'erreur adaptés pour PDF et Word
* Mise à jour des docstrings
- templates/upload.html:
* Titre: "Parser PDF/Word/Markdown" (au lieu de PDF/Markdown)
* Accept attribute: ".pdf,.docx,.md"
* Tooltips: Explique que Word n'a pas besoin d'OCR
* Pipeline de traitement: Section séparée pour PDF vs Word
* Labels mis à jour pour inclure Word
Fonctionnalités:
✅ Upload de fichiers .docx via interface web
✅ Traitement en arrière-plan avec SSE
✅ Pas d'OCR nécessaire pour Word (économie ~0.003€/page)
✅ Réutilisation complète des modules LLM existants
✅ Extraction directe via python-docx
✅ Construction TOC depuis styles Heading 1-9
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>