Selaa lähdekoodia

Reprise du projet agent_docker - refactoring et nouvelles fonctionnalites

Made-with: Cursor
augustin.podvin 8 kuukautta sitten
vanhempi
commit
2b73e1ef86

+ 56 - 0
.dockerignore

@@ -0,0 +1,56 @@
+# Environnement virtuel (plusieurs Go)
+venv/
+.venv/
+env/
+.env
+
+# Git
+.git/
+.gitignore
+
+# Python
+__pycache__/
+*.py[cod]
+*.pyo
+*.pyd
+.Python
+*.egg-info/
+.eggs/
+dist/
+build/
+
+# IDE
+.idea/
+.vscode/
+*.swp
+*.swo
+
+# Données et uploads (pas nécessaires dans l'image)
+uploads/
+src/data/
+*.index
+data/
+
+# Logs et cache
+*.log
+logs/
+.pytest_cache/
+.coverage
+htmlcov/
+
+# Modèles ML et checkpoints (très lourds)
+security_model/
+*.pt
+*.pth
+*.bin
+*.safetensors
+src/utils/results/
+
+# Documentation et tests (optionnel - garder tests si besoin)
+# tests/
+
+# Divers
+.DS_Store
+Thumbs.db
+*.md
+!README.md

+ 26 - 0
.env.example

@@ -0,0 +1,26 @@
+# Copier ce fichier en .env et remplir les valeurs
+# cp .env.example .env
+
+SECRET_KEY=votre-secret-key-changez-en-production
+# PostgreSQL: postgresql://postgres:postgres@localhost:5432/agent
+# SQLite (plus simple): sqlite:///agent.db
+DATABASE_URL=sqlite:///agent.db
+
+FLASK_ENV=production
+OLLAMA_HOST=http://localhost:11434
+
+# API Scaleway (obligatoire pour le QA)
+SCW_API_KEY=
+# Vide = projet par défaut. Sinon: project_id (ex: d7d5949a-c2bb-484a-b973-e05a83510efd)
+SCW_ENDPOINT=
+SCW_MODEL=mistral-small-3.2-24b-instruct-2506
+
+# Wiki Intersel (obligatoire pour le scraping)
+WIKI_USERNAME=
+WIKI_PASSWORD=
+
+# SerpAPI (optionnel, fallback recherche Google)
+SERPAPI_KEY=
+SERPAPI_API_KEY=
+
+UPLOAD_FOLDER=uploads

+ 61 - 0
.gitignore

@@ -0,0 +1,61 @@
+# Environnement
+.env
+.env.local
+.env.*.local
+venv/
+.venv/
+env/
+
+# Python
+__pycache__/
+*.py[cod]
+*$py.class
+*.so
+.Python
+build/
+develop-eggs/
+dist/
+downloads/
+eggs/
+.eggs/
+lib/
+lib64/
+parts/
+sdist/
+var/
+wheels/
+*.egg-info/
+.installed.cfg
+*.egg
+
+# IDE
+.idea/
+.vscode/
+*.swp
+*.swo
+
+# Données et uploads
+uploads/
+agent.db
+src/data/
+*.index
+
+# Logs
+*.log
+logs/
+
+# OS
+.DS_Store
+Thumbs.db
+
+# Tests
+.pytest_cache/
+.coverage
+htmlcov/
+.tox/
+
+# Modèles ML
+security_model/
+*.pt
+*.pth
+*.bin

+ 13 - 4
Dockerfile

@@ -19,17 +19,26 @@ RUN apt-get update && apt-get install -y \
     libgcc-s1 \
     && rm -rf /var/lib/apt/lists/*
 
-# Copier les fichiers de dépendances
-COPY requirements-prod.txt requirements.txt
+# Copier les dépendances
+COPY requirements.txt .
 
-# Installer les dépendances Python
+# Installer PyTorch CPU-only en premier (~500 Mo au lieu de ~2-3 Go CUDA)
+RUN pip install --no-cache-dir torch==2.7.1 torchvision==0.22.1 --index-url https://download.pytorch.org/whl/cpu
+
+# psycopg2-binary en premier (évite la compilation de psycopg2 sur certaines plateformes)
+RUN pip install --no-cache-dir psycopg2-binary==2.9.9
+
+# Installer le reste des dépendances
 RUN pip install --no-cache-dir -r requirements.txt
 
+# Modèle spaCy pour le français (obligatoire pour qa_service)
+RUN python -m spacy download fr_core_news_sm
+
 # Copier le code de l'application
 COPY . .
 
 # Créer les dossiers nécessaires
-RUN mkdir -p uploads data
+RUN mkdir -p uploads data src/data
 
 # Exposer le port
 EXPOSE 5000

+ 161 - 0
GUIDE_DEMARRAGE.md

@@ -0,0 +1,161 @@
+# Guide de démarrage – Reprise du projet Agent Docker
+
+Ce guide vous permet de reprendre ce projet développé par quelqu'un d'autre et de le lancer avec **PostgreSQL**.
+
+---
+
+## Prérequis à installer
+
+### 1. Docker Desktop (obligatoire pour PostgreSQL)
+
+PostgreSQL tourne dans un conteneur Docker. Sans Docker, vous ne pouvez pas lancer la base.
+
+- **Télécharger** : https://www.docker.com/products/docker-desktop/
+- **Installer** puis **redémarrer** le PC
+- Vérifier : ouvrir PowerShell et taper `docker --version`
+
+### 2. Python 3.10 ou 3.11 (recommandé)
+
+- **Télécharger** : https://www.python.org/downloads/
+- À l’installation, cocher **"Add Python to PATH"**
+- Vérifier : `py --version`
+
+---
+
+## Option A : Tout lancer avec Docker (le plus simple)
+
+Tout (app + PostgreSQL + Ollama) tourne dans Docker.
+
+```powershell
+cd "c:\Users\USER\Documents\Intersel - Livinweb\dev\agent_docker_reprise de nadine\agent_docker"
+
+# 1. Créer le fichier .env (s'il n'existe pas)
+copy .env.example .env
+
+# 2. Éditer .env et remplir au minimum :
+#    - WIKI_USERNAME
+#    - WIKI_PASSWORD
+#    - SCW_API_KEY
+
+# 3. Lancer tous les services
+docker-compose up --build
+```
+
+L’application sera sur **http://localhost:5000**.
+
+---
+
+## Option B : Lancer l’app en local + PostgreSQL dans Docker
+
+Utile pour le développement et le debug.
+
+### Étape 1 : Démarrer PostgreSQL
+
+```powershell
+cd "c:\Users\USER\Documents\Intersel - Livinweb\dev\agent_docker_reprise de nadine\agent_docker"
+
+# Lancer uniquement PostgreSQL en arrière-plan
+docker-compose up -d postgres
+```
+
+Vérifier que PostgreSQL tourne :
+
+```powershell
+docker ps
+```
+
+Vous devez voir un conteneur `postgres` avec le port `5432`.
+
+### Étape 2 : Créer l’environnement Python
+
+```powershell
+cd "c:\Users\USER\Documents\Intersel - Livinweb\dev\agent_docker_reprise de nadine\agent_docker"
+
+# Créer le venv
+py -m venv venv
+
+# Activer le venv
+.\venv\Scripts\Activate.ps1
+
+# Installer les dépendances (inclut psycopg2 pour PostgreSQL)
+.\install_local.ps1
+```
+
+Si erreur avec `psycopg2` (souvent sur Python 3.13) :
+
+```powershell
+.\install_local.ps1 -SkipPsycopg
+```
+
+Dans ce cas, l’app utilisera SQLite au lieu de PostgreSQL.
+
+### Étape 3 : Configurer le fichier .env
+
+Le fichier `.env` doit contenir au minimum :
+
+```
+DATABASE_URL=postgresql://postgres:postgres@localhost:5432/agent
+SECRET_KEY=votre-secret-key-changez-en-production
+```
+
+Identifiants PostgreSQL par défaut :
+
+- **Utilisateur** : `postgres`
+- **Mot de passe** : `postgres`
+- **Base** : `agent`
+- **Port** : `5432`
+
+### Étape 4 : Lancer l’application
+
+```powershell
+.\run_local.ps1
+```
+
+L’app sera sur **http://localhost:5000**.
+
+---
+
+## Résumé des commandes utiles
+
+| Action | Commande |
+|--------|----------|
+| Démarrer PostgreSQL seul | `docker-compose up -d postgres` |
+| Arrêter PostgreSQL | `docker-compose stop postgres` |
+| Voir les conteneurs | `docker ps` |
+| Lancer l’app en local | `.\run_local.ps1` |
+| Tout lancer (Docker) | `docker-compose up --build` |
+
+---
+
+## En cas de problème
+
+### "Connection refused" ou erreur de connexion à la base
+
+- Vérifier que PostgreSQL tourne : `docker ps`
+- Si absent : `docker-compose up -d postgres`
+- Attendre 10–15 secondes avant de relancer l’app
+
+### Erreur psycopg2 sur Windows
+
+```powershell
+.\install_local.ps1 -SkipPsycopg
+```
+
+L’app utilisera SQLite (fichier local) au lieu de PostgreSQL.
+
+### Port 5432 déjà utilisé
+
+Une autre instance de PostgreSQL est peut-être installée sur la machine. Vous pouvez :
+
+- Arrêter l’autre PostgreSQL, ou
+- Modifier le port dans `docker-compose.yml` (ex. `5433:5432`)
+
+---
+
+## Structure du projet
+
+- `src/` – Code source de l’application Flask
+- `config.py` – Configuration (base, API, etc.)
+- `.env` – Variables d’environnement (ne pas commiter)
+- `docker-compose.yml` – Définition des services (app, postgres, ollama)
+- `requirements.txt` – Dépendances Python

+ 67 - 25
README.md

@@ -1,38 +1,80 @@
-# Docker
+# Agent Docker - Chatbot QA
 
-Pour pouvoir créer image Docker il faut :
+Application Flask de chatbot avec RAG (Retrieval-Augmented Generation), indexation FAISS et LLM Scaleway.
 
 ## Prérequis
-Il faut :
-- avoir Docker installé sur la machine (https://docs.docker.com/get-docker/)
 
-- le projet doit avoir fichier Dockerfile
+- Docker et Docker Compose (https://docs.docker.com/get-docker/)
+- Fichier `.env` avec les variables nécessaires (voir `.env.example`)
 
-## Construction d'image Docker 
-executer dans le terminal cette commande dans le root :  
+## Lancement avec Docker Compose (recommandé)
+
+```bash
+# 1. Copier le fichier d'environnement
+cp .env.example .env
+# Éditer .env et remplir : WIKI_USERNAME, WIKI_PASSWORD, SCW_API_KEY, SERPAPI_KEY (optionnel)
+
+# 2. Lancer tous les services (app, PostgreSQL)
+docker-compose up --build
+```
+
+L'application sera accessible sur http://localhost:5000
+
+## Lancement en local (sans Docker, pour le debug)
+
+```powershell
+# 1. Créer et activer le venv
+py -m venv venv
+.\venv\Scripts\Activate.ps1
+
+# 2. Installer les dépendances (OBLIGATOIRE - évite ModuleNotFoundError)
+.\install_local.ps1
+# Si erreur psycopg2 (Python 3.13 Windows): .\install_local.ps1 -SkipPsycopg
+# Alternative: pip install -r requirements.txt
+
+# 3. PostgreSQL doit tourner (ex: docker-compose up -d postgres)
+
+# 4. Lancer l'app
+.\run_local.ps1
+```
+
+## Construction d'image Docker seule
+
+```bash
 docker build -t chatbot .
-* chatbot ici c'est le nom du l'image 
+docker run -d --name conteneur -p 5000:5000 -e DATABASE_URL=postgresql://... chatbot
+```
+
+## Indexation initiale (chunks + FAISS)
+
+Au premier démarrage, les fichiers `All_chunks.json` et `faiss_index.index` peuvent être absents. Pour les générer :
+
+```bash
+# Dans un conteneur ou en local avec venv activé
+python -c "
+from src.utils.processing import full_update_pipeline
+full_update_pipeline()
+"
+```
 
-## Lancement du conteneur 
-pour démarrer un conteneur à partir de cette image executer :
-docker run -d --name conteneur -p 5000:5000 chatbot
-=> conteneur ici c'est le nom du conteneur 
+## Tests
 
-Pour : 
-* voir les conteneurs en cours :
-docker ps
+Les dépendances (dont pytest) sont installées dans l'image Docker. Pour lancer les tests :
 
-* arrêter un conteneur :
-docker stop mon-conteneur
+```bash
+docker-compose run --rm app pytest tests/ -v
+```
 
-* supprimer un conteneur :
-docker rm mon-conteneur
+Ou après `docker-compose up` :
 
-* Exporter l’image en fichier tar :
-docker save chatbot > chatbot.tar
+```bash
+docker-compose exec app pytest tests/ -v
+```
 
-* Importer l’image sur l’autre PC :
-docker load < mon-projet.tar
+## Commandes Docker utiles
 
-* Lancer l’image importée sur l’autre PC :
-docker run -d --name conteneur -p 5000:5000 chatbot
+- Voir les conteneurs : `docker ps`
+- Arrêter : `docker stop <nom-conteneur>`
+- Supprimer : `docker rm <nom-conteneur>`
+- Exporter l'image : `docker save chatbot > chatbot.tar`
+- Importer : `docker load < chatbot.tar`

+ 1 - 2
config.py

@@ -34,8 +34,7 @@ class Config:
     
     # Extensions de fichiers autorisées
     ALLOWED_EXTENSIONS = {'txt', 'pdf', 'png', 'jpg', 'jpeg'}
-    
-    SECRET_KEY = os.getenv('SECRET_KEY')
+
     SQLALCHEMY_DATABASE_URI = os.getenv('DATABASE_URL')
     SQLALCHEMY_TRACK_MODIFICATIONS = False
 

+ 27 - 4
docker-compose.yml

@@ -1,5 +1,3 @@
-version: '3.8'
-
 services:
   app:
     build: .
@@ -11,17 +9,25 @@ services:
       - FLASK_HOST=0.0.0.0
       - FLASK_PORT=5000
       - FLASK_APP=src.app
+      - DATABASE_URL=postgresql://postgres:postgres@postgres:5432/agent
+      - SECRET_KEY=${SECRET_KEY:-dev-secret-key-change-in-production}
       - SERPAPI_KEY=${SERPAPI_KEY}
+      - SERPAPI_API_KEY=${SERPAPI_KEY}
       - WIKI_USERNAME=${WIKI_USERNAME}
       - WIKI_PASSWORD=${WIKI_PASSWORD}
+      - SCW_API_KEY=${SCW_API_KEY}
+      - SCW_ENDPOINT=${SCW_ENDPOINT:-d7d5949a-c2bb-484a-b973-e05a83510efd}
+      - SCW_MODEL=${SCW_MODEL:-mistral-small-3.2-24b-instruct-2506}
       - OLLAMA_HOST=http://ollama:11434
       - UPLOAD_FOLDER=uploads
       - MAX_CONTENT_LENGTH=16777216
     volumes:
       - ./uploads:/app/uploads
       - ./data:/app/data
+      - ./src/data:/app/src/data
     depends_on:
-      - ollama
+      postgres:
+        condition: service_healthy
     restart: unless-stopped
     healthcheck:
       test: ["CMD", "curl", "-f", "http://localhost:5000/"]
@@ -29,6 +35,22 @@ services:
       timeout: 10s
       retries: 3
 
+  postgres:
+    image: postgres:15-alpine
+    ports:
+      - "5432:5432"   # Expose pour mode local (app sur Windows)
+    environment:
+      - POSTGRES_USER=postgres
+      - POSTGRES_PASSWORD=postgres
+      - POSTGRES_DB=agent
+    volumes:
+      - postgres_data:/var/lib/postgresql/data
+    healthcheck:
+      test: ["CMD-SHELL", "pg_isready -U postgres"]
+      interval: 5s
+      timeout: 5s
+      retries: 5
+
   ollama:
     image: ollama/ollama:latest
     ports:
@@ -43,4 +65,5 @@ services:
       retries: 3
 
 volumes:
-  ollama_data: 
+  ollama_data:
+  postgres_data:

+ 49 - 0
install_local.ps1

@@ -0,0 +1,49 @@
+# Installation locale Windows - source unique: requirements.txt
+# Overrides Windows: psycopg2 (wheel), python-magic-bin, post-install (spacy, nltk)
+
+param(
+    [switch]$SkipVenv,
+    [switch]$SkipPsycopg
+)
+
+$ErrorActionPreference = "Stop"
+Set-Location $PSScriptRoot
+
+if (-not $SkipVenv) {
+    Write-Host "Activation du venv..." -ForegroundColor Cyan
+    & .\venv\Scripts\Activate.ps1
+}
+
+# 1. psycopg2 (Windows: wheel obligatoire pour Python 3.13)
+if (-not $SkipPsycopg) {
+    Write-Host "`n1. psycopg2-binary (wheel Windows)..." -ForegroundColor Cyan
+    pip install "psycopg2-binary>=2.9.9" --only-binary :all:
+    if ($LASTEXITCODE -ne 0) {
+        Write-Host "   Pas de wheel. Utilisez: .\install_local.ps1 -SkipPsycopg (SQLite)" -ForegroundColor Red
+        exit 1
+    }
+}
+
+# 2. Dépendances (filtrer psycopg2 si -SkipPsycopg)
+Write-Host "`n2. Installation de requirements.txt..." -ForegroundColor Cyan
+if ($SkipPsycopg) {
+    $filtered = Get-Content requirements.txt | Where-Object { $_ -notmatch 'psycopg2' }
+    $temp = [System.IO.Path]::GetTempFileName()
+    $filtered | Set-Content $temp
+    pip install -r $temp
+    Remove-Item $temp
+} else {
+    pip install -r requirements.txt
+}
+
+# 3. Override Windows: python-magic-bin (remplace python-magic qui nécessite libmagic système)
+Write-Host "`n3. python-magic-bin (Windows)..." -ForegroundColor Cyan
+pip uninstall python-magic -y 2>$null
+pip install python-magic-bin
+
+# 4. Post-install: spaCy + NLTK
+Write-Host "`n4. Modèle spaCy + NLTK..." -ForegroundColor Cyan
+python -m spacy download fr_core_news_sm
+python -c "import nltk; nltk.download('punkt')"
+
+Write-Host "`nTerminé. Lancez: .\run_local.ps1" -ForegroundColor Green

+ 0 - 61
requirements-prod.txt

@@ -1,61 +0,0 @@
-# Web + Environnement
-Flask==3.1.1
-python-dotenv==1.1.1
-Werkzeug==3.1.3
-itsdangerous==2.2.0
-Jinja2==3.1.6
-
-# OCR
-doctr==1.9.0
-python-doctr==1.0.0
-torch==2.7.1
-torchvision==0.22.1
-onnx==1.18.0
-opencv-python==4.12.0.88
-pillow==11.3.0
-shapely==2.1.1
-pyclipper==1.3.0.post6
-
-# Langchain & LLM
-langchain==0.3.27
-langchain-community==0.3.27
-langchain-core==0.3.72
-langchain-ollama==0.3.6
-langchain-text-splitters==0.3.9
-sentence-transformers==5.0.0
-transformers==4.54.1
-tiktoken==0.9.0
-faiss-cpu==1.11.0.post1
-ollama==0.5.1
-
-# Autres outils utiles
-requests==2.32.4
-pandas==2.3.1
-numpy==2.2.6
-scikit-learn==1.7.1
-scipy==1.16.0
-regex==2024.11.6
-markdown-it-py==3.0.0
-loguru==0.7.3
-tabulate==0.9.0
-beautifulsoup4==4.13.4
-
-# Scheduler
-APScheduler==3.11.0
-
-# Config / typing
-attrs==25.3.0
-typing_extensions==4.14.1
-pydantic==2.11.7
-pydantic-settings==2.10.1
-
-
-gunicorn==23.0.0
-nltk==3.9.1
-einops==0.8.1
-openai==1.98.0
-azure-core==1.35.0
-psycopg2-binary==2.9.9
-Flask-SQLAlchemy==3.1.1
-SQLAlchemy==2.0.38
-Flask-Limiter==3.12

+ 58 - 447
requirements.txt

@@ -1,456 +1,67 @@
-absl-py==2.1.0
-accelerate==1.6.0
-aiocache==0.12.3
-aiofiles==24.1.0
-aiohappyeyeballs==2.6.1
-aiohttp==3.11.11
-aiosignal==1.3.2
-aiosqlite==0.21.0
-alembic==1.14.0
-altair==5.5.0
-annotated-types==0.7.0
-anthropic==0.60.0
-antlr4-python3-runtime==4.9.3
-anyascii==0.3.3
-anyio==4.9.0
-appdirs==1.4.4
-APScheduler==3.10.4
-argon2-cffi==23.1.0
-argon2-cffi-bindings==25.1.0
-asgiref==3.8.1
-asttokens==2.4.1
-astunparse==1.6.3
-async-timeout==5.0.1
-asyncpg==0.30.0
-attrs==25.3.0
-Authlib==1.4.1
-av==15.0.0
-azure-ai-documentintelligence==1.0.2
-azure-core==1.35.0
-azure-identity==1.20.0
-azure-storage-blob==12.24.1
-backoff==2.2.1
-bcrypt==4.3.0
-beautifulsoup4==4.13.4
-bidict==0.23.1
-bitarray==3.6.0
-bitsandbytes==0.46.0
-bitsandbytes-cuda117==0.26.0.post2
-black==25.1.0
-blinker==1.8.2
-blis==1.3.0
-boto3==1.35.53
-botocore==1.35.99
-Brotli==1.1.0
-build==1.2.2.post1
-cachetools==5.5.2
-catalogue==2.0.10
-certifi==2025.8.3
-cffi==1.17.1
-chardet==5.2.0
-charset-normalizer==3.3.2
-chroma-hnswlib==0.7.6
-chromadb==0.6.3
-click==8.2.1
-cloudpathlib==0.21.1
-colbert-ai==0.2.21
-colorama==0.4.6
-coloredlogs==15.0.1
-comm==0.2.2
-confection==0.1.5
-contourpy==1.3.0
-cryptography==44.0.3
-cssselect2==0.8.0
-ctranslate2==4.6.0
-cycler==0.12.1
-cymem==2.0.11
-Cython==3.0.11
-dataclasses-json==0.6.7
-datasets==4.0.0
-ddgs==9.0.0
-decorator==5.1.1
-deep-translator==1.11.4
-defusedxml==0.7.1
-Deprecated==1.2.18
-diffusers==0.34.0
-dill==0.3.8
-diskcache==5.6.3
-distro==1.9.0
-dnspython==2.7.0
-docker==7.1.0
-docx2txt==0.8
-durationpy==0.9
-easyocr==1.7.2
-ecdsa==0.19.1
-effdet==0.4.1
-einops==0.8.1
-elastic-transport==8.17.1
-elasticsearch==9.0.1
-emoji==2.14.1
-et_xmlfile==2.0.0
-eval_type_backport==0.2.2
-Events==0.5
-executing==2.1.0
-faiss-cpu==1.11.0
-fake-useragent==2.1.0
-fastapi==0.115.7
-faster-whisper==1.1.1
-ffmpy==0.5.0
-filelock==3.16.1
-filetype==1.2.0
-fire==0.7.0
-firecrawl-py==1.12.0
-Flask==3.0.3
-flask-cors==6.0.1
-Flask-Login==0.6.3
-Flask-SQLAlchemy==3.1.1
-flatbuffers==24.3.25
-fonttools==4.54.1
-fpdf==1.7.2
-fpdf2==2.8.2
-fr_core_news_sm @ https://github.com/explosion/spacy-models/releases/download/fr_core_news_sm-3.8.0/fr_core_news_sm-3.8.0-py3-none-any.whl#sha256=7d6ad14cd5078e53147bfbf70fb9d433c6a3865b695fda2657140bbc59a27e29
-frozenlist==1.6.0
-fs==2.4.16
-fsspec==2024.10.0
-ftfy==6.2.3
-gast==0.5.4
-gcp-storage-emulator==2024.8.3
-git-python==1.0.3
-gitdb==4.0.12
-GitPython==3.1.44
-google-ai-generativelanguage==0.6.15
-google-api-core==2.24.2
-google-api-python-client==2.177.0
-google-auth==2.40.1
-google-auth-httplib2==0.2.0
-google-auth-oauthlib==1.2.2
-google-cloud-core==2.4.3
-google-cloud-storage==2.19.0
-google-cloud-vision==3.10.1
-google-crc32c==1.7.1
-google-genai==1.15.0
-google-generativeai==0.8.5
-google-pasta==0.2.0
-google-resumable-media==2.7.2
-google_search_results==2.4.2
-googleapis-common-protos==1.63.2
-gradio==5.29.0
-gradio_client==1.10.0
-greenlet==3.1.1
-groovy==0.1.2
-grpcio==1.67.1
-grpcio-status==1.67.1
-gunicorn==23.0.0
-h11==0.16.0
-h2==4.2.0
-h5py==3.11.0
-hf-xet==1.1.5
-hpack==4.1.0
-html5lib==1.1
-httpcore==1.0.9
-httplib2==0.22.0
-httptools==0.6.4
-httpx==0.28.1
-httpx-sse==0.4.0
-huggingface-hub==0.34.3
-humanfriendly==10.0
-hyperframe==6.1.0
-ibm-cloud-sdk-core==3.23.0
-ibm-watson==9.0.0
-idna==3.7
-imageio==2.37.0
-importlib_metadata==8.6.1
-importlib_resources==6.5.2
-iniconfig==2.1.0
-ipython==8.29.0
-ipywidgets==8.1.7
-isodate==0.7.2
+# =============================================================================
+# Dépendances - Docker ET local (une seule source)
+# =============================================================================
+
+# Web + Environnement
+Flask==3.1.1
+python-dotenv==1.1.1
+flask-cors==4.0.0
+Werkzeug==3.1.3
 itsdangerous==2.2.0
-jedi==0.19.1
 Jinja2==3.1.6
-jiter==0.9.0
-jmespath==1.0.1
-joblib==1.5.0
-jsonlines==4.0.0
-jsonpatch==1.33
-jsonpointer==3.0.0
-jsonschema==4.23.0
-jsonschema-specifications==2025.4.1
-jupyterlab_widgets==3.0.15
-keras==3.8.0
-kiwisolver==1.4.7
-kubernetes==32.0.1
-langchain==0.3.26
-langchain-community==0.3.26
+
+# OCR (torch/torchvision installés en CPU dans le Dockerfile)
+python-doctr>=1.0.0
+onnx==1.18.0
+opencv-python-headless==4.12.0.88
+pillow==11.3.0
+shapely==2.1.1
+pyclipper==1.3.0.post6
+
+# Langchain & LLM
+langchain==0.3.27
+langchain-community==0.3.27
 langchain-core==0.3.72
 langchain-huggingface==0.3.1
-langchain-ollama==0.3.3
 langchain-text-splitters==0.3.9
-langcodes==3.5.0
-langdetect==1.0.9
-langfuse==2.44.0
-langsmith==0.4.4
-language_data==1.3.0
-lazy_loader==0.4
-ldap3==2.9.1
-libclang==18.1.1
-llama_api_client==0.1.2
-llama_cpp_python==0.3.14
-llama_stack==0.2.16
-llama_stack_client==0.2.16
-loguru==0.7.3
-lxml==5.4.0
-Mako==1.3.10
-marisa-trie==1.2.1
-Markdown==3.7
+sentence-transformers==5.0.0
+transformers==4.54.1
+tiktoken==0.9.0
+faiss-cpu==1.11.0.post1
+
+# Utilitaires
+requests==2.32.4
+httpx==0.28.1
+google-search-results==2.4.2
+rank-bm25==0.2.2
+spacy==3.8.7
+python-magic==0.4.27
+huggingface-hub>=0.23.0
+pandas==2.3.1
+numpy==2.2.6
+scikit-learn==1.7.1
+scipy==1.16.0
+regex==2024.11.6
 markdown-it-py==3.0.0
-MarkupSafe==2.1.5
-marshmallow==3.26.1
-matplotlib==3.9.2
-matplotlib-inline==0.1.7
-mdurl==0.1.2
-Mesa==3.0.3
-ml-dtypes==0.4.1
-mmh3==5.1.0
-moto==5.1.9
-mplcursors==0.6
-mpmath==1.3.0
-msal==1.33.0
-msal-extensions==1.3.1
-multidict==6.4.3
-multiprocess==0.70.16
-murmurhash==1.0.13
-mypy_extensions==1.1.0
-mysqlclient==2.2.4
-namex==0.0.8
-narwhals==1.38.2
-nest-asyncio==1.6.0
-networkx==3.4.2
-ninja==1.11.1.4
+tabulate==0.9.0
+beautifulsoup4==4.13.4
+
+# Scheduler
+APScheduler==3.11.0
+
+# Tests
+pytest>=8.0.0
+
+# Config
+attrs==25.3.0
+typing_extensions==4.14.1
+pydantic==2.11.7
+pydantic-settings==2.10.1
+
+gunicorn==23.0.0
 nltk==3.9.1
-nomic==3.5.3
-numpy==1.26.4
-oauthlib==3.2.2
-olefile==0.47
-ollama==0.4.8
-omegaconf==2.3.0
-onnx==1.17.0
-onnxruntime==1.20.1
-open-webui==0.6.18
+einops==0.8.1
 openai==1.98.0
-opencv-python==4.9.0.80
-opencv-python-headless==4.11.0.86
-openpyxl==3.1.5
-opensearch-py==2.8.0
-opentelemetry-api==1.33.1
-opentelemetry-exporter-otlp-proto-common==1.33.0
-opentelemetry-exporter-otlp-proto-grpc==1.33.0
-opentelemetry-exporter-otlp-proto-http==1.36.0
-opentelemetry-instrumentation==0.54b1
-opentelemetry-instrumentation-asgi==0.54b1
-opentelemetry-instrumentation-fastapi==0.54b1
-opentelemetry-proto==1.33.0
-opentelemetry-sdk==1.33.1
-opentelemetry-semantic-conventions==0.54b1
-opentelemetry-util-http==0.54b1
-opt-einsum==3.3.0
-optimum-quanto==0.2.7
-optree==0.11.0
-orjson==3.10.18
-overrides==7.7.0
-packaging==23.2
-pandas==2.2.3
-parso==0.8.4
-passlib==1.7.4
-pathspec==0.12.1
-pdf2image==1.17.0
-pdfminer.six==20250327
-pdfplumber==0.11.6
-peewee==3.18.1
-peewee-migrate==1.12.2
-pgvector==0.4.0
-pi_heif==0.22.0
-pikepdf==9.7.0
-pillow==11.2.1
-pinecone==6.0.2
-pinecone-plugin-interface==0.0.7
-platformdirs==4.3.8
-playwright==1.49.1
-pluggy==1.6.0
-portalocker==2.10.1
-posthog==5.4.0
-preshed==3.0.10
-primp==0.15.0
-prompt_toolkit==3.0.48
-propcache==0.3.1
-proto-plus==1.26.1
-protobuf==5.29.4
-psutil==7.0.0
-psycopg2-binary==2.9.9
-pure_eval==0.2.3
-py-partiql-parser==0.6.1
-pyaml==25.7.0
-pyarrow==20.0.0
-pyasn1==0.4.8
-pyasn1_modules==0.4.1
-pyclipper==1.3.0.post6
-pycocotools==2.0.8
-pycparser==2.22
-pycrdt==0.12.25
-pydantic==2.11.7
-pydantic-settings==2.9.1
-pydantic_core==2.33.2
-pydeck==0.9.1
-pydub==0.25.1
-pydyf==0.11.0
-pyee==12.0.0
-pygame==2.6.1
-Pygments==2.18.0
-PyJWT==2.10.1
-pymdown-extensions==10.14.2
-pymilvus==2.5.0
-pymongo==4.13.2
-PyMuPDF==1.25.5
-PyMySQL==1.1.1
-pypandoc==1.15
-pyparsing==3.2.0
-pypdf==4.3.1
-PyPDF2==3.0.1
-pypdfium2==4.30.1
-pyphen==0.17.2
-PyPika==0.48.9
-pyproject_hooks==1.2.0
-pyreadline3==3.5.4
-pytesseract==0.3.10
-pytest==8.3.5
-pytest-docker==3.1.2
-python-bidi==0.6.6
-python-dateutil==2.9.0.post0
--e git+https://github.com/mindee/doctr.git@849d19566b03cd37c8a831ae02673a1c2f265399#egg=python_doctr
-python-docx==1.1.2
-python-dotenv==1.1.0
-python-engineio==4.12.2
-python-iso639==2025.2.18
-python-jose==3.4.0
-python-magic==0.4.27
-python-magic-bin==0.4.14
-python-multipart==0.0.20
-python-oxmsg==0.0.2
-python-pptx==1.0.2
-python-socketio==5.13.0
-pytube==15.0.0
-pytz==2024.1
-pywin32==311
-pyxlsb==1.0.10
-PyYAML==6.0.2
-qdrant-client==1.14.3
-rank-bm25==0.2.2
-RapidFuzz==3.13.0
-rapidocr-onnxruntime==1.4.4
-redis==6.2.0
-referencing==0.36.2
-regex==2024.11.6
-requests==2.32.4
-requests-oauthlib==2.0.0
-requests-toolbelt==1.0.0
-responses==0.25.7
-RestrictedPython==8.0
-rich==13.7.1
-rpds-py==0.24.0
-rsa==4.9.1
-ruff==0.11.8
-s3transfer==0.10.4
-safehttpx==0.1.6
-safetensors==0.5.3
-scikit-image==0.25.2
-scikit-learn==1.6.1
-scipy==1.15.3
-semantic-version==2.10.0
-sentence-transformers==4.1.0
-sentencepiece==0.2.0
-serpapi==0.1.5
-setuptools==75.8.0
-shapely==2.1.1
-shellingham==1.5.4
-simple-websocket==1.1.0
-six==1.16.0
-smart_open==7.3.0.post1
-smmap==5.0.2
-sniffio==1.3.1
-socksio==1.0.0
-soundfile==0.13.1
-soupsieve==2.7
-spacy==3.8.7
-spacy-legacy==3.0.12
-spacy-loggers==1.0.5
+psycopg2-binary>=2.9.9
+Flask-SQLAlchemy==3.1.1
 SQLAlchemy==2.0.38
-srsly==2.5.1
-stack-data==0.6.3
-starlette==0.45.3
-starlette-compress==1.6.0
-streamlit==1.47.0
-sumolib==1.21.0
-sympy==1.14.0
-tabulate==0.9.0
-tenacity==9.1.2
-tencentcloud-sdk-python==3.0.1336
-tensorboard==2.18.0
-tensorboard-data-server==0.7.2
-termcolor==2.4.0
-thinc==8.3.6
-threadpoolctl==3.6.0
-tifffile==2025.6.11
-tiktoken==0.9.0
-timm==1.0.15
-tinycss2==1.4.0
-tinyhtml5==2.0.0
-tokenizers==0.21.1
-toml==0.10.2
-tomlkit==0.13.2
-torch==2.7.1+cu118
-torchaudio==2.7.1+cu118
-torchvision==0.22.1+cu118
-tornado==6.4.2
-tqdm==4.67.0
-traci==1.21.0
-traitlets==5.14.3
-transformers==4.51.3
-typer==0.15.3
-typing-inspect==0.9.0
-typing-inspection==0.4.0
-typing_extensions==4.13.2
-tzdata==2024.1
-tzlocal==5.3.1
-ujson==5.10.0
-unstructured==0.16.17
-unstructured-client==0.34.0
-unstructured-inference==0.8.10
-unstructured.pytesseract==0.3.15
-uritemplate==4.2.0
-urllib3==2.5.0
-uvicorn==0.34.2
-validators==0.35.0
-wasabi==1.1.3
-watchdog==6.0.0
-watchfiles==1.0.5
-wcwidth==0.2.13
-weasel==0.4.1
-weasyprint==65.1
-webencodings==0.5.1
-websocket-client==1.8.0
-websockets==15.0.1
-Werkzeug==3.0.3
-wheel==0.45.1
-widgetsnbextension==4.0.14
-win32_setctime==1.2.0
-wrapt==1.16.0
-wsproto==1.2.0
-xlrd==2.0.1
-XlsxWriter==3.2.3
-xmltodict==0.14.2
-xxhash==3.5.0
-yarl==1.20.0
-youtube-transcript-api==1.1.0
-zipp==3.21.0
-zopfli==0.2.3.post1
-zstandard==0.23.0

+ 16 - 0
run_local.ps1

@@ -0,0 +1,16 @@
+# Script pour lancer l'app en local (sans Docker)
+# Usage: .\run_local.ps1
+
+# Activer le venv
+& .\venv\Scripts\Activate.ps1
+
+# S'assurer d'être dans le bon répertoire
+Set-Location $PSScriptRoot
+
+# Variables pour Flask
+$env:FLASK_APP = "src.app"
+$env:FLASK_DEBUG = "1"
+$env:PYTHONPATH = $PWD
+
+# Lancer l'app
+python src/app.py

+ 63 - 0
setup_venv.ps1

@@ -0,0 +1,63 @@
+# =============================================================================
+# Script tout-en-un : créer venv + installer requirements.txt
+# Usage: .\setup_venv.ps1
+# Si erreur psycopg2 (Python 3.13 Windows): .\setup_venv.ps1 -SkipPsycopg
+# =============================================================================
+
+param(
+    [switch]$SkipPsycopg
+)
+
+$ErrorActionPreference = "Stop"
+Set-Location $PSScriptRoot
+
+# 1. Créer le venv s'il n'existe pas
+if (-not (Test-Path "venv\Scripts\Activate.ps1")) {
+    Write-Host "Création du venv..." -ForegroundColor Cyan
+    py -m venv venv
+    if ($LASTEXITCODE -ne 0) {
+        Write-Host "Erreur: Python non trouvé. Utilisez 'py' ou 'python3'." -ForegroundColor Red
+        exit 1
+    }
+} else {
+    Write-Host "Le venv existe déjà." -ForegroundColor Gray
+}
+
+# 2. Activer le venv
+Write-Host "`nActivation du venv..." -ForegroundColor Cyan
+& .\venv\Scripts\Activate.ps1
+
+# 3. psycopg2 (Windows: wheel obligatoire pour Python 3.13)
+if (-not $SkipPsycopg) {
+    Write-Host "`n1. psycopg2-binary (wheel Windows)..." -ForegroundColor Cyan
+    pip install "psycopg2-binary>=2.9.9" --only-binary :all:
+    if ($LASTEXITCODE -ne 0) {
+        Write-Host "   Pas de wheel. Relancez avec: .\setup_venv.ps1 -SkipPsycopg (SQLite)" -ForegroundColor Yellow
+        $SkipPsycopg = $true
+    }
+}
+
+# 4. Dépendances du requirements.txt
+Write-Host "`n2. Installation de requirements.txt..." -ForegroundColor Cyan
+if ($SkipPsycopg) {
+    $filtered = Get-Content requirements.txt | Where-Object { $_ -notmatch 'psycopg2' }
+    $temp = [System.IO.Path]::GetTempFileName()
+    $filtered | Set-Content $temp
+    pip install -r $temp
+    Remove-Item $temp
+} else {
+    pip install -r requirements.txt
+}
+
+# 5. Override Windows: python-magic-bin
+Write-Host "`n3. python-magic-bin (Windows)..." -ForegroundColor Cyan
+pip uninstall python-magic -y 2>$null
+pip install python-magic-bin
+
+# 6. Post-install: spaCy + NLTK
+Write-Host "`n4. Modèle spaCy + NLTK..." -ForegroundColor Cyan
+python -m spacy download fr_core_news_sm
+python -c "import nltk; nltk.download('punkt')"
+
+Write-Host "`n=== Installation terminée ===" -ForegroundColor Green
+Write-Host "Pour lancer l'app: .\run_local.ps1" -ForegroundColor Green

+ 0 - 1
src/api/qa_routes.py

@@ -5,7 +5,6 @@ import time
 import hashlib
 import re
 import logging
-import redis
 import json
 import os
 

+ 17 - 4
src/api/routes.py

@@ -6,12 +6,19 @@ main = Blueprint('main', __name__)
 
 @main.route('/save_chat', methods=['POST'])
 def save_chat():
-    user_id = request.headers.get("Authorization")  # tu peux changer la méthode d'auth si besoin
+    auth_header = request.headers.get("Authorization")
     data = request.json
 
-    if not user_id:
+    if not auth_header:
         return jsonify({"message": "User ID manquant"}), 400
 
+    # Support "Bearer <id>" ou juste "<id>"
+    user_id_str = auth_header.replace("Bearer ", "").strip()
+    try:
+        user_id = int(user_id_str)
+    except ValueError:
+        return jsonify({"message": "User ID invalide"}), 400
+
     chat = Chat(
         label=data.get('label'),
         messages=data.get('messages', []),
@@ -24,10 +31,16 @@ def save_chat():
 
 @main.route('/user_chats', methods=['GET'])
 def user_chats():
-    user_id = request.headers.get("Authorization")
-    if not user_id:
+    auth_header = request.headers.get("Authorization")
+    if not auth_header:
         return jsonify({"message": "User ID manquant"}), 400
 
+    user_id_str = auth_header.replace("Bearer ", "").strip()
+    try:
+        user_id = int(user_id_str)
+    except ValueError:
+        return jsonify({"message": "User ID invalide"}), 400
+
     chats = Chat.query.filter_by(user_id=user_id).all()
 
     result = [

+ 4 - 3
src/app.py

@@ -4,8 +4,6 @@ from flask import Flask, jsonify, render_template, request, abort
 from apscheduler.schedulers.background import BackgroundScheduler
 import logging
 from flask_cors import CORS
-from flask_limiter import Limiter
-from flask_limiter.util import get_remote_address
 import os
 
 from src.service.memory_service import init_memory
@@ -34,7 +32,6 @@ def create_app():
     app.config["MAX_CONTENT_LENGTH"] = 16 * 1024 * 1024  # 16 MB max payload
     app.config["UPLOAD_FOLDER"] = "uploads"
     app.config["CHAT_MAX_CHARS"] = 2000
-    app.config["SIMPLE_MAX_PER_MINUTE"] = 60
     app.config.from_object('config.Config')
 
 
@@ -46,6 +43,10 @@ def create_app():
     # Initialize DB
     db.init_app(app)
 
+    # Créer les tables si elles n'existent pas
+    with app.app_context():
+        db.create_all()
+
     # Register blueprints
     app.register_blueprint(qa_blueprint)
     app.register_blueprint(file_blueprint, url_prefix="/api")

+ 4 - 3
src/models/models.py

@@ -7,12 +7,13 @@ class Chat(db.Model):
 
     id = db.Column(db.Integer, primary_key=True)
     user_id = db.Column(db.Integer, db.ForeignKey('user.id'), nullable=False)
-    message = db.Column(db.Text, nullable=False)
-    timestamp = db.Column(db.DateTime, default=datetime.utcnow)
+    label = db.Column(db.String(200), nullable=True)
+    messages = db.Column(db.JSON, nullable=False, default=list)  # Liste de messages
 
-def __repr__(self):
+    def __repr__(self):
         return f'<Chat {self.id} by User {self.user_id}>'
 
+
 class User(db.Model):
     __tablename__ = 'user'   
 

+ 8 - 2
src/service/embedding_service.py

@@ -66,8 +66,14 @@ def hybrid_search(
     multi_vector: bool = True
 ) -> List[Tuple[str, int, float]]:
 
-    chunk_texts = state["all_chunks"]
-    faiss_index = state["index"]
+    chunk_texts = state.get("all_chunks", [])
+    faiss_index = state.get("index")
+
+    # Pas de chunks ou d'index → retour vide (premier démarrage avant pipeline)
+    if not chunk_texts or faiss_index is None:
+        logger.warning("Aucun chunk ou index FAISS chargé. Exécutez le pipeline d'indexation.")
+        return []
+
     embedding_model = state["embedding_model"]
     cross_encoder = state["cross_encoder"]
 

+ 1 - 1
src/service/file_service.py

@@ -9,7 +9,7 @@ from werkzeug.utils import secure_filename
 from flask import jsonify, current_app
 from sklearn.metrics.pairwise import cosine_similarity
 from transformers import AutoTokenizer
-from langchain.embeddings import HuggingFaceEmbeddings
+from langchain_community.embeddings import HuggingFaceEmbeddings
 from .state import state
 
 from src.utils.ocr import run_ocr, generate_word_level_html

+ 1 - 1
src/service/memory_service.py

@@ -4,7 +4,7 @@ import os
 import faiss
 import traceback
 from datetime import datetime
-from langchain.embeddings import HuggingFaceEmbeddings
+from langchain_community.embeddings import HuggingFaceEmbeddings
 from typing import List
 from .state import state
 

+ 48 - 37
src/service/qa_service.py

@@ -7,8 +7,6 @@ import time
 from datetime import datetime
 from typing import List, Dict, Any, Tuple, Optional
 
-import httpx
-import redis
 import numpy as np
 from dotenv import load_dotenv
 from serpapi import GoogleSearch
@@ -19,7 +17,6 @@ from sklearn.metrics.pairwise import cosine_similarity
 
 from src.service.embedding_service import hybrid_search
 from src.service.memory_service import retrieve_relevant_memory, save_memory_entry
-from src.utils.security import load_security_model
 from .state import state
 
 
@@ -33,10 +30,19 @@ load_dotenv(override=True)
 
 
 # Initialize Scaleway OpenAI client
+# SCW_ENDPOINT: vide ou "default" = https://api.scaleway.ai/v1 (projet par défaut)
+# Sinon: https://api.scaleway.ai/{project_id}/v1
 SCW_API_KEY = os.getenv("SCW_API_KEY")
+SCW_ENDPOINT = os.getenv("SCW_ENDPOINT", "").strip()
+SCW_MODEL = os.getenv("SCW_MODEL", "mistral-small-3.2-24b-instruct-2506")
+SCW_BASE_URL = (
+    "https://api.scaleway.ai/v1"
+    if not SCW_ENDPOINT or SCW_ENDPOINT.lower() == "default"
+    else f"https://api.scaleway.ai/{SCW_ENDPOINT}/v1"
+)
 if not SCW_API_KEY:
     logger.error("❌ SCW_API_KEY is missing in environment variables.")
-client = OpenAI(api_key=SCW_API_KEY, base_url="https://api.scaleway.ai/v1") if SCW_API_KEY else None
+scw_client = OpenAI(api_key=SCW_API_KEY, base_url=SCW_BASE_URL) if SCW_API_KEY else None
 
 
 # --- Topic detection ---
@@ -90,50 +96,55 @@ def quote_keywords(question: str) -> str:
             result.append(token.text)
     return " ".join(result)
 
-# --- Scaleway Llama3 call ---
+# --- Scaleway LLM call (Mistral via OpenAI-compatible API) ---
 def call_scaleway_llama3(
     prompt: str,
-    model: str = "llama-3.3-70b-instruct",
-    temperature: float = 0.5,
-    top_p: float = 0.95,
-    max_tokens: int = 800,
+    model: Optional[str] = None,
+    temperature: float = 0.15,
+    top_p: float = 1.0,
+    max_tokens: int = 512,
+    presence_penalty: float = 0.0,
     timeout: float = 40.0,
     retries: int = 2,
 ) -> str:
-    if not SCW_API_KEY:
+    """Appelle le LLM Scaleway (Mistral) via l'API OpenAI-compatible."""
+    if not scw_client:
         logger.error("SCW_API_KEY is not set; cannot call Scaleway API.")
         return "Erreur : clé API Scaleway manquante."
 
-    url = "https://api.scaleway.ai/v1/chat/completions"
-    headers = {"Authorization": f"Bearer {SCW_API_KEY}"}
-    payload = {
-        "model": model,
-        "messages": [{"role": "user", "content": prompt}],
-        "temperature": temperature,
-        "top_p": top_p,
-        "max_tokens": max_tokens,
-        "presence_penalty": 0.3,
-        "frequency_penalty": 0.2,
-    }
+    model = model or SCW_MODEL
 
     for attempt in range(1, retries + 1):
         try:
-            with httpx.Client(timeout=timeout) as client:
-                response = client.post(url, headers=headers, json=payload)
-                response.raise_for_status()
-                data = response.json()
-                content = data.get("choices", [{}])[0].get("message", {}).get("content")
-                if content:
-                    return content
-                else:
-                    logger.warning("Scaleway API returned no content.")
-                    return "Erreur : Réponse vide du modèle."
-        except httpx.TimeoutException:
-            logger.warning(f"Timeout during Scaleway API call (attempt {attempt}/{retries})")
-            if attempt == retries:
-                return "Erreur : Timeout lors de l'appel au modèle."
-        except Exception:
-            logger.exception("Exception during Scaleway API call")
+            response = scw_client.chat.completions.create(
+                model=model,
+                messages=[
+                    {"role": "system", "content": "Tu es un assistant documentaire. Réponds de manière factuelle en français."},
+                    {"role": "user", "content": prompt},
+                ],
+                max_tokens=max_tokens,
+                temperature=temperature,
+                top_p=top_p,
+                presence_penalty=presence_penalty,
+                stream=False,
+            )
+            content = response.choices[0].message.content if response.choices else None
+            if content:
+                return content
+            logger.warning("Scaleway API returned no content.")
+            return "Erreur : Réponse vide du modèle."
+        except Exception as e:
+            err_msg = str(e)
+            if "403" in err_msg or "forbidden" in err_msg.lower():
+                logger.error(
+                    "403 Forbidden: Vérifiez que SCW_API_KEY a les droits IAM pour l'API AI, "
+                    "et que SCW_ENDPOINT (project_id) correspond à votre projet. "
+                    "Essayez SCW_ENDPOINT= (vide) pour utiliser le projet par défaut."
+                )
+            elif "timeout" in err_msg.lower() or "timed out" in err_msg.lower():
+                logger.warning(f"Timeout during Scaleway API call (attempt {attempt}/{retries})")
+            else:
+                logger.exception("Exception during Scaleway API call")
             if attempt == retries:
                 return "Erreur : Impossible d'obtenir une réponse du modèle."
     return "Erreur inconnue lors de l'appel au modèle."

+ 13 - 8
src/service/state.py

@@ -1,4 +1,4 @@
-from langchain.embeddings import HuggingFaceEmbeddings
+from langchain_community.embeddings import HuggingFaceEmbeddings
 import os
 import json
 from dotenv import load_dotenv
@@ -10,23 +10,28 @@ load_dotenv(override=True)
 def load_chunks_and_index():
     base_dir = os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))  # src/
     data_dir = os.path.join(base_dir, 'data')
-    
+    os.makedirs(data_dir, exist_ok=True)
+
     chunk_path = os.path.join(data_dir, "All_chunks.json")
     index_path = os.path.join(data_dir, "faiss_index.index")
     if not os.path.exists(chunk_path) or not os.path.exists(index_path):
-        print("❌ Fichiers FAISS ou chunks manquants.")
+        print("⚠️ Fichiers FAISS ou chunks manquants. Le pipeline d'indexation les créera au premier run.")
         return [], None
 
-    with open(chunk_path, "r", encoding="utf-8") as f:
-        chunks = json.load(f)
-
-    index = faiss.read_index(index_path)
-    return chunks, index
+    try:
+        with open(chunk_path, "r", encoding="utf-8") as f:
+            chunks = json.load(f)
+        index = faiss.read_index(index_path)
+        return chunks, index
+    except Exception as e:
+        print(f"⚠️ Erreur chargement chunks/index: {e}")
+        return [], None
 
 
 def get_embedding_function():
     return HuggingFaceEmbeddings(model_name="all-mpnet-base-v2")
 
+
 chunks, index = load_chunks_and_index()
 
 state = {

+ 0 - 456
src/utils/requirements.txt

@@ -1,456 +0,0 @@
-absl-py==2.1.0
-accelerate==1.6.0
-aiocache==0.12.3
-aiofiles==24.1.0
-aiohappyeyeballs==2.6.1
-aiohttp==3.11.11
-aiosignal==1.3.2
-aiosqlite==0.21.0
-alembic==1.14.0
-altair==5.5.0
-annotated-types==0.7.0
-anthropic==0.60.0
-antlr4-python3-runtime==4.9.3
-anyascii==0.3.3
-anyio==4.9.0
-appdirs==1.4.4
-APScheduler==3.10.4
-argon2-cffi==23.1.0
-argon2-cffi-bindings==25.1.0
-asgiref==3.8.1
-asttokens==2.4.1
-astunparse==1.6.3
-async-timeout==5.0.1
-asyncpg==0.30.0
-attrs==25.3.0
-Authlib==1.4.1
-av==15.0.0
-azure-ai-documentintelligence==1.0.2
-azure-core==1.35.0
-azure-identity==1.20.0
-azure-storage-blob==12.24.1
-backoff==2.2.1
-bcrypt==4.3.0
-beautifulsoup4==4.13.4
-bidict==0.23.1
-bitarray==3.6.0
-bitsandbytes==0.46.0
-bitsandbytes-cuda117==0.26.0.post2
-black==25.1.0
-blinker==1.8.2
-blis==1.3.0
-boto3==1.35.53
-botocore==1.35.99
-Brotli==1.1.0
-build==1.2.2.post1
-cachetools==5.5.2
-catalogue==2.0.10
-certifi==2025.8.3
-cffi==1.17.1
-chardet==5.2.0
-charset-normalizer==3.3.2
-chroma-hnswlib==0.7.6
-chromadb==0.6.3
-click==8.2.1
-cloudpathlib==0.21.1
-colbert-ai==0.2.21
-colorama==0.4.6
-coloredlogs==15.0.1
-comm==0.2.2
-confection==0.1.5
-contourpy==1.3.0
-cryptography==44.0.3
-cssselect2==0.8.0
-ctranslate2==4.6.0
-cycler==0.12.1
-cymem==2.0.11
-Cython==3.0.11
-dataclasses-json==0.6.7
-datasets==4.0.0
-ddgs==9.0.0
-decorator==5.1.1
-deep-translator==1.11.4
-defusedxml==0.7.1
-Deprecated==1.2.18
-diffusers==0.34.0
-dill==0.3.8
-diskcache==5.6.3
-distro==1.9.0
-dnspython==2.7.0
-docker==7.1.0
-docx2txt==0.8
-durationpy==0.9
-easyocr==1.7.2
-ecdsa==0.19.1
-effdet==0.4.1
-einops==0.8.1
-elastic-transport==8.17.1
-elasticsearch==9.0.1
-emoji==2.14.1
-et_xmlfile==2.0.0
-eval_type_backport==0.2.2
-Events==0.5
-executing==2.1.0
-faiss-cpu==1.11.0
-fake-useragent==2.1.0
-fastapi==0.115.7
-faster-whisper==1.1.1
-ffmpy==0.5.0
-filelock==3.16.1
-filetype==1.2.0
-fire==0.7.0
-firecrawl-py==1.12.0
-Flask==3.0.3
-flask-cors==6.0.1
-Flask-Login==0.6.3
-Flask-SQLAlchemy==3.1.1
-flatbuffers==24.3.25
-fonttools==4.54.1
-fpdf==1.7.2
-fpdf2==2.8.2
-fr_core_news_sm @ https://github.com/explosion/spacy-models/releases/download/fr_core_news_sm-3.8.0/fr_core_news_sm-3.8.0-py3-none-any.whl#sha256=7d6ad14cd5078e53147bfbf70fb9d433c6a3865b695fda2657140bbc59a27e29
-frozenlist==1.6.0
-fs==2.4.16
-fsspec==2024.10.0
-ftfy==6.2.3
-gast==0.5.4
-gcp-storage-emulator==2024.8.3
-git-python==1.0.3
-gitdb==4.0.12
-GitPython==3.1.44
-google-ai-generativelanguage==0.6.15
-google-api-core==2.24.2
-google-api-python-client==2.177.0
-google-auth==2.40.1
-google-auth-httplib2==0.2.0
-google-auth-oauthlib==1.2.2
-google-cloud-core==2.4.3
-google-cloud-storage==2.19.0
-google-cloud-vision==3.10.1
-google-crc32c==1.7.1
-google-genai==1.15.0
-google-generativeai==0.8.5
-google-pasta==0.2.0
-google-resumable-media==2.7.2
-google_search_results==2.4.2
-googleapis-common-protos==1.63.2
-gradio==5.29.0
-gradio_client==1.10.0
-greenlet==3.1.1
-groovy==0.1.2
-grpcio==1.67.1
-grpcio-status==1.67.1
-gunicorn==23.0.0
-h11==0.16.0
-h2==4.2.0
-h5py==3.11.0
-hf-xet==1.1.5
-hpack==4.1.0
-html5lib==1.1
-httpcore==1.0.9
-httplib2==0.22.0
-httptools==0.6.4
-httpx==0.28.1
-httpx-sse==0.4.0
-huggingface-hub==0.34.3
-humanfriendly==10.0
-hyperframe==6.1.0
-ibm-cloud-sdk-core==3.23.0
-ibm-watson==9.0.0
-idna==3.7
-imageio==2.37.0
-importlib_metadata==8.6.1
-importlib_resources==6.5.2
-iniconfig==2.1.0
-ipython==8.29.0
-ipywidgets==8.1.7
-isodate==0.7.2
-itsdangerous==2.2.0
-jedi==0.19.1
-Jinja2==3.1.6
-jiter==0.9.0
-jmespath==1.0.1
-joblib==1.5.0
-jsonlines==4.0.0
-jsonpatch==1.33
-jsonpointer==3.0.0
-jsonschema==4.23.0
-jsonschema-specifications==2025.4.1
-jupyterlab_widgets==3.0.15
-keras==3.8.0
-kiwisolver==1.4.7
-kubernetes==32.0.1
-langchain==0.3.26
-langchain-community==0.3.26
-langchain-core==0.3.72
-langchain-huggingface==0.3.1
-langchain-ollama==0.3.3
-langchain-text-splitters==0.3.9
-langcodes==3.5.0
-langdetect==1.0.9
-langfuse==2.44.0
-langsmith==0.4.4
-language_data==1.3.0
-lazy_loader==0.4
-ldap3==2.9.1
-libclang==18.1.1
-llama_api_client==0.1.2
-llama_cpp_python==0.3.14
-llama_stack==0.2.16
-llama_stack_client==0.2.16
-loguru==0.7.3
-lxml==5.4.0
-Mako==1.3.10
-marisa-trie==1.2.1
-Markdown==3.7
-markdown-it-py==3.0.0
-MarkupSafe==2.1.5
-marshmallow==3.26.1
-matplotlib==3.9.2
-matplotlib-inline==0.1.7
-mdurl==0.1.2
-Mesa==3.0.3
-ml-dtypes==0.4.1
-mmh3==5.1.0
-moto==5.1.9
-mplcursors==0.6
-mpmath==1.3.0
-msal==1.33.0
-msal-extensions==1.3.1
-multidict==6.4.3
-multiprocess==0.70.16
-murmurhash==1.0.13
-mypy_extensions==1.1.0
-mysqlclient==2.2.4
-namex==0.0.8
-narwhals==1.38.2
-nest-asyncio==1.6.0
-networkx==3.4.2
-ninja==1.11.1.4
-nltk==3.9.1
-nomic==3.5.3
-numpy==1.26.4
-oauthlib==3.2.2
-olefile==0.47
-ollama==0.4.8
-omegaconf==2.3.0
-onnx==1.17.0
-onnxruntime==1.20.1
-open-webui==0.6.18
-openai==1.98.0
-opencv-python==4.9.0.80
-opencv-python-headless==4.11.0.86
-openpyxl==3.1.5
-opensearch-py==2.8.0
-opentelemetry-api==1.33.1
-opentelemetry-exporter-otlp-proto-common==1.33.0
-opentelemetry-exporter-otlp-proto-grpc==1.33.0
-opentelemetry-exporter-otlp-proto-http==1.36.0
-opentelemetry-instrumentation==0.54b1
-opentelemetry-instrumentation-asgi==0.54b1
-opentelemetry-instrumentation-fastapi==0.54b1
-opentelemetry-proto==1.33.0
-opentelemetry-sdk==1.33.1
-opentelemetry-semantic-conventions==0.54b1
-opentelemetry-util-http==0.54b1
-opt-einsum==3.3.0
-optimum-quanto==0.2.7
-optree==0.11.0
-orjson==3.10.18
-overrides==7.7.0
-packaging==23.2
-pandas==2.2.3
-parso==0.8.4
-passlib==1.7.4
-pathspec==0.12.1
-pdf2image==1.17.0
-pdfminer.six==20250327
-pdfplumber==0.11.6
-peewee==3.18.1
-peewee-migrate==1.12.2
-pgvector==0.4.0
-pi_heif==0.22.0
-pikepdf==9.7.0
-pillow==11.2.1
-pinecone==6.0.2
-pinecone-plugin-interface==0.0.7
-platformdirs==4.3.8
-playwright==1.49.1
-pluggy==1.6.0
-portalocker==2.10.1
-posthog==5.4.0
-preshed==3.0.10
-primp==0.15.0
-prompt_toolkit==3.0.48
-propcache==0.3.1
-proto-plus==1.26.1
-protobuf==5.29.4
-psutil==7.0.0
-psycopg2-binary==2.9.9
-pure_eval==0.2.3
-py-partiql-parser==0.6.1
-pyaml==25.7.0
-pyarrow==20.0.0
-pyasn1==0.4.8
-pyasn1_modules==0.4.1
-pyclipper==1.3.0.post6
-pycocotools==2.0.8
-pycparser==2.22
-pycrdt==0.12.25
-pydantic==2.11.7
-pydantic-settings==2.9.1
-pydantic_core==2.33.2
-pydeck==0.9.1
-pydub==0.25.1
-pydyf==0.11.0
-pyee==12.0.0
-pygame==2.6.1
-Pygments==2.18.0
-PyJWT==2.10.1
-pymdown-extensions==10.14.2
-pymilvus==2.5.0
-pymongo==4.13.2
-PyMuPDF==1.25.5
-PyMySQL==1.1.1
-pypandoc==1.15
-pyparsing==3.2.0
-pypdf==4.3.1
-PyPDF2==3.0.1
-pypdfium2==4.30.1
-pyphen==0.17.2
-PyPika==0.48.9
-pyproject_hooks==1.2.0
-pyreadline3==3.5.4
-pytesseract==0.3.10
-pytest==8.3.5
-pytest-docker==3.1.2
-python-bidi==0.6.6
-python-dateutil==2.9.0.post0
--e git+https://github.com/mindee/doctr.git@849d19566b03cd37c8a831ae02673a1c2f265399#egg=python_doctr
-python-docx==1.1.2
-python-dotenv==1.1.0
-python-engineio==4.12.2
-python-iso639==2025.2.18
-python-jose==3.4.0
-python-magic==0.4.27
-python-magic-bin==0.4.14
-python-multipart==0.0.20
-python-oxmsg==0.0.2
-python-pptx==1.0.2
-python-socketio==5.13.0
-pytube==15.0.0
-pytz==2024.1
-pywin32==311
-pyxlsb==1.0.10
-PyYAML==6.0.2
-qdrant-client==1.14.3
-rank-bm25==0.2.2
-RapidFuzz==3.13.0
-rapidocr-onnxruntime==1.4.4
-redis==6.2.0
-referencing==0.36.2
-regex==2024.11.6
-requests==2.32.4
-requests-oauthlib==2.0.0
-requests-toolbelt==1.0.0
-responses==0.25.7
-RestrictedPython==8.0
-rich==13.7.1
-rpds-py==0.24.0
-rsa==4.9.1
-ruff==0.11.8
-s3transfer==0.10.4
-safehttpx==0.1.6
-safetensors==0.5.3
-scikit-image==0.25.2
-scikit-learn==1.6.1
-scipy==1.15.3
-semantic-version==2.10.0
-sentence-transformers==4.1.0
-sentencepiece==0.2.0
-serpapi==0.1.5
-setuptools==75.8.0
-shapely==2.1.1
-shellingham==1.5.4
-simple-websocket==1.1.0
-six==1.16.0
-smart_open==7.3.0.post1
-smmap==5.0.2
-sniffio==1.3.1
-socksio==1.0.0
-soundfile==0.13.1
-soupsieve==2.7
-spacy==3.8.7
-spacy-legacy==3.0.12
-spacy-loggers==1.0.5
-SQLAlchemy==2.0.38
-srsly==2.5.1
-stack-data==0.6.3
-starlette==0.45.3
-starlette-compress==1.6.0
-streamlit==1.47.0
-sumolib==1.21.0
-sympy==1.14.0
-tabulate==0.9.0
-tenacity==9.1.2
-tencentcloud-sdk-python==3.0.1336
-tensorboard==2.18.0
-tensorboard-data-server==0.7.2
-termcolor==2.4.0
-thinc==8.3.6
-threadpoolctl==3.6.0
-tifffile==2025.6.11
-tiktoken==0.9.0
-timm==1.0.15
-tinycss2==1.4.0
-tinyhtml5==2.0.0
-tokenizers==0.21.1
-toml==0.10.2
-tomlkit==0.13.2
-torch==2.7.1+cu118
-torchaudio==2.7.1+cu118
-torchvision==0.22.1+cu118
-tornado==6.4.2
-tqdm==4.67.0
-traci==1.21.0
-traitlets==5.14.3
-transformers==4.55.0
-typer==0.15.3
-typing-inspect==0.9.0
-typing-inspection==0.4.0
-typing_extensions==4.13.2
-tzdata==2024.1
-tzlocal==5.3.1
-ujson==5.10.0
-unstructured==0.16.17
-unstructured-client==0.34.0
-unstructured-inference==0.8.10
-unstructured.pytesseract==0.3.15
-uritemplate==4.2.0
-urllib3==2.5.0
-uvicorn==0.34.2
-validators==0.35.0
-wasabi==1.1.3
-watchdog==6.0.0
-watchfiles==1.0.5
-wcwidth==0.2.13
-weasel==0.4.1
-weasyprint==65.1
-webencodings==0.5.1
-websocket-client==1.8.0
-websockets==15.0.1
-Werkzeug==3.0.3
-wheel==0.45.1
-widgetsnbextension==4.0.14
-win32_setctime==1.2.0
-wrapt==1.16.0
-wsproto==1.2.0
-xlrd==2.0.1
-XlsxWriter==3.2.3
-xmltodict==0.14.2
-xxhash==3.5.0
-yarl==1.20.0
-youtube-transcript-api==1.1.0
-zipp==3.21.0
-zopfli==0.2.3.post1
-zstandard==0.23.0

+ 0 - 455
tests/requirements.txt

@@ -1,455 +0,0 @@
-absl-py==2.1.0
-accelerate==1.6.0
-aiocache==0.12.3
-aiofiles==24.1.0
-aiohappyeyeballs==2.6.1
-aiohttp==3.11.11
-aiosignal==1.3.2
-aiosqlite==0.21.0
-alembic==1.14.0
-altair==5.5.0
-annotated-types==0.7.0
-anthropic==0.60.0
-antlr4-python3-runtime==4.9.3
-anyascii==0.3.3
-anyio==4.9.0
-appdirs==1.4.4
-APScheduler==3.10.4
-argon2-cffi==23.1.0
-argon2-cffi-bindings==25.1.0
-asgiref==3.8.1
-asttokens==2.4.1
-astunparse==1.6.3
-async-timeout==5.0.1
-asyncpg==0.30.0
-attrs==25.3.0
-Authlib==1.4.1
-av==15.0.0
-azure-ai-documentintelligence==1.0.2
-azure-core==1.35.0
-azure-identity==1.20.0
-azure-storage-blob==12.24.1
-backoff==2.2.1
-bcrypt==4.3.0
-beautifulsoup4==4.13.4
-bidict==0.23.1
-bitarray==3.6.0
-bitsandbytes==0.46.0
-bitsandbytes-cuda117==0.26.0.post2
-black==25.1.0
-blinker==1.8.2
-blis==1.3.0
-boto3==1.35.53
-botocore==1.35.99
-Brotli==1.1.0
-build==1.2.2.post1
-cachetools==5.5.2
-catalogue==2.0.10
-certifi==2025.8.3
-cffi==1.17.1
-chardet==5.2.0
-charset-normalizer==3.3.2
-chroma-hnswlib==0.7.6
-chromadb==0.6.3
-click==8.2.1
-cloudpathlib==0.21.1
-colbert-ai==0.2.21
-colorama==0.4.6
-coloredlogs==15.0.1
-comm==0.2.2
-confection==0.1.5
-contourpy==1.3.0
-cryptography==44.0.3
-cssselect2==0.8.0
-ctranslate2==4.6.0
-cycler==0.12.1
-cymem==2.0.11
-Cython==3.0.11
-dataclasses-json==0.6.7
-datasets==4.0.0
-ddgs==9.0.0
-decorator==5.1.1
-deep-translator==1.11.4
-defusedxml==0.7.1
-Deprecated==1.2.18
-diffusers==0.34.0
-dill==0.3.8
-diskcache==5.6.3
-distro==1.9.0
-dnspython==2.7.0
-docker==7.1.0
-docx2txt==0.8
-durationpy==0.9
-easyocr==1.7.2
-ecdsa==0.19.1
-effdet==0.4.1
-einops==0.8.1
-elastic-transport==8.17.1
-elasticsearch==9.0.1
-emoji==2.14.1
-et_xmlfile==2.0.0
-eval_type_backport==0.2.2
-Events==0.5
-executing==2.1.0
-faiss-cpu==1.11.0
-fake-useragent==2.1.0
-fastapi==0.115.7
-faster-whisper==1.1.1
-ffmpy==0.5.0
-filelock==3.16.1
-filetype==1.2.0
-fire==0.7.0
-firecrawl-py==1.12.0
-Flask==3.0.3
-Flask-Login==0.6.3
-Flask-SQLAlchemy==3.1.1
-flatbuffers==24.3.25
-fonttools==4.54.1
-fpdf==1.7.2
-fpdf2==2.8.2
-fr_core_news_sm @ https://github.com/explosion/spacy-models/releases/download/fr_core_news_sm-3.8.0/fr_core_news_sm-3.8.0-py3-none-any.whl#sha256=7d6ad14cd5078e53147bfbf70fb9d433c6a3865b695fda2657140bbc59a27e29
-frozenlist==1.6.0
-fs==2.4.16
-fsspec==2024.10.0
-ftfy==6.2.3
-gast==0.5.4
-gcp-storage-emulator==2024.8.3
-git-python==1.0.3
-gitdb==4.0.12
-GitPython==3.1.44
-google-ai-generativelanguage==0.6.15
-google-api-core==2.24.2
-google-api-python-client==2.177.0
-google-auth==2.40.1
-google-auth-httplib2==0.2.0
-google-auth-oauthlib==1.2.2
-google-cloud-core==2.4.3
-google-cloud-storage==2.19.0
-google-cloud-vision==3.10.1
-google-crc32c==1.7.1
-google-genai==1.15.0
-google-generativeai==0.8.5
-google-pasta==0.2.0
-google-resumable-media==2.7.2
-google_search_results==2.4.2
-googleapis-common-protos==1.63.2
-gradio==5.29.0
-gradio_client==1.10.0
-greenlet==3.1.1
-groovy==0.1.2
-grpcio==1.67.1
-grpcio-status==1.67.1
-gunicorn==23.0.0
-h11==0.16.0
-h2==4.2.0
-h5py==3.11.0
-hf-xet==1.1.5
-hpack==4.1.0
-html5lib==1.1
-httpcore==1.0.9
-httplib2==0.22.0
-httptools==0.6.4
-httpx==0.28.1
-httpx-sse==0.4.0
-huggingface-hub==0.34.3
-humanfriendly==10.0
-hyperframe==6.1.0
-ibm-cloud-sdk-core==3.23.0
-ibm-watson==9.0.0
-idna==3.7
-imageio==2.37.0
-importlib_metadata==8.6.1
-importlib_resources==6.5.2
-iniconfig==2.1.0
-ipython==8.29.0
-ipywidgets==8.1.7
-isodate==0.7.2
-itsdangerous==2.2.0
-jedi==0.19.1
-Jinja2==3.1.6
-jiter==0.9.0
-jmespath==1.0.1
-joblib==1.5.0
-jsonlines==4.0.0
-jsonpatch==1.33
-jsonpointer==3.0.0
-jsonschema==4.23.0
-jsonschema-specifications==2025.4.1
-jupyterlab_widgets==3.0.15
-keras==3.8.0
-kiwisolver==1.4.7
-kubernetes==32.0.1
-langchain==0.3.26
-langchain-community==0.3.26
-langchain-core==0.3.72
-langchain-huggingface==0.3.1
-langchain-ollama==0.3.3
-langchain-text-splitters==0.3.9
-langcodes==3.5.0
-langdetect==1.0.9
-langfuse==2.44.0
-langsmith==0.4.4
-language_data==1.3.0
-lazy_loader==0.4
-ldap3==2.9.1
-libclang==18.1.1
-llama_api_client==0.1.2
-llama_cpp_python==0.3.14
-llama_stack==0.2.16
-llama_stack_client==0.2.16
-loguru==0.7.3
-lxml==5.4.0
-Mako==1.3.10
-marisa-trie==1.2.1
-Markdown==3.7
-markdown-it-py==3.0.0
-MarkupSafe==2.1.5
-marshmallow==3.26.1
-matplotlib==3.9.2
-matplotlib-inline==0.1.7
-mdurl==0.1.2
-Mesa==3.0.3
-ml-dtypes==0.4.1
-mmh3==5.1.0
-moto==5.1.9
-mplcursors==0.6
-mpmath==1.3.0
-msal==1.33.0
-msal-extensions==1.3.1
-multidict==6.4.3
-multiprocess==0.70.16
-murmurhash==1.0.13
-mypy_extensions==1.1.0
-mysqlclient==2.2.4
-namex==0.0.8
-narwhals==1.38.2
-nest-asyncio==1.6.0
-networkx==3.4.2
-ninja==1.11.1.4
-nltk==3.9.1
-nomic==3.5.3
-numpy==1.26.4
-oauthlib==3.2.2
-olefile==0.47
-ollama==0.4.8
-omegaconf==2.3.0
-onnx==1.17.0
-onnxruntime==1.20.1
-open-webui==0.6.18
-openai==1.98.0
-opencv-python==4.9.0.80
-opencv-python-headless==4.11.0.86
-openpyxl==3.1.5
-opensearch-py==2.8.0
-opentelemetry-api==1.33.1
-opentelemetry-exporter-otlp-proto-common==1.33.0
-opentelemetry-exporter-otlp-proto-grpc==1.33.0
-opentelemetry-exporter-otlp-proto-http==1.36.0
-opentelemetry-instrumentation==0.54b1
-opentelemetry-instrumentation-asgi==0.54b1
-opentelemetry-instrumentation-fastapi==0.54b1
-opentelemetry-proto==1.33.0
-opentelemetry-sdk==1.33.1
-opentelemetry-semantic-conventions==0.54b1
-opentelemetry-util-http==0.54b1
-opt-einsum==3.3.0
-optimum-quanto==0.2.7
-optree==0.11.0
-orjson==3.10.18
-overrides==7.7.0
-packaging==23.2
-pandas==2.2.3
-parso==0.8.4
-passlib==1.7.4
-pathspec==0.12.1
-pdf2image==1.17.0
-pdfminer.six==20250327
-pdfplumber==0.11.6
-peewee==3.18.1
-peewee-migrate==1.12.2
-pgvector==0.4.0
-pi_heif==0.22.0
-pikepdf==9.7.0
-pillow==11.2.1
-pinecone==6.0.2
-pinecone-plugin-interface==0.0.7
-platformdirs==4.3.8
-playwright==1.49.1
-pluggy==1.6.0
-portalocker==2.10.1
-posthog==5.4.0
-preshed==3.0.10
-primp==0.15.0
-prompt_toolkit==3.0.48
-propcache==0.3.1
-proto-plus==1.26.1
-protobuf==5.29.4
-psutil==7.0.0
-psycopg2-binary==2.9.9
-pure_eval==0.2.3
-py-partiql-parser==0.6.1
-pyaml==25.7.0
-pyarrow==20.0.0
-pyasn1==0.4.8
-pyasn1_modules==0.4.1
-pyclipper==1.3.0.post6
-pycocotools==2.0.8
-pycparser==2.22
-pycrdt==0.12.25
-pydantic==2.11.7
-pydantic-settings==2.9.1
-pydantic_core==2.33.2
-pydeck==0.9.1
-pydub==0.25.1
-pydyf==0.11.0
-pyee==12.0.0
-pygame==2.6.1
-Pygments==2.18.0
-PyJWT==2.10.1
-pymdown-extensions==10.14.2
-pymilvus==2.5.0
-pymongo==4.13.2
-PyMuPDF==1.25.5
-PyMySQL==1.1.1
-pypandoc==1.15
-pyparsing==3.2.0
-pypdf==4.3.1
-PyPDF2==3.0.1
-pypdfium2==4.30.1
-pyphen==0.17.2
-PyPika==0.48.9
-pyproject_hooks==1.2.0
-pyreadline3==3.5.4
-pytesseract==0.3.10
-pytest==8.3.5
-pytest-docker==3.1.2
-python-bidi==0.6.6
-python-dateutil==2.9.0.post0
--e git+https://github.com/mindee/doctr.git@849d19566b03cd37c8a831ae02673a1c2f265399#egg=python_doctr
-python-docx==1.1.2
-python-dotenv==1.1.0
-python-engineio==4.12.2
-python-iso639==2025.2.18
-python-jose==3.4.0
-python-magic==0.4.27
-python-magic-bin==0.4.14
-python-multipart==0.0.20
-python-oxmsg==0.0.2
-python-pptx==1.0.2
-python-socketio==5.13.0
-pytube==15.0.0
-pytz==2024.1
-pywin32==311
-pyxlsb==1.0.10
-PyYAML==6.0.2
-qdrant-client==1.14.3
-rank-bm25==0.2.2
-RapidFuzz==3.13.0
-rapidocr-onnxruntime==1.4.4
-redis==6.2.0
-referencing==0.36.2
-regex==2024.11.6
-requests==2.32.4
-requests-oauthlib==2.0.0
-requests-toolbelt==1.0.0
-responses==0.25.7
-RestrictedPython==8.0
-rich==13.7.1
-rpds-py==0.24.0
-rsa==4.9.1
-ruff==0.11.8
-s3transfer==0.10.4
-safehttpx==0.1.6
-safetensors==0.5.3
-scikit-image==0.25.2
-scikit-learn==1.6.1
-scipy==1.15.3
-semantic-version==2.10.0
-sentence-transformers==4.1.0
-sentencepiece==0.2.0
-serpapi==0.1.5
-setuptools==75.8.0
-shapely==2.1.1
-shellingham==1.5.4
-simple-websocket==1.1.0
-six==1.16.0
-smart_open==7.3.0.post1
-smmap==5.0.2
-sniffio==1.3.1
-socksio==1.0.0
-soundfile==0.13.1
-soupsieve==2.7
-spacy==3.8.7
-spacy-legacy==3.0.12
-spacy-loggers==1.0.5
-SQLAlchemy==2.0.38
-srsly==2.5.1
-stack-data==0.6.3
-starlette==0.45.3
-starlette-compress==1.6.0
-streamlit==1.47.0
-sumolib==1.21.0
-sympy==1.14.0
-tabulate==0.9.0
-tenacity==9.1.2
-tencentcloud-sdk-python==3.0.1336
-tensorboard==2.18.0
-tensorboard-data-server==0.7.2
-termcolor==2.4.0
-thinc==8.3.6
-threadpoolctl==3.6.0
-tifffile==2025.6.11
-tiktoken==0.9.0
-timm==1.0.15
-tinycss2==1.4.0
-tinyhtml5==2.0.0
-tokenizers==0.21.1
-toml==0.10.2
-tomlkit==0.13.2
-torch==2.7.1+cu118
-torchaudio==2.7.1+cu118
-torchvision==0.22.1+cu118
-tornado==6.4.2
-tqdm==4.67.0
-traci==1.21.0
-traitlets==5.14.3
-transformers==4.51.3
-typer==0.15.3
-typing-inspect==0.9.0
-typing-inspection==0.4.0
-typing_extensions==4.13.2
-tzdata==2024.1
-tzlocal==5.3.1
-ujson==5.10.0
-unstructured==0.16.17
-unstructured-client==0.34.0
-unstructured-inference==0.8.10
-unstructured.pytesseract==0.3.15
-uritemplate==4.2.0
-urllib3==2.5.0
-uvicorn==0.34.2
-validators==0.35.0
-wasabi==1.1.3
-watchdog==6.0.0
-watchfiles==1.0.5
-wcwidth==0.2.13
-weasel==0.4.1
-weasyprint==65.1
-webencodings==0.5.1
-websocket-client==1.8.0
-websockets==15.0.1
-Werkzeug==3.0.3
-wheel==0.45.1
-widgetsnbextension==4.0.14
-win32_setctime==1.2.0
-wrapt==1.16.0
-wsproto==1.2.0
-xlrd==2.0.1
-XlsxWriter==3.2.3
-xmltodict==0.14.2
-xxhash==3.5.0
-yarl==1.20.0
-youtube-transcript-api==1.1.0
-zipp==3.21.0
-zopfli==0.2.3.post1
-zstandard==0.23.0