Nadine Elleuch 1 yıl önce
ebeveyn
işleme
f67956f54b
50 değiştirilmiş dosya ile 4361 ekleme ve 413 silme
  1. 0 413
      app.py
  2. 0 0
      src/__init__.py
  3. BIN
      src/__pycache__/__init__.cpython-312.pyc
  4. BIN
      src/__pycache__/app.cpython-312.pyc
  5. 0 0
      src/agent_ai/__init__.py
  6. BIN
      src/agent_ai/__pycache__/__init__.cpython-312.pyc
  7. BIN
      src/agent_ai/__pycache__/auth.cpython-310.pyc
  8. BIN
      src/agent_ai/__pycache__/auth.cpython-312.pyc
  9. BIN
      src/agent_ai/__pycache__/chunking.cpython-310.pyc
  10. BIN
      src/agent_ai/__pycache__/chunking.cpython-312.pyc
  11. BIN
      src/agent_ai/__pycache__/embedding_index.cpython-312.pyc
  12. BIN
      src/agent_ai/__pycache__/qa_chain.cpython-312.pyc
  13. BIN
      src/agent_ai/__pycache__/scraping.cpython-310.pyc
  14. BIN
      src/agent_ai/__pycache__/scraping.cpython-312.pyc
  15. BIN
      src/agent_ai/__pycache__/test_auth.cpython-312-pytest-8.4.1.pyc
  16. BIN
      src/agent_ai/__pycache__/test_chunking.cpython-312-pytest-8.4.1.pyc
  17. BIN
      src/agent_ai/__pycache__/test_embedding_index.cpython-312-pytest-8.4.1.pyc
  18. BIN
      src/agent_ai/__pycache__/test_qa_chain.cpython-312-pytest-8.4.1.pyc
  19. BIN
      src/agent_ai/__pycache__/test_scraping.cpython-312-pytest-8.4.1.pyc
  20. 43 0
      src/agent_ai/auth.py
  21. 86 0
      src/agent_ai/chunking.py
  22. 192 0
      src/agent_ai/scraping.py
  23. 0 0
      src/api/__init__.py
  24. 490 0
      src/app.py
  25. 10 0
      src/data/All_chunks.json
  26. BIN
      src/data/faiss_index.index
  27. 1 0
      src/data/page_hashes.json
  28. 3 0
      src/data/raw_pages.json
  29. 438 0
      src/data/urls.json
  30. 25 0
      src/models/VLM.py
  31. 0 0
      src/models/__init__.py
  32. BIN
      src/models/__pycache__/VLM.cpython-312.pyc
  33. BIN
      src/models/__pycache__/__init__.cpython-312.pyc
  34. 540 0
      src/templates/index.html
  35. BIN
      src/uploads/cos.png
  36. BIN
      src/uploads/cross.png
  37. BIN
      src/uploads/methodologie.png
  38. 24 0
      src/uploads/ocr_output.html
  39. 2123 0
      src/uploads/ocr_output.json
  40. 25 0
      src/uploads/ocr_output_words.html
  41. BIN
      src/uploads/processus_.png
  42. BIN
      src/uploads/reg_chunk.png
  43. 0 0
      src/utils/__init__.py
  44. BIN
      src/utils/__pycache__/__init__.cpython-312.pyc
  45. BIN
      src/utils/__pycache__/ocr.cpython-312.pyc
  46. BIN
      src/utils/__pycache__/processing.cpython-312.pyc
  47. BIN
      src/utils/__pycache__/security.cpython-312.pyc
  48. 162 0
      src/utils/ocr.py
  49. 115 0
      src/utils/processing.py
  50. 84 0
      src/utils/security.py

+ 0 - 413
app.py

@@ -1,413 +0,0 @@
-from flask import Flask, request, jsonify, send_from_directory
-from apscheduler.schedulers.background import BackgroundScheduler
-from sentence_transformers import CrossEncoder, SentenceTransformer
-from langchain_ollama import OllamaLLM
-from processing import full_update_pipeline
-from agent_ai.auth import login_to_wiki
-import faiss 
-import json
-import numpy as np
-import textwrap
-from sklearn.metrics.pairwise import cosine_similarity
-from tabulate import tabulate
-import os
-import threading
-from serpapi import GoogleSearch
-from werkzeug.utils import secure_filename
-import PyPDF2
-from PIL import Image
-from transformers import AutoTokenizer
-from ocr import run_ocr, generate_html , generate_word_level_html  
-import tiktoken
-from VLM import ask_blip
-import getpass
-
-
-app = Flask(__name__)
-
-llm_variants = [
-    {
-        "name": "config_1",
-        "model": "llama3",
-        "temperature": 0.1,
-        "top_p": 0.95,
-        "max_tokens": 1000
-    },
-    {
-        "name": "config_2",
-        "model": "llama3",
-        "temperature": 0.7,
-        "top_p": 0.85,
-        "max_tokens": 1000
-    },
-    {
-        "name": "config_3",
-        "model": "llama3",
-        "temperature": 0.3,
-        "top_p": 0.9,
-        "max_tokens": 1000
-    }
-]
-
-state = {
-    "index": None,
-    "all_chunks": [],
-    "chunk_urls": [],
-    "all_embeddings": None,
-    "embedding_model": SentenceTransformer('all-MiniLM-L6-v2'),
-    "cross_encoder": CrossEncoder("cross-encoder/ms-marco-MiniLM-L-6-v2"),
-    "is_updating": False,
-    "llm": llm_variants,
-    "chat_history": []
-   
-}
-
-def run_full_update():
-    print("🔄 Lancement du pipeline via le scheduler...")
-    full_update_pipeline()
-
-tokenizer = AutoTokenizer.from_pretrained("bert-base-uncased")
-
-def chunk_text(text, chunk_size=400, overlap=100):
-    tokens = tokenizer.encode(text)
-    chunks = []
-    for i in range(0, len(tokens), chunk_size - overlap):
-        chunk = tokens[i:i + chunk_size]
-        chunks.append(tokenizer.decode(chunk))
-    return chunks
-
-
-UPLOAD_FOLDER = "uploads"
-os.makedirs(UPLOAD_FOLDER, exist_ok=True)  # Crée le dossier s'il n'existe pas
-app.config["UPLOAD_FOLDER"] = UPLOAD_FOLDER
-
-ALLOWED_EXTENSIONS = {'txt', 'pdf', 'png', 'jpg', 'jpeg'}
-
-def allowed_file(filename):
-    return '.' in filename and filename.rsplit('.', 1)[1].lower() in ALLOWED_EXTENSIONS
-
-@app.route("/upload_file", methods=["POST"])
-def upload_file():
-    if 'file' not in request.files:
-        return jsonify({"error": "Aucun fichier détecté."}), 400
-
-    file = request.files['file']
-    if file.filename == '':
-        return jsonify({"error": "Nom de fichier vide."}), 400
-
-    if file and allowed_file(file.filename):
-        filename = secure_filename(file.filename)
-        filepath = os.path.join(app.config['UPLOAD_FOLDER'], filename)
-        file.save(filepath)
-
-        question = request.form.get("question", "")
-        if not question:
-            return jsonify({"error": "Veuillez poser une question liée au fichier."}), 400
-
-        try:
-            # ✅ 1. Exécuter l'OCR
-            document, ocr_output = run_ocr(filepath)
-
-            # ✅ 2. Sauvegarder le JSON OCR
-            json_path = os.path.join(app.config['UPLOAD_FOLDER'], "ocr_output.json")
-            with open(json_path, "w", encoding="utf-8") as fjson:
-                json.dump(ocr_output, fjson, ensure_ascii=False, indent=2)
-
-            # ✅ 3. Générer le HTML avec bounding boxes par mot
-            html_path = os.path.join(app.config['UPLOAD_FOLDER'], "ocr_output_words.html")
-            generate_word_level_html(ocr_output, output_html_path=html_path)
-
-            # ✅ 4. Extraire le texte brut pour le traitement RAG
-            text = ""
-            for page in ocr_output['pages']:
-                for block in page['blocks']:
-                    for line in block['lines']:
-                        for word in line['words']:
-                            text += word['value'] + " "
-                        text += "\n"
-                    text += "\n"
-                text += "\n"
-
-        except Exception as e:
-            return jsonify({"error": f"OCR échoué : {str(e)}"}), 500
-
-        if text.strip():
-            chunks = chunk_text(text)
-            embeddings = state["embedding_model"].encode(chunks)
-            question_embedding = state["embedding_model"].encode([question])[0]
-            similarities = cosine_similarity([question_embedding], embeddings)[0]
-            top_indices = np.argsort(similarities)[::-1][:5]
-            top_chunks = [chunks[i] for i in top_indices]
-            top_context = "\n\n".join(top_chunks)
-
-            prompt = (
-                "Réponds en français à la question suivante en utilisant uniquement le contenu fourni. "
-                "Si la réponse est absente, dis-le clairement.\n\n"
-                f"{top_context}\n\nQuestion : {question}"
-            )
-
-            answer = state["llm"](prompt).strip()
-            return jsonify({
-                "answer": answer,
-                "html_file": f"uploads/ocr_output_words.html"
-            })
-
-        else:
-            try:
-                answer = ask_blip(filepath, question)
-                return jsonify({"answer": answer})
-            except Exception as e:
-                return jsonify({"error": f"LLaVA échoué : {str(e)}"}), 500
-
-    return jsonify({"error": "Format de fichier non supporté."}), 400
-
-@app.route("/delete_file", methods=["POST"])
-def delete_file():
-    data = request.get_json()
-    filename = data.get("filename")
-
-    if not filename:
-        return jsonify({"error": "Nom de fichier manquant."}), 400
-
-    filepath = os.path.join(app.config["UPLOAD_FOLDER"], secure_filename(filename))
-
-    if os.path.exists(filepath):
-        os.remove(filepath)
-        return jsonify({"message": "Fichier supprimé avec succès."})
-    else:
-        return jsonify({"error": "Fichier introuvable."}), 404
-
-
-@app.route('/')
-def index():
-    return send_from_directory(os.getcwd(), 'index.html')
-
-@app.route("/login", methods=["POST"])
-def login():
-    data = request.json
-    username = data.get("username")
-    password = data.get("password")
-
-    if not username or not password:
-        return jsonify({"error": "username and password required"}), 400
-
-    if not login_to_wiki(username, password):
-        return jsonify({"error": "Authentication failed"}), 401
-
-    return jsonify({"message": "Login successful"})
-
-@app.route("/chat_history", methods=["GET"])
-def chat_history():
-    return jsonify(state["chat_history"])
-
-@app.route("/qa_chain", methods=["POST"])
-def qa_chain_route():
-    if state.get("llm") is None:
-        return jsonify({"error": "Le modèle LLM n'est pas initialisé."}), 500
-
-    if state["index"] is None or not state["all_chunks"]:
-        if state["is_updating"]:
-            return jsonify({"error": "Le système est encore en train d’indexer les documents. Réessayez dans quelques instants."}), 503
-        else:
-            return jsonify({"error": "L’index est vide. Veuillez attendre la mise à jour ou réinitialiser le système."}), 500
-
-    data = request.get_json()
-    question = data.get("question", "")
-
-    if not question:
-        return jsonify({"error": "Question vide."}), 400
-
-    try:
-        query_embedding = state["embedding_model"].encode([question])[0]
-
-        if state["all_embeddings"] is None:
-            state["all_embeddings"] = state["embedding_model"].encode(state["all_chunks"])
-
-        similarities = cosine_similarity([query_embedding], state["all_embeddings"])[0]
-        top_indices = np.argsort(similarities)[::-1][:20]
-
-        rerank_data = [(question, state["all_chunks"][i]) for i in top_indices]
-        rerank_scores = state["cross_encoder"].predict(rerank_data)
-        reranked = sorted(
-            zip([state["all_chunks"][i] for i in top_indices], top_indices, rerank_scores),
-            key=lambda x: x[2], reverse=True
-        )
-
-        enc = tiktoken.encoding_for_model("gpt-3.5-turbo")
-        cache_data = []
-
-        for rank, (chunk, idx, score) in enumerate(reranked[:20], start=1):
-            url = state["chunk_urls"][idx] if idx < len(state["chunk_urls"]) else "URL inconnue"
-            token_count = len(enc.encode(chunk))
-
-            cache_data.append({
-                "rank": rank,
-                "url": url,
-                "chunk": chunk,
-                "tokens": token_count
-            })
-
-        with open("cache_context.json", "w", encoding="utf-8") as f:
-            json.dump(cache_data, f, indent=2, ensure_ascii=False)
-
-        table = []
-        top_chunks = []
-        for rank, (chunk, idx, score) in enumerate(reranked, start=1):
-            url = state["chunk_urls"][idx] if idx < len(state["chunk_urls"]) else "URL inconnue"
-            wrapped_chunk = "\n".join(textwrap.wrap(chunk.strip(), width=80))[:1000] + "..."
-            wrapped_url = "\n".join(textwrap.wrap(url, width=80))
-            table.append([rank, round(score, 4), wrapped_chunk, wrapped_url])
-            top_chunks.append(chunk)
-
-        print("\n================== RÉSULTATS CLASSÉS PAR PERTINENCE ==================")
-        print(tabulate(table, headers=["Rank", "Score", "Chunk", "URL"], tablefmt="fancy_grid"))
-        print("=======================================================================\n")
-
-        max_chars = 15000
-        top_chunks = []
-        current_length = 0
-        for chunk, _, _ in reranked:
-            if current_length + len(chunk) > max_chars:
-                break
-            top_chunks.append(chunk)
-            current_length += len(chunk)
-
-        top_context = "\n\n".join(top_chunks)
-
-        llm_variants = [
-            {
-                "name": "config_1",
-                "model": "llama3",
-                "temperature": 0.1,
-                "top_p": 0.95,
-                "max_tokens": 600
-            },
-            {
-                "name": "config_2",
-                "model": "llama3",
-                "temperature": 0.7,
-                "top_p": 0.85,
-                "max_tokens": 600
-            },
-            {
-                "name": "config_3",
-                "model": "llama3",
-                "temperature": 0.3,
-                "top_p": 0.9,
-                "max_tokens": 600
-            }
-        ]
-
-        all_answers = []
-
-        for config in llm_variants:
-            llm = OllamaLLM(
-                model=config["model"],
-                temperature=config["temperature"],
-                top_p=config["top_p"],
-                max_tokens=config["max_tokens"]
-            )
-
-            prompt = f"""
-Tu es un assistant intelligent. Réponds uniquement avec les informations données dans le contexte suivant. 
-Ta réponse doit être factuelle, concise et précise. Si la réponse n’est pas présente dans le contexte, dis :
-"Information non disponible."
-
-Ne reformule pas la question. N’invente rien.
-
-Contexte :
-{top_context}
-
-Question : {question}
-Réponse :
-"""
-
-            response = llm(prompt).strip()
-            all_answers.append({
-                "config": config["name"],
-                "response": response
-            })
-
-        print("\n====================== PROMPTS & RÉPONSES ======================")
-        for ans in all_answers:
-            print(f"\nConfig: {ans['config']}\nRéponse : {ans['response']}")
-        print("==============================================================\n")
-
-        return jsonify({"answers": all_answers})
-
-    except Exception as e:
-        print(f"[Erreur Wiki] : {e}")
-       
-
-    #  ÉTAPE 2 : Fallback vers recherche web (SerpAPI) 
-    try:
-        params = {
-            "engine": "google",
-            "q": question,
-            "api_key": "1b0f09bd610259b457b08c5fad06ded73a9e108e6bcc932e02ac88b2f3840171",
-            "gl": "fr",
-            "hl": "fr"
-        }
-        search = GoogleSearch(params)
-        results = search.get_dict()
-
-        answer = "Je n'ai pas trouvé de réponse précise."
-        if "answer_box" in results and "answer" in results["answer_box"]:
-            answer = results["answer_box"]["answer"]
-        elif "organic_results" in results and results["organic_results"]:
-            answer = results["organic_results"][0].get("snippet", answer)
-
-        #  Résumer ou filtrer la réponse via le LLM 
-        if state.get("llm"):
-            prompt = (
-    "Réponds uniquement à la question de manière directe et concise.\n"
-    "Sans reformuler la question, sans phrase d’introduction, sans politesse et sans contenu promotionnel. "
-    "Utilise uniquement les faits du texte ci-dessous. "
-    "Si l’information n’est pas présente, réponds : 'Information non disponible.'\n\n"
-    f"Texte : {answer}\n\n"
-    f"Question : {question}"
-)
-
-            try:
-                answer = state["llm"](prompt).strip()
-            except Exception as llm_error:
-                print("[Erreur LLM sur reformulation] :", llm_error)
-
-        # Historique
-        state["chat_history"].append({
-            "question": question,
-            "answer": answer,
-            "sources": ["Google Search"]
-        })
-
-        return jsonify({
-            "answer": answer,
-            "sources": ["Google Search"]
-        })
-
-    except Exception as e:
-        return jsonify({"error": f"Erreur SerpAPI : {str(e)}"}), 500
-
-
-
-# Scheduler
-scheduler = BackgroundScheduler()
-scheduler.add_job(run_full_update, 'interval', minutes=150)
-print("🔁 Scheduler activé pour mises à jour toutes les 30 min")
-
-def prompt_for_login():
-    print("🔐 Please log in to the Wiki before starting the app.")
-    while True:
-        username = input("Username: ")
-        password = getpass.getpass("Password: ")
-        if login_to_wiki(username, password):
-            print("Login successful, starting the app...")
-            break
-        else:
-            print("Login failed, please try again.\n")
-if __name__ == "__main__":
-    
-    prompt_for_login()
-    full_update_pipeline()
-    scheduler.start()
-    app.run(debug=True, use_reloader=False)

+ 0 - 0
src/__init__.py


BIN
src/__pycache__/__init__.cpython-312.pyc


BIN
src/__pycache__/app.cpython-312.pyc


+ 0 - 0
src/agent_ai/__init__.py


BIN
src/agent_ai/__pycache__/__init__.cpython-312.pyc


BIN
src/agent_ai/__pycache__/auth.cpython-310.pyc


BIN
src/agent_ai/__pycache__/auth.cpython-312.pyc


BIN
src/agent_ai/__pycache__/chunking.cpython-310.pyc


BIN
src/agent_ai/__pycache__/chunking.cpython-312.pyc


BIN
src/agent_ai/__pycache__/embedding_index.cpython-312.pyc


BIN
src/agent_ai/__pycache__/qa_chain.cpython-312.pyc


BIN
src/agent_ai/__pycache__/scraping.cpython-310.pyc


BIN
src/agent_ai/__pycache__/scraping.cpython-312.pyc


BIN
src/agent_ai/__pycache__/test_auth.cpython-312-pytest-8.4.1.pyc


BIN
src/agent_ai/__pycache__/test_chunking.cpython-312-pytest-8.4.1.pyc


BIN
src/agent_ai/__pycache__/test_embedding_index.cpython-312-pytest-8.4.1.pyc


BIN
src/agent_ai/__pycache__/test_qa_chain.cpython-312-pytest-8.4.1.pyc


BIN
src/agent_ai/__pycache__/test_scraping.cpython-312-pytest-8.4.1.pyc


+ 43 - 0
src/agent_ai/auth.py

@@ -0,0 +1,43 @@
+"""
+auth.py 
+
+Gestion de l’authentification sur le wiki Intersel
+
+Ce module permet de se connecter au wiki en utilisant une session HTTP persistante et il récupère tout seul un code spécial (le token CSRF) nécessaire pour se connecter en toute sécurité
+"""
+
+import requests
+from bs4 import BeautifulSoup
+
+session = requests.Session() # permet de conserver les cookies entre les requêtes pour rester connecté
+
+def login_to_wiki(username, password):
+    login_url = "https://wiki.intersel.fr/doku.php?id=start&do=login"
+    resp = session.get(login_url)
+    soup = BeautifulSoup(resp.text, "html.parser")
+    sectok_input = soup.find("input", {"name": "sectok"})
+
+    if not sectok_input:
+        print("❌ Impossible de trouver le token CSRF.")
+        return False
+
+    login_data = {
+        "u": username,
+        "p": password,
+        "do": "login",
+        "sectok": sectok_input.get("value")
+    }
+
+    headers = {
+        "User-Agent": "Mozilla/5.0",
+        "Referer": login_url
+    }
+
+    login_resp = session.post(login_url, data=login_data, headers=headers)
+
+    if "logout" in login_resp.text.lower():
+        print("✅ Connexion réussie.")
+        return True
+    else:
+        print("❌ Échec de la connexion.")
+        return False

+ 86 - 0
src/agent_ai/chunking.py

@@ -0,0 +1,86 @@
+from sentence_transformers import SentenceTransformer
+from sklearn.metrics.pairwise import cosine_similarity
+import nltk
+import tiktoken
+import numpy as np
+from typing import List
+
+nltk.download('punkt')
+
+tokenizer = tiktoken.get_encoding("cl100k_base")
+model = SentenceTransformer('sentence-transformers/all-MiniLM-L6-v2', trust_remote_code=True)
+
+MAX_TOKENS = 350
+CHUNK_OVERLAP = 50
+SIMILARITY_THRESHOLD = 0.75  # adjust as needed
+
+def tokenize_text(text):
+    return tokenizer.encode(text)
+
+def count_tokens(text):
+    return len(tokenize_text(text))
+
+def embed_sentences(sentences: List[str]):
+    return model.encode(sentences)
+
+def semantic_chunking(text: str, max_tokens=MAX_TOKENS, overlap=CHUNK_OVERLAP, with_metadata=True) -> List[dict]:
+    sentences = nltk.sent_tokenize(text)
+    embeddings = embed_sentences(sentences)
+    chunks = []
+    current_chunk = []
+    current_tokens = 0
+    chunk_id = 0
+
+    for i in range(len(sentences)):
+        sent = sentences[i]
+        sent_tokens = count_tokens(sent)
+        sent_embedding = embeddings[i]
+
+        if not current_chunk:
+            current_chunk.append(sent)
+            current_tokens += sent_tokens
+            continue
+
+        # Compute similarity to previous sentence in chunk
+        prev_embedding = embed_sentences([" ".join(current_chunk)])[-1]
+        similarity = cosine_similarity([sent_embedding], [prev_embedding])[0][0]
+
+        if similarity >= SIMILARITY_THRESHOLD and current_tokens + sent_tokens <= max_tokens:
+            current_chunk.append(sent)
+            current_tokens += sent_tokens
+        else:
+            chunk_text = " ".join(current_chunk)
+            if with_metadata:
+                chunks.append({
+                    "chunk_id": chunk_id,
+                    "text": chunk_text,
+                    "word_count": len(chunk_text.split()),
+                    "token_count": current_tokens
+                })
+            else:
+                chunks.append(chunk_text)
+            chunk_id += 1
+
+            # Create overlapping window
+            overlap_chunk = current_chunk[-1:] if overlap > 0 else []
+            current_chunk = overlap_chunk.copy()
+            current_tokens = sum(count_tokens(s) for s in current_chunk)
+
+            # Add the new sentence to start a new chunk
+            current_chunk.append(sent)
+            current_tokens += sent_tokens
+
+    # Final chunk
+    if current_chunk:
+        chunk_text = " ".join(current_chunk)
+        if with_metadata:
+            chunks.append({
+                "chunk_id": chunk_id,
+                "text": chunk_text,
+                "word_count": len(chunk_text.split()),
+                "token_count": current_tokens
+            })
+        else:
+            chunks.append(chunk_text)
+
+    return chunks

+ 192 - 0
src/agent_ai/scraping.py

@@ -0,0 +1,192 @@
+from bs4 import BeautifulSoup
+from src.agent_ai.auth import session
+from urllib.parse import urljoin, urlparse
+import time
+import hashlib
+import json
+import random
+from concurrent.futures import ThreadPoolExecutor, as_completed
+import os
+
+# 🧭 Config
+BASE_URL = "https://wiki.intersel.fr/"
+USER_AGENTS = [
+    "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/115.0.0.0 Safari/537.36"
+]
+MAX_PAGES = 500
+
+def random_headers():
+    return {
+        "User-Agent": random.choice(USER_AGENTS)
+    }
+
+def hash_text(text):
+    return hashlib.md5(text.encode("utf-8")).hexdigest()
+
+def fetch_single_page(url, old_hashes):
+    try:
+        headers = random_headers()
+        edit_url = url + "&do=edit" if "?" in url else url + "?do=edit"
+        response = session.get(edit_url, headers=headers, timeout=10)
+
+        if response.status_code != 200:
+            return url, None, None
+
+        response.encoding = 'utf-8'
+
+        if "text/html" not in response.headers.get("Content-Type", ""):
+            return url, None, None
+
+        soup = BeautifulSoup(response.text, "html.parser")
+        textarea = soup.find("textarea", {"name": "wikitext"})
+
+        if textarea:
+            raw_text = textarea.get_text(separator="\n").strip()
+            current_hash = hash_text(raw_text)
+
+            if old_hashes.get(url) != current_hash:
+                print(f"🆕 Modifiée : {url}")
+                return url, raw_text, current_hash
+            else:
+                print(f"✅ Inchangée : {url}")
+        else:
+            print(f"⚠️ Pas de <textarea> pour {url}")
+    except Exception as e:
+        print(f"❌ Erreur pour {url}: {e}")
+
+    time.sleep(random.uniform(0.5, 2))
+    return url, None, None
+
+def fetch_all_pages_content(urls, old_hashes):
+    url_texts = {}
+    new_hashes = {}
+
+    with ThreadPoolExecutor(max_workers=2) as executor:
+        futures = [executor.submit(fetch_single_page, url, old_hashes) for url in urls]
+
+        for future in as_completed(futures):
+            url, text, current_hash = future.result()
+            if text:
+                url_texts[url] = text
+                new_hashes[url] = current_hash
+            elif current_hash:
+                new_hashes[url] = current_hash
+
+    return url_texts, new_hashes
+
+def is_valid_wiki_url(url):
+    parsed = urlparse(url)
+    return (
+        parsed.netloc == "wiki.intersel.fr"
+        and "do=" not in parsed.query
+        and not url.endswith((".jpg", ".png", ".pdf", ".docx", ".xlsx"))
+        and "#" not in url
+    )
+
+def crawl_wiki(start_url, existing_urls):
+    visited = set(existing_urls)
+    to_visit = [start_url]
+
+    while to_visit and len(visited) < MAX_PAGES:
+        current_url = to_visit.pop(0)
+        if current_url in visited:
+            continue
+
+        print(f"🔎 Visiting: {current_url}")
+        visited.add(current_url)
+
+        try:
+            headers = random_headers()
+            response = session.get(current_url, headers=headers, timeout=10)
+            if response.status_code != 200:
+                continue
+
+            soup = BeautifulSoup(response.text, "html.parser")
+
+            for link in soup.find_all("a", href=True):
+                absolute_url = urljoin(current_url, link["href"])
+                if (
+                    is_valid_wiki_url(absolute_url)
+                    and absolute_url not in visited
+                    and absolute_url not in to_visit
+                ):
+                    to_visit.append(absolute_url)
+
+            time.sleep(random.uniform(1, 2))
+
+            if len(visited) >= MAX_PAGES:
+                break
+
+        except Exception as e:
+            print(f"❌ Error with {current_url}: {e}")
+
+    return list(visited)
+
+def scrape_pages():
+    start_url = BASE_URL
+    urls_path = os.path.join("data", "urls.json")
+    raw_pages_path = "data/raw_pages.json"
+    hashes_path = "data/page_hashes.json"
+
+    # Charger anciens hashs
+    try:
+        with open(hashes_path, "r", encoding="utf-8") as f:
+            old_hashes = json.load(f)
+    except FileNotFoundError:
+        old_hashes = {}
+
+    # Charger anciennes URLs
+    try:
+        with open(urls_path, "r", encoding="utf-8") as f:
+            urls = json.load(f)
+        print("✅ URLs chargées depuis urls.json")
+    except FileNotFoundError:
+        print("🚀 Crawling initial du wiki")
+        urls = []
+
+    # Nouveau crawl
+    crawled_urls = crawl_wiki(start_url, urls)
+    all_urls = sorted(set(urls + crawled_urls))[:MAX_PAGES]
+
+    print(f"🌐 Total URLs à vérifier : {len(all_urls)}")
+
+    # Scraping des pages
+    pages, new_hashes = fetch_all_pages_content(all_urls, old_hashes)
+
+    # Charger anciens raw_pages
+    try:
+        with open(raw_pages_path, "r", encoding="utf-8") as f:
+            old_raw_pages = {p["url"]: p["text"] for p in json.load(f)}
+    except FileNotFoundError:
+        old_raw_pages = {}
+
+    # Mettre à jour uniquement les pages modifiées
+    for url, text in pages.items():
+        old_raw_pages[url] = text
+
+    # Nettoyer (facultatif)
+    cleaned_raw_pages = {url: text for url, text in old_raw_pages.items() if url in all_urls}
+
+    # Sauvegarder le contenu
+    os.makedirs("data", exist_ok=True)
+
+    with open(raw_pages_path, "w", encoding="utf-8") as f:
+        json.dump(
+            [{"url": url, "text": text} for url, text in cleaned_raw_pages.items()],
+            f, ensure_ascii=False, indent=2
+        )
+
+    with open(hashes_path, "w", encoding="utf-8") as f:
+        json.dump(new_hashes, f, ensure_ascii=False, indent=2)
+
+    with open(urls_path, "w", encoding="utf-8") as f:
+        json.dump(all_urls, f, ensure_ascii=False, indent=2)
+
+    print("📄 Pages modifiées sauvegardées")
+    print("📄 Contenu brut mis à jour enregistré dans 'raw_pages.json'")
+    print("🔗 URLs enregistrées dans 'data/urls.json'")
+    print("🔐 Hashes des pages enregistrés dans 'page_hashes.json'")
+
+    return [{"url": url, "text": text} for url, text in cleaned_raw_pages.items()]
+
+

+ 0 - 0
src/api/__init__.py


+ 490 - 0
src/app.py

@@ -0,0 +1,490 @@
+from dotenv import load_dotenv
+import os
+
+from flask import Flask, request, jsonify, render_template
+from apscheduler.schedulers.background import BackgroundScheduler
+from sentence_transformers import CrossEncoder, SentenceTransformer
+from langchain_ollama import OllamaLLM
+from .utils.processing import full_update_pipeline
+from .agent_ai.auth import login_to_wiki
+import json
+import numpy as np
+import textwrap
+from sklearn.metrics.pairwise import cosine_similarity
+from tabulate import tabulate
+import os
+from serpapi import GoogleSearch
+from werkzeug.utils import secure_filename
+import PyPDF2
+from PIL import Image
+from transformers import AutoTokenizer
+from .utils.ocr import run_ocr, generate_html , generate_word_level_html  
+import tiktoken
+from .models.VLM import ask_blip
+import getpass
+import faiss
+from langchain_huggingface import HuggingFaceEndpointEmbeddings
+import traceback
+from transformers import AutoTokenizer
+import getpass
+import requests
+from openai import OpenAI
+import traceback
+#from utils.security import advanced_security_check, log_suspicious_query, send_security_alert
+
+load_dotenv(override=True)
+
+
+app = Flask(__name__)
+
+
+def get_embedding_function():
+    return HuggingFaceEndpointEmbeddings(
+        model="sentence-transformers/all-MiniLM-L6-v2",  
+        task="feature-extraction"    )
+
+
+# Clé d'API Scaleway
+api_key = os.getenv("SCW_API_KEY")
+
+# Vérification de la clé
+if not api_key:
+    print("❌ La clé API est manquante.")
+else:
+    print("✅ Clé API chargée avec succès.")
+
+# Initialisation du client Scaleway
+client = OpenAI(
+    api_key=api_key,
+    base_url='https://api.scaleway.ai/v1'  # Base URL Scaleway
+)
+
+
+def call_scaleway_llama3(prompt, model="llama-3.3-70b-instruct", temperature=0.5, top_p=0.95, max_tokens=800):
+    try:
+        completion = client.chat.completions.create(
+            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
+        )
+        return completion.choices[0].message.content
+    except Exception as e:
+        print("🔴 Erreur lors de l'appel à l'API Scaleway :", e)
+        traceback.print_exc()  
+        return "Erreur : Impossible d'obtenir une réponse du modèle."
+
+
+'''
+def call_ollama_llama3(prompt, model="llama3", temperature=0.3, top_p=0.9, max_tokens=600):
+    try:
+        url = f"http://{ollama_host}/api/generate" if ollama_host else "http://localhost:11434/api/generate"
+        response = requests.post(
+            url,
+            json={
+                'model': model,
+                'prompt': prompt,
+                'temperature': temperature,
+                'top_p': top_p,
+                'max_tokens': max_tokens,
+                'stream': False
+            }
+        )
+        for line in response.iter_lines():
+            if line:
+                print(line.decode())
+        response.raise_for_status()
+        return response.json()['response']
+    except requests.exceptions.RequestException as e:
+        print("🔴 Error calling Ollama API:", e)
+        return "Erreur : Impossible d'obtenir une réponse du modèle."
+'''
+state = {
+    "index": None,
+    "all_chunks": [],
+    "chunk_urls": [],
+    "all_embeddings": None,
+    "embedding_model": get_embedding_function(),
+    "cross_encoder": CrossEncoder("cross-encoder/ms-marco-MiniLM-L-6-v2"),
+    "is_updating": False,
+    "llm": "llama-3.3-70b-instruct",
+    "chat_history": [],
+    "top_k": 20,
+    "rerank_k": 10
+}
+
+@app.route('/')
+def home():
+    return render_template('index.html')
+
+@app.route("/login", methods=["POST"])
+def login():
+    data = request.json
+    username = data.get("username")
+    password = data.get("password")
+
+    if not username or not password:
+        return jsonify({"error": "username and password required"}), 400
+
+    if not login_to_wiki(username, password):
+        return jsonify({"error": "Authentication failed"}), 401
+
+    return jsonify({"message": "Login successful"})
+
+@app.route("/chat_history", methods=["GET"])
+def chat_history():
+    return jsonify(state["chat_history"])
+
+def load_index_and_chunks():
+    base_path = os.path.dirname(os.path.abspath(__file__))
+    data_path = os.path.join(base_path, "data")
+    chunk_path = os.path.join(data_path, "All_chunks.json")
+    index_path = os.path.join(data_path, "faiss_index.index")
+
+    chunk_exists = os.path.exists(chunk_path)
+    index_exists = os.path.exists(index_path)
+
+    if chunk_exists:
+        print("✅ Fichier All_chunks.json trouvé.")
+    else:
+        print("❌ Fichier All_chunks.json manquant.")
+
+    if index_exists:
+        print("✅ Fichier faiss_index.index trouvé.")
+    else:
+        print("❌ Fichier faiss_index.index manquant.")
+
+    # Si les deux fichiers existent, charger directement
+    if chunk_exists and index_exists:
+        with open(chunk_path, "r", encoding="utf-8") as f:
+            state["all_chunks"] = json.load(f)
+        state["index"] = faiss.read_index(index_path)
+        print(f"✅ Chunks chargés : {len(state['all_chunks'])}")
+        return
+
+    # Sinon, lancer la mise à jour
+    print("⚠️ Index ou chunks manquants — lancement du scraping complet...")
+    run_full_update()  # Cette fonction doit générer les deux fichiers correctement
+
+    # Recharger après génération
+    if os.path.exists(chunk_path) and os.path.exists(index_path):
+        with open(chunk_path, "r", encoding="utf-8") as f:
+            state["all_chunks"] = json.load(f)
+        state["index"] = faiss.read_index(index_path)
+        print(f"✅ Index et chunks rechargés après mise à jour : {len(state['all_chunks'])} chunks.")
+    else:
+        print("❌ Les fichiers n'ont pas été générés correctement après mise à jour.")
+        state["index"] = None
+        state["all_chunks"] = []
+
+        
+def run_full_update():
+    print("🔄 Lancement du pipeline via le scheduler...")
+    full_update_pipeline()
+
+
+tokenizer = AutoTokenizer.from_pretrained("bert-base-uncased")
+
+def chunk_text(text, chunk_size=400, overlap=100):
+    tokens = tokenizer.encode(text, add_special_tokens=False)  # Pas d’[CLS], [SEP]
+    chunks = []
+    step = chunk_size - overlap
+    for i in range(0, len(tokens), step):
+        chunk_tokens = tokens[i:i + chunk_size]
+        chunk_text = tokenizer.decode(chunk_tokens, skip_special_tokens=True)
+        chunks.append(chunk_text)
+        if i + chunk_size >= len(tokens):
+            break
+    return chunks
+
+
+
+UPLOAD_FOLDER = "uploads"
+os.makedirs(UPLOAD_FOLDER, exist_ok=True)  
+app.config["UPLOAD_FOLDER"] = UPLOAD_FOLDER
+
+ALLOWED_EXTENSIONS = {'txt', 'pdf', 'png', 'jpg', 'jpeg'}
+
+def allowed_file(filename):
+    return '.' in filename and filename.rsplit('.', 1)[1].lower() in ALLOWED_EXTENSIONS
+
+@app.route("/upload_file", methods=["POST"])
+def upload_file():
+    if 'file' not in request.files:
+        return jsonify({"error": "Aucun fichier détecté."}), 400
+
+    file = request.files['file']
+    if file.filename == '':
+        return jsonify({"error": "Nom de fichier vide."}), 400
+
+    if file and allowed_file(file.filename):
+        filename = secure_filename(file.filename)
+        filepath = os.path.join(app.config['UPLOAD_FOLDER'], filename)
+        file.save(filepath)
+
+        question = request.form.get("question", "")
+        if not question:
+            return jsonify({"error": "Veuillez poser une question liée au fichier."}), 400
+
+        try:
+            # ✅ 1. Exécuter l'OCR
+            document, ocr_output = run_ocr(filepath)
+
+            # ✅ 2. Sauvegarder le JSON OCR
+            json_path = os.path.join(app.config['UPLOAD_FOLDER'], "ocr_output.json")
+            with open(json_path, "w", encoding="utf-8") as fjson:
+                json.dump(ocr_output, fjson, ensure_ascii=False, indent=2)
+
+            # ✅ 3. Générer le HTML avec bounding boxes par mot
+            html_path = os.path.join(app.config['UPLOAD_FOLDER'], "ocr_output_words.html")
+            generate_word_level_html(ocr_output, output_html_path=html_path)
+
+            # ✅ 4. Extraire le texte brut pour le traitement RAG
+            text = ""
+            for page in ocr_output['pages']:
+                for block in page['blocks']:
+                    for line in block['lines']:
+                        for word in line['words']:
+                            text += word['value'] + " "
+                        text += "\n"
+                    text += "\n"
+                text += "\n"
+
+        except Exception as e:
+            return jsonify({"error": f"OCR échoué : {str(e)}"}), 500
+
+        if text.strip():
+            chunks = chunk_text(text)
+            embedding_model = state["embedding_model"]
+
+            # embeddings de tous les chunks (liste de vecteurs)
+            embeddings = embedding_model.embed_documents(chunks)
+
+            # embedding de la question
+            question_embedding = embedding_model.embed_query(question)
+
+            # calcul similarité cosine
+            similarities = cosine_similarity([question_embedding], embeddings)[0]
+
+            # récupérer top 5 indices les plus similaires
+            top_indices = np.argsort(similarities)[::-1][:5]
+            top_chunks = [chunks[i] for i in top_indices]
+
+            # contexte final concaténé
+            top_context = "\n\n".join(top_chunks)
+
+            prompt = (
+                "Réponds en français à la question suivante en utilisant uniquement le contenu fourni. "
+                "Si la réponse est absente, dis-le clairement.\n\n"
+                f"{top_context}\n\nQuestion : {question}"
+            )
+
+            answer = call_scaleway_llama3(prompt)
+
+            return jsonify({
+                "answer": answer,
+                "html_file": f"uploads/ocr_output_words.html"
+            })
+
+        else:
+            try:
+                answer = ask_blip(filepath, question)
+                return jsonify({"answer": answer})
+            except Exception as e:
+                return jsonify({"error": f"LLaVA échoué : {str(e)}"}), 500
+
+    return jsonify({"error": "Format de fichier non supporté."}), 400
+
+@app.route("/delete_file", methods=["POST"])
+def delete_file():
+    data = request.get_json()
+    filename = data.get("filename")
+
+    if not filename:
+        return jsonify({"error": "Nom de fichier manquant."}), 400
+
+    filepath = os.path.join(app.config["UPLOAD_FOLDER"], secure_filename(filename))
+
+    if os.path.exists(filepath):
+        os.remove(filepath)
+        return jsonify({"message": "Fichier supprimé avec succès."})
+    else:
+        return jsonify({"error": "Fichier introuvable."}), 404
+
+
+@app.route("/qa_chain", methods=["POST"])
+def qa_chain():
+    if not state.get("embedding_model") or not state.get("llm"):
+        return jsonify({"error": "Modèles non chargés."}), 500
+
+    data = request.get_json()
+    question = str(data.get("query", "")).strip()
+
+    if not question:
+        return jsonify({"error": "Question vide."}), 400
+
+    try:
+        chunk_texts = []
+        for i, chunk in enumerate(state["all_chunks"]):
+            if isinstance(chunk, dict):
+                text = chunk.get("text", "")
+                if text:
+                    chunk_texts.append(text)
+                else:
+                    return jsonify({"error": f"Chunk vide à l'index {i}."}), 500
+            elif isinstance(chunk, str):
+                chunk_texts.append(chunk)
+            else:
+                return jsonify({"error": f"Chunk invalide à l'index {i}."}), 500
+
+        embedding_model = state["embedding_model"]
+        question_embedding = embedding_model.embed_query(question)
+        chunk_embeddings = embedding_model.embed_documents(chunk_texts)
+
+        if question_embedding is None or not isinstance(chunk_embeddings, list) or len(chunk_embeddings) == 0:
+            return jsonify({"error": "Les embeddings sont vides ou mal formatés."}), 500
+
+        similarities = cosine_similarity([question_embedding], chunk_embeddings)[0]
+
+        try:
+            rerank_k_value = int(state.get("rerank_k", 20))
+        except (ValueError, TypeError):
+            rerank_k_value = 20
+
+        top_indices = similarities.argsort()[-rerank_k_value:][::-1]
+
+        # Création d'une liste de tuples (chunk, index, score)
+        reranked_chunks = [(chunk_texts[i], i, similarities[i]) for i in top_indices]
+
+        table = []
+        top_chunks = []
+        for rank, (chunk, idx, score) in enumerate(reranked_chunks):
+            url = state["chunk_urls"][idx] if idx < len(state["chunk_urls"]) else "URL inconnue"
+            wrapped_chunk = "\n".join(textwrap.wrap(chunk.strip(), width=80))[:500] + "..."
+            wrapped_url = "\n".join(textwrap.wrap(url, width=80))           
+            tokenizer = AutoTokenizer.from_pretrained("gpt2")  
+            num_tokens = len(tokenizer.encode(chunk))
+            table.append([rank, round(score, 4), num_tokens, wrapped_chunk, wrapped_url])
+            top_chunks.append(chunk)
+            top_context = "\n\n".join(top_chunks)
+
+        print("\n================== RÉSULTATS CLASSÉS PAR PERTINENCE ==================")
+        print(tabulate(table, headers=["Rank", "Score", "Tokens", "Chunk", "URL"], tablefmt="fancy_grid"))
+        print("=======================================================================\n")
+
+        
+        prompt = (
+        "Fournis une réponse factuelle, précise et compléte en français en te basant uniquement sur le contexte fourni. "
+        "Si tu n'es pas certain de la réponse ou si les données sont ambiguës, indique clairement que l'information n'est pas disponible ou nécessite une vérification. "
+        "Ne fais aucune supposition ou inférence qui pourrait être incorrecte, et précise les sources utilisées lorsque possible.\n\n"
+        f"{top_context}\n\n"
+        f"Question : {question}"
+    )
+
+        answer = call_scaleway_llama3(prompt)
+
+        print("\n====================== PROMPT UTILISÉ ======================")
+        print(f"CONTEXTE :\n{top_context}\nQUESTION :\n{question}\nRÉPONSE :\n{answer}")
+        print("============================================================\n")
+
+
+        # Detect no good answer from RAG
+        if not answer or "Information non disponible" in answer or len(answer.strip()) < 10:
+            raise ValueError("Pas de réponse fiable, fallback vers SerpAPI.")
+
+        state["chat_history"].append({"query": question, "answer": answer})
+        return jsonify({"answer": answer})
+
+    except Exception as rag_error:
+        print("Erreur RAG:", rag_error)
+        # Fallback to SerpAPI
+      
+        #  ÉTAPE 2 : Fallback vers recherche web (SerpAPI) 
+        try:
+            params = {
+                "engine": "google",
+                "q": question,
+                "api_key": os.getenv("SERPAPI_API_KEY"),
+            }
+            search = GoogleSearch(params)
+            results = search.get_dict()
+
+            answer = None
+            if "answer_box" in results and "answer" in results["answer_box"]:
+                answer = results["answer_box"]["answer"]
+            elif "organic_results" in results and results["organic_results"]:
+                answer = results["organic_results"][0].get("snippet")
+
+            if not answer:
+                answer = "Information non disponible."
+
+            # Summarize or filter with LLM if available
+            if state.get("llm"):
+                prompt = (
+                    "Réponds uniquement à la question de manière directe et concise.\n"
+                    "Sans reformuler la question, sans phrase d’introduction, sans politesse et sans contenu promotionnel. "
+                    "Utilise uniquement les faits du texte ci-dessous. "
+                    "Si l’information n’est pas présente, réponds : 'Information non disponible.'\n\n"
+                    f"Texte : {answer}\n\n"
+                    f"Question : {question}"
+                )
+                try:
+                    answer = call_scaleway_llama3(prompt).strip()
+                except Exception as llm_error:
+                    print("[Erreur LLM sur reformulation] :", llm_error)
+
+            state["chat_history"].append({
+                "question": question,
+                "answer": answer,
+                "sources": ["Google Search"]
+            })
+
+            return jsonify({
+                "answer": answer,
+                "sources": ["Google Search"]
+            })
+
+        except Exception as e:
+            return jsonify({"error": f"Erreur SerpAPI : {str(e)}"}), 500
+
+
+
+# Scheduler
+scheduler = BackgroundScheduler()
+scheduler.add_job(run_full_update, 'interval', hours=5)
+print("🔁 Scheduler activé pour mises à jour toutes les 5h")
+
+def prompt_for_login():
+    print("🔐 Please log in to the Wiki before starting the app.")
+    while True:
+        username = input("Username: ")
+        password = getpass.getpass("Password: ")
+        if login_to_wiki(username, password):
+            print("Login successful, starting the app...")
+            break
+        else:
+            print("Login failed, please try again.\n")
+
+basedir = os.path.abspath(os.path.dirname(__file__))
+load_dotenv(os.path.join(basedir, '.env'))
+def auto_login():
+    username = os.getenv("WIKI_USERNAME")
+    password = os.getenv("WIKI_PASSWORD")
+
+    if not username or not password:
+        raise ValueError("Missing WIKI_USERNAME or WIKI_PASSWORD in the .env file")
+
+    if login_to_wiki(username, password):
+        print("✅ Auto login successful.")
+    else:
+        raise Exception("❌ Auto login failed. Please check your credentials.")
+
+
+if __name__ == "__main__":
+    auto_login()
+    load_index_and_chunks()
+    scheduler.start()
+    app.run(debug=True)

Dosya farkı çok büyük olduğundan ihmal edildi
+ 10 - 0
src/data/All_chunks.json


BIN
src/data/faiss_index.index


+ 1 - 0
src/data/page_hashes.json

@@ -0,0 +1 @@
+{}

Dosya farkı çok büyük olduğundan ihmal edildi
+ 3 - 0
src/data/raw_pages.json


+ 438 - 0
src/data/urls.json

@@ -0,0 +1,438 @@
+[
+  "https://wiki.intersel.fr/",
+  "https://wiki.intersel.fr/doku.php?id=dossiers_thematiques:https_et_ssl",
+  "https://wiki.intersel.fr/doku.php?id=dossiers_thematiques:poste_pc:reparation_pc",
+  "https://wiki.intersel.fr/doku.php?id=dossiers_thematiques:produit:e-marketing:dossier_luxe",
+  "https://wiki.intersel.fr/doku.php?id=dossiers_thematiques:reseaux_sociaux",
+  "https://wiki.intersel.fr/doku.php?id=glossaire:a",
+  "https://wiki.intersel.fr/doku.php?id=glossaire:a:accountable",
+  "https://wiki.intersel.fr/doku.php?id=glossaire:a:acl",
+  "https://wiki.intersel.fr/doku.php?id=glossaire:a:adresse_ip",
+  "https://wiki.intersel.fr/doku.php?id=glossaire:a:adu",
+  "https://wiki.intersel.fr/doku.php?id=glossaire:a:agent",
+  "https://wiki.intersel.fr/doku.php?id=glossaire:a:ant",
+  "https://wiki.intersel.fr/doku.php?id=glossaire:a:archiving",
+  "https://wiki.intersel.fr/doku.php?id=glossaire:a:az",
+  "https://wiki.intersel.fr/doku.php?id=glossaire:b",
+  "https://wiki.intersel.fr/doku.php?id=glossaire:b:back_office",
+  "https://wiki.intersel.fr/doku.php?id=glossaire:b:backup",
+  "https://wiki.intersel.fr/doku.php?id=glossaire:b:bert",
+  "https://wiki.intersel.fr/doku.php?id=glossaire:b:bien",
+  "https://wiki.intersel.fr/doku.php?id=glossaire:b:brm",
+  "https://wiki.intersel.fr/doku.php?id=glossaire:b:but",
+  "https://wiki.intersel.fr/doku.php?id=glossaire:c",
+  "https://wiki.intersel.fr/doku.php?id=glossaire:c:cab",
+  "https://wiki.intersel.fr/doku.php?id=glossaire:c:cd",
+  "https://wiki.intersel.fr/doku.php?id=glossaire:c:ceb",
+  "https://wiki.intersel.fr/doku.php?id=glossaire:c:change",
+  "https://wiki.intersel.fr/doku.php?id=glossaire:c:change_management",
+  "https://wiki.intersel.fr/doku.php?id=glossaire:c:chapeaux_de_bono",
+  "https://wiki.intersel.fr/doku.php?id=glossaire:c:charm",
+  "https://wiki.intersel.fr/doku.php?id=glossaire:c:ci",
+  "https://wiki.intersel.fr/doku.php?id=glossaire:c:ci_cd",
+  "https://wiki.intersel.fr/doku.php?id=glossaire:c:client_leger",
+  "https://wiki.intersel.fr/doku.php?id=glossaire:c:client_lourd",
+  "https://wiki.intersel.fr/doku.php?id=glossaire:c:cloud",
+  "https://wiki.intersel.fr/doku.php?id=glossaire:c:cluster",
+  "https://wiki.intersel.fr/doku.php?id=glossaire:c:cmdb",
+  "https://wiki.intersel.fr/doku.php?id=glossaire:c:cmis",
+  "https://wiki.intersel.fr/doku.php?id=glossaire:c:cmmi",
+  "https://wiki.intersel.fr/doku.php?id=glossaire:c:cmp",
+  "https://wiki.intersel.fr/doku.php?id=glossaire:c:cms",
+  "https://wiki.intersel.fr/doku.php?id=glossaire:c:cobit",
+  "https://wiki.intersel.fr/doku.php?id=glossaire:c:confidential_information",
+  "https://wiki.intersel.fr/doku.php?id=glossaire:c:consulted",
+  "https://wiki.intersel.fr/doku.php?id=glossaire:c:conteneur",
+  "https://wiki.intersel.fr/doku.php?id=glossaire:c:conteneurisation",
+  "https://wiki.intersel.fr/doku.php?id=glossaire:c:copywriter",
+  "https://wiki.intersel.fr/doku.php?id=glossaire:c:copywriting",
+  "https://wiki.intersel.fr/doku.php?id=glossaire:c:corrective_action",
+  "https://wiki.intersel.fr/doku.php?id=glossaire:c:crm",
+  "https://wiki.intersel.fr/doku.php?id=glossaire:c:cross-site_scripting_xss",
+  "https://wiki.intersel.fr/doku.php?id=glossaire:c:cso",
+  "https://wiki.intersel.fr/doku.php?id=glossaire:c:css",
+  "https://wiki.intersel.fr/doku.php?id=glossaire:d",
+  "https://wiki.intersel.fr/doku.php?id=glossaire:d:db",
+  "https://wiki.intersel.fr/doku.php?id=glossaire:d:demand_management",
+  "https://wiki.intersel.fr/doku.php?id=glossaire:d:developpeur_web",
+  "https://wiki.intersel.fr/doku.php?id=glossaire:d:dfs",
+  "https://wiki.intersel.fr/doku.php?id=glossaire:d:dkim",
+  "https://wiki.intersel.fr/doku.php?id=glossaire:d:dmarc",
+  "https://wiki.intersel.fr/doku.php?id=glossaire:d:dns",
+  "https://wiki.intersel.fr/doku.php?id=glossaire:d:docker",
+  "https://wiki.intersel.fr/doku.php?id=glossaire:d:document",
+  "https://wiki.intersel.fr/doku.php?id=glossaire:d:downtime",
+  "https://wiki.intersel.fr/doku.php?id=glossaire:e",
+  "https://wiki.intersel.fr/doku.php?id=glossaire:e:edi",
+  "https://wiki.intersel.fr/doku.php?id=glossaire:e:elevation_des_privileges",
+  "https://wiki.intersel.fr/doku.php?id=glossaire:e:emotion",
+  "https://wiki.intersel.fr/doku.php?id=glossaire:e:etl",
+  "https://wiki.intersel.fr/doku.php?id=glossaire:e:evolution_cms",
+  "https://wiki.intersel.fr/doku.php?id=glossaire:e:extranet",
+  "https://wiki.intersel.fr/doku.php?id=glossaire:f",
+  "https://wiki.intersel.fr/doku.php?id=glossaire:f:fai",
+  "https://wiki.intersel.fr/doku.php?id=glossaire:f:fbl",
+  "https://wiki.intersel.fr/doku.php?id=glossaire:f:fqdn",
+  "https://wiki.intersel.fr/doku.php?id=glossaire:f:front_office",
+  "https://wiki.intersel.fr/doku.php?id=glossaire:f:frontend",
+  "https://wiki.intersel.fr/doku.php?id=glossaire:g",
+  "https://wiki.intersel.fr/doku.php?id=glossaire:g:gti",
+  "https://wiki.intersel.fr/doku.php?id=glossaire:g:gtm",
+  "https://wiki.intersel.fr/doku.php?id=glossaire:g:gtr",
+  "https://wiki.intersel.fr/doku.php?id=glossaire:h",
+  "https://wiki.intersel.fr/doku.php?id=glossaire:h:hebergement",
+  "https://wiki.intersel.fr/doku.php?id=glossaire:h:hostname",
+  "https://wiki.intersel.fr/doku.php?id=glossaire:h:hr",
+  "https://wiki.intersel.fr/doku.php?id=glossaire:h:html",
+  "https://wiki.intersel.fr/doku.php?id=glossaire:h:hw",
+  "https://wiki.intersel.fr/doku.php?id=glossaire:i",
+  "https://wiki.intersel.fr/doku.php?id=glossaire:i:ihm",
+  "https://wiki.intersel.fr/doku.php?id=glossaire:i:information_system",
+  "https://wiki.intersel.fr/doku.php?id=glossaire:i:information_system_security",
+  "https://wiki.intersel.fr/doku.php?id=glossaire:i:informed",
+  "https://wiki.intersel.fr/doku.php?id=glossaire:i:injection_sql",
+  "https://wiki.intersel.fr/doku.php?id=glossaire:i:ip",
+  "https://wiki.intersel.fr/doku.php?id=glossaire:i:is",
+  "https://wiki.intersel.fr/doku.php?id=glossaire:i:isp",
+  "https://wiki.intersel.fr/doku.php?id=glossaire:i:it",
+  "https://wiki.intersel.fr/doku.php?id=glossaire:i:itil",
+  "https://wiki.intersel.fr/doku.php?id=glossaire:i:itscm",
+  "https://wiki.intersel.fr/doku.php?id=glossaire:j",
+  "https://wiki.intersel.fr/doku.php?id=glossaire:j:json",
+  "https://wiki.intersel.fr/doku.php?id=glossaire:k",
+  "https://wiki.intersel.fr/doku.php?id=glossaire:k:kpi",
+  "https://wiki.intersel.fr/doku.php?id=glossaire:k:kubelet",
+  "https://wiki.intersel.fr/doku.php?id=glossaire:k:kubernetes",
+  "https://wiki.intersel.fr/doku.php?id=glossaire:l",
+  "https://wiki.intersel.fr/doku.php?id=glossaire:l:intelligence_artificielle",
+  "https://wiki.intersel.fr/doku.php?id=glossaire:l:lamp",
+  "https://wiki.intersel.fr/doku.php?id=glossaire:l:lcid",
+  "https://wiki.intersel.fr/doku.php?id=glossaire:l:lessor",
+  "https://wiki.intersel.fr/doku.php?id=glossaire:m",
+  "https://wiki.intersel.fr/doku.php?id=glossaire:m:machine_virtuelle",
+  "https://wiki.intersel.fr/doku.php?id=glossaire:m:maintenance",
+  "https://wiki.intersel.fr/doku.php?id=glossaire:m:map",
+  "https://wiki.intersel.fr/doku.php?id=glossaire:m:modx",
+  "https://wiki.intersel.fr/doku.php?id=glossaire:m:moteur_de_conteneurs",
+  "https://wiki.intersel.fr/doku.php?id=glossaire:n",
+  "https://wiki.intersel.fr/doku.php?id=glossaire:n:nat",
+  "https://wiki.intersel.fr/doku.php?id=glossaire:n:nlp",
+  "https://wiki.intersel.fr/doku.php?id=glossaire:n:no_code",
+  "https://wiki.intersel.fr/doku.php?id=glossaire:n:node",
+  "https://wiki.intersel.fr/doku.php?id=glossaire:n:nsd",
+  "https://wiki.intersel.fr/doku.php?id=glossaire:o",
+  "https://wiki.intersel.fr/doku.php?id=glossaire:o:objectif",
+  "https://wiki.intersel.fr/doku.php?id=glossaire:o:okr",
+  "https://wiki.intersel.fr/doku.php?id=glossaire:o:ola",
+  "https://wiki.intersel.fr/doku.php?id=glossaire:o:one_page",
+  "https://wiki.intersel.fr/doku.php?id=glossaire:o:orchestration_de_conteneurs",
+  "https://wiki.intersel.fr/doku.php?id=glossaire:p",
+  "https://wiki.intersel.fr/doku.php?id=glossaire:p:php",
+  "https://wiki.intersel.fr/doku.php?id=glossaire:p:pl",
+  "https://wiki.intersel.fr/doku.php?id=glossaire:p:plan",
+  "https://wiki.intersel.fr/doku.php?id=glossaire:p:plan_de_taggage",
+  "https://wiki.intersel.fr/doku.php?id=glossaire:p:pm",
+  "https://wiki.intersel.fr/doku.php?id=glossaire:p:pmo",
+  "https://wiki.intersel.fr/doku.php?id=glossaire:p:pod",
+  "https://wiki.intersel.fr/doku.php?id=glossaire:p:pra",
+  "https://wiki.intersel.fr/doku.php?id=glossaire:p:preventive_action",
+  "https://wiki.intersel.fr/doku.php?id=glossaire:p:procedure",
+  "https://wiki.intersel.fr/doku.php?id=glossaire:p:process",
+  "https://wiki.intersel.fr/doku.php?id=glossaire:p:produit",
+  "https://wiki.intersel.fr/doku.php?id=glossaire:p:proposition_de_valeur",
+  "https://wiki.intersel.fr/doku.php?id=glossaire:p:proxy",
+  "https://wiki.intersel.fr/doku.php?id=glossaire:q",
+  "https://wiki.intersel.fr/doku.php?id=glossaire:q:qms",
+  "https://wiki.intersel.fr/doku.php?id=glossaire:q:quality_plan",
+  "https://wiki.intersel.fr/doku.php?id=glossaire:r",
+  "https://wiki.intersel.fr/doku.php?id=glossaire:r:raci",
+  "https://wiki.intersel.fr/doku.php?id=glossaire:r:rca",
+  "https://wiki.intersel.fr/doku.php?id=glossaire:r:rce",
+  "https://wiki.intersel.fr/doku.php?id=glossaire:r:resources",
+  "https://wiki.intersel.fr/doku.php?id=glossaire:r:responsible",
+  "https://wiki.intersel.fr/doku.php?id=glossaire:r:rest",
+  "https://wiki.intersel.fr/doku.php?id=glossaire:r:rfc",
+  "https://wiki.intersel.fr/doku.php?id=glossaire:s",
+  "https://wiki.intersel.fr/doku.php?id=glossaire:s:scd",
+  "https://wiki.intersel.fr/doku.php?id=glossaire:s:scm",
+  "https://wiki.intersel.fr/doku.php?id=glossaire:s:sdp",
+  "https://wiki.intersel.fr/doku.php?id=glossaire:s:secret_information",
+  "https://wiki.intersel.fr/doku.php?id=glossaire:s:sem",
+  "https://wiki.intersel.fr/doku.php?id=glossaire:s:serveur",
+  "https://wiki.intersel.fr/doku.php?id=glossaire:s:service",
+  "https://wiki.intersel.fr/doku.php?id=glossaire:s:service_transition",
+  "https://wiki.intersel.fr/doku.php?id=glossaire:s:si",
+  "https://wiki.intersel.fr/doku.php?id=glossaire:s:siem",
+  "https://wiki.intersel.fr/doku.php?id=glossaire:s:sim",
+  "https://wiki.intersel.fr/doku.php?id=glossaire:s:sip",
+  "https://wiki.intersel.fr/doku.php?id=glossaire:s:skms",
+  "https://wiki.intersel.fr/doku.php?id=glossaire:s:sla",
+  "https://wiki.intersel.fr/doku.php?id=glossaire:s:slm",
+  "https://wiki.intersel.fr/doku.php?id=glossaire:s:slp",
+  "https://wiki.intersel.fr/doku.php?id=glossaire:s:smart",
+  "https://wiki.intersel.fr/doku.php?id=glossaire:s:soa",
+  "https://wiki.intersel.fr/doku.php?id=glossaire:s:soar",
+  "https://wiki.intersel.fr/doku.php?id=glossaire:s:spm",
+  "https://wiki.intersel.fr/doku.php?id=glossaire:s:ssl",
+  "https://wiki.intersel.fr/doku.php?id=glossaire:s:storage",
+  "https://wiki.intersel.fr/doku.php?id=glossaire:s:sw",
+  "https://wiki.intersel.fr/doku.php?id=glossaire:start",
+  "https://wiki.intersel.fr/doku.php?id=glossaire:t",
+  "https://wiki.intersel.fr/doku.php?id=glossaire:t:tbd",
+  "https://wiki.intersel.fr/doku.php?id=glossaire:t:tma",
+  "https://wiki.intersel.fr/doku.php?id=glossaire:t:tmc",
+  "https://wiki.intersel.fr/doku.php?id=glossaire:t:tms",
+  "https://wiki.intersel.fr/doku.php?id=glossaire:t:top_secret_information",
+  "https://wiki.intersel.fr/doku.php?id=glossaire:tags",
+  "https://wiki.intersel.fr/doku.php?id=glossaire:u",
+  "https://wiki.intersel.fr/doku.php?id=glossaire:u:uat",
+  "https://wiki.intersel.fr/doku.php?id=glossaire:u:ueba",
+  "https://wiki.intersel.fr/doku.php?id=glossaire:u:uml",
+  "https://wiki.intersel.fr/doku.php?id=glossaire:u:uptime",
+  "https://wiki.intersel.fr/doku.php?id=glossaire:u:utm",
+  "https://wiki.intersel.fr/doku.php?id=glossaire:u:ux",
+  "https://wiki.intersel.fr/doku.php?id=glossaire:v",
+  "https://wiki.intersel.fr/doku.php?id=glossaire:v:vm",
+  "https://wiki.intersel.fr/doku.php?id=glossaire:v:vpn",
+  "https://wiki.intersel.fr/doku.php?id=glossaire:w",
+  "https://wiki.intersel.fr/doku.php?id=glossaire:w:waf",
+  "https://wiki.intersel.fr/doku.php?id=glossaire:w:web_services",
+  "https://wiki.intersel.fr/doku.php?id=glossaire:x",
+  "https://wiki.intersel.fr/doku.php?id=glossaire:x:xss",
+  "https://wiki.intersel.fr/doku.php?id=intersel:aides:aide_commande_mysql:generation_historisation_sql",
+  "https://wiki.intersel.fr/doku.php?id=intersel:aides:aide_integration_fckeditor",
+  "https://wiki.intersel.fr/doku.php?id=intersel:aides:aide_roundcube",
+  "https://wiki.intersel.fr/doku.php?id=intersel:aides:sites_internet_utiles",
+  "https://wiki.intersel.fr/doku.php?id=intersel:aides:start",
+  "https://wiki.intersel.fr/doku.php?id=intersel:aides:tutorials:git:start",
+  "https://wiki.intersel.fr/doku.php?id=intersel:divers:exemples_courriers:firewall",
+  "https://wiki.intersel.fr/doku.php?id=intersel:divers:exemples_courriers:modifications_dns",
+  "https://wiki.intersel.fr/doku.php?id=intersel:divers:exemples_courriers:voeux",
+  "https://wiki.intersel.fr/doku.php?id=intersel:frontend_des_applications_de_suivi_et_de_gestion_des_projet",
+  "https://wiki.intersel.fr/doku.php?id=intersel:guides:entretiens:stagiaires",
+  "https://wiki.intersel.fr/doku.php?id=intersel:guides:guide_de_developpement_intersel:configurations_serveur_mail",
+  "https://wiki.intersel.fr/doku.php?id=intersel:guides:guide_de_developpement_intersel:cycle_de_developpement",
+  "https://wiki.intersel.fr/doku.php?id=intersel:guides:guide_de_developpement_intersel:finitions_hebergement",
+  "https://wiki.intersel.fr/doku.php?id=intersel:guides:guide_de_developpement_intersel:git:gogs:start",
+  "https://wiki.intersel.fr/doku.php?id=intersel:guides:guide_de_developpement_intersel:html5:start",
+  "https://wiki.intersel.fr/doku.php?id=intersel:guides:guide_de_developpement_intersel:internet",
+  "https://wiki.intersel.fr/doku.php?id=intersel:guides:guide_de_developpement_intersel:l_espace_projet",
+  "https://wiki.intersel.fr/doku.php?id=intersel:guides:guide_de_developpement_intersel:l_identification_documentaire_des_projets",
+  "https://wiki.intersel.fr/doku.php?id=intersel:guides:guide_de_developpement_intersel:la_conception_logicielle",
+  "https://wiki.intersel.fr/doku.php?id=intersel:guides:guide_de_developpement_intersel:la_conception_technique_d_une_newsletter",
+  "https://wiki.intersel.fr/doku.php?id=intersel:guides:guide_de_developpement_intersel:la_correction_d_une_anomalie",
+  "https://wiki.intersel.fr/doku.php?id=intersel:guides:guide_de_developpement_intersel:le_referencement_d_un_site_web",
+  "https://wiki.intersel.fr/doku.php?id=intersel:guides:guide_de_developpement_intersel:le_suivi_des_anomalies_sur_les_projets",
+  "https://wiki.intersel.fr/doku.php?id=intersel:guides:guide_de_developpement_intersel:le_versionnement_des_projets",
+  "https://wiki.intersel.fr/doku.php?id=intersel:guides:guide_de_developpement_intersel:les_finitions_d_un_site_web",
+  "https://wiki.intersel.fr/doku.php?id=intersel:guides:guide_de_developpement_intersel:les_logiciels",
+  "https://wiki.intersel.fr/doku.php?id=intersel:guides:guide_de_developpement_intersel:les_logiciels:phpmyadmin",
+  "https://wiki.intersel.fr/doku.php?id=intersel:guides:guide_de_developpement_intersel:pagemodele:complement_information",
+  "https://wiki.intersel.fr/doku.php?id=intersel:guides:guide_de_developpement_intersel:pagemodele:compterendu-reunion",
+  "https://wiki.intersel.fr/doku.php?id=intersel:guides:guide_de_developpement_intersel:pagemodele:conceptionlogicielle",
+  "https://wiki.intersel.fr/doku.php?id=intersel:guides:guide_de_developpement_intersel:pagemodele:configuration_emails",
+  "https://wiki.intersel.fr/doku.php?id=intersel:guides:guide_de_developpement_intersel:pagemodele:creation_email",
+  "https://wiki.intersel.fr/doku.php?id=intersel:guides:guide_de_developpement_intersel:pagemodele:creation_hebergement",
+  "https://wiki.intersel.fr/doku.php?id=intersel:guides:guide_de_developpement_intersel:pagemodele:demande_documents_startssl",
+  "https://wiki.intersel.fr/doku.php?id=intersel:guides:guide_de_developpement_intersel:pagemodele:document_standard",
+  "https://wiki.intersel.fr/doku.php?id=intersel:guides:guide_de_developpement_intersel:pagemodele:envoi_proposition",
+  "https://wiki.intersel.fr/doku.php?id=intersel:guides:guide_de_developpement_intersel:pagemodele:hebergement",
+  "https://wiki.intersel.fr/doku.php?id=intersel:guides:guide_de_developpement_intersel:pagemodele:homepage_projet",
+  "https://wiki.intersel.fr/doku.php?id=intersel:guides:guide_de_developpement_intersel:pagemodele:specificationlogiciel",
+  "https://wiki.intersel.fr/doku.php?id=intersel:guides:guide_de_developpement_intersel:specifications_logicielles",
+  "https://wiki.intersel.fr/doku.php?id=intersel:guides:guide_de_developpement_intersel:start",
+  "https://wiki.intersel.fr/doku.php?id=intersel:guides:liste_des_guides_d_aide",
+  "https://wiki.intersel.fr/doku.php?id=intersel:le_referentiel_qualite:accessibilite:start",
+  "https://wiki.intersel.fr/doku.php?id=intersel:le_referentiel_qualite:cdc:cahier_des_charges_v_aa",
+  "https://wiki.intersel.fr/doku.php?id=intersel:le_referentiel_qualite:cdc:cdc_pour_la_realisation_d_une_application_logicielle",
+  "https://wiki.intersel.fr/doku.php?id=intersel:le_referentiel_qualite:cgv_simplifiees",
+  "https://wiki.intersel.fr/doku.php?id=intersel:le_referentiel_qualite:cgv_site_web",
+  "https://wiki.intersel.fr/doku.php?id=intersel:le_referentiel_qualite:description_infogerance_standard",
+  "https://wiki.intersel.fr/doku.php?id=intersel:le_referentiel_qualite:gestion_demandes_client:gestion_de_la_relation_client",
+  "https://wiki.intersel.fr/doku.php?id=intersel:le_referentiel_qualite:la_gestion_des_demandes_client",
+  "https://wiki.intersel.fr/doku.php?id=intersel:le_referentiel_qualite:modeles_des_documents",
+  "https://wiki.intersel.fr/doku.php?id=intersel:le_referentiel_qualite:modeles_des_documents:accord_confidentialite",
+  "https://wiki.intersel.fr/doku.php?id=intersel:le_referentiel_qualite:modeles_des_documents:accord_confidentialite_fournisseur",
+  "https://wiki.intersel.fr/doku.php?id=intersel:le_referentiel_qualite:modeles_des_documents:accord_confidentialite_gb",
+  "https://wiki.intersel.fr/doku.php?id=intersel:le_referentiel_qualite:modeles_des_documents:bureaucracy_forms:annee_clients",
+  "https://wiki.intersel.fr/doku.php?id=intersel:le_referentiel_qualite:modeles_des_documents:bureaucracy_forms:projet_clients",
+  "https://wiki.intersel.fr/doku.php?id=intersel:le_referentiel_qualite:modeles_des_documents:bureaucracy_forms:prospects_project",
+  "https://wiki.intersel.fr/doku.php?id=intersel:le_referentiel_qualite:modeles_des_documents:google_comment",
+  "https://wiki.intersel.fr/doku.php?id=intersel:le_referentiel_qualite:modeles_des_documents:lettre_de_mise_en_demeure",
+  "https://wiki.intersel.fr/doku.php?id=intersel:le_referentiel_qualite:modeles_des_documents:lettre_de_relance_avec_ar",
+  "https://wiki.intersel.fr/doku.php?id=intersel:le_referentiel_qualite:modeles_des_documents:lettre_de_relance_simple",
+  "https://wiki.intersel.fr/doku.php?id=intersel:le_referentiel_qualite:modeles_des_documents:lettre_desistement_cheque",
+  "https://wiki.intersel.fr/doku.php?id=intersel:le_referentiel_qualite:modeles_des_documents:modele_footer_mail",
+  "https://wiki.intersel.fr/doku.php?id=intersel:le_referentiel_qualite:modeles_des_documents:modele_proposition",
+  "https://wiki.intersel.fr/doku.php?id=intersel:le_referentiel_qualite:modeles_des_documents:modele_proposition_english",
+  "https://wiki.intersel.fr/doku.php?id=intersel:le_referentiel_qualite:modeles_des_documents:modele_proposition_hebergement",
+  "https://wiki.intersel.fr/doku.php?id=intersel:le_referentiel_qualite:modeles_des_documents:phishing_attaques",
+  "https://wiki.intersel.fr/doku.php?id=intersel:le_referentiel_qualite:modeles_des_documents:reserves_proposition",
+  "https://wiki.intersel.fr/doku.php?id=intersel:le_referentiel_qualite:modeles_des_documents:support",
+  "https://wiki.intersel.fr/doku.php?id=intersel:le_referentiel_qualite:ordre_mission",
+  "https://wiki.intersel.fr/doku.php?id=intersel:le_referentiel_qualite:procedures:gestion_developpements:modx:start",
+  "https://wiki.intersel.fr/doku.php?id=intersel:le_referentiel_qualite:procedures:gestion_livraisons_projet",
+  "https://wiki.intersel.fr/doku.php?id=intersel:le_referentiel_qualite:procedures:gestion_sauvegarde_projet",
+  "https://wiki.intersel.fr/doku.php?id=intersel:le_referentiel_qualite:qualite:exigences_fonctionnelles",
+  "https://wiki.intersel.fr/doku.php?id=intersel:le_referentiel_qualite:regles_de_codage",
+  "https://wiki.intersel.fr/doku.php?id=intersel:le_referentiel_qualite:regles_de_codage:entete_fichier_fonction",
+  "https://wiki.intersel.fr/doku.php?id=intersel:le_referentiel_qualite:regles_de_codage:javadoc",
+  "https://wiki.intersel.fr/doku.php?id=intersel:le_referentiel_qualite:regles_de_codage:regles_codage_css",
+  "https://wiki.intersel.fr/doku.php?id=intersel:le_referentiel_qualite:regles_de_codage:regles_codage_html",
+  "https://wiki.intersel.fr/doku.php?id=intersel:le_referentiel_qualite:regles_de_codage:regles_codage_javascript",
+  "https://wiki.intersel.fr/doku.php?id=intersel:le_referentiel_qualite:regles_de_codage:regles_codage_modx",
+  "https://wiki.intersel.fr/doku.php?id=intersel:le_referentiel_qualite:regles_de_codage:regles_codage_php",
+  "https://wiki.intersel.fr/doku.php?id=intersel:le_referentiel_qualite:regles_de_codage:regles_nomination_modx",
+  "https://wiki.intersel.fr/doku.php?id=intersel:le_referentiel_qualite:regles_de_codage:regles_nommage_fichier",
+  "https://wiki.intersel.fr/doku.php?id=intersel:le_referentiel_qualite:reunionsdelancement:identite_graphique",
+  "https://wiki.intersel.fr/doku.php?id=intersel:le_referentiel_qualite:start",
+  "https://wiki.intersel.fr/doku.php?id=intersel:le_referentiel_qualite:workflow_livraison_git",
+  "https://wiki.intersel.fr/doku.php?id=intersel:marketing:modx:start",
+  "https://wiki.intersel.fr/doku.php?id=intersel:marketing:start",
+  "https://wiki.intersel.fr/doku.php?id=intersel:php",
+  "https://wiki.intersel.fr/doku.php?id=intersel:presentation",
+  "https://wiki.intersel.fr/doku.php?id=intersel:presentation_equipe",
+  "https://wiki.intersel.fr/doku.php?id=intersel:projets_internes:psi:sbl:aa:start",
+  "https://wiki.intersel.fr/doku.php?id=intersel:projets_internes:sas:conception_ab",
+  "https://wiki.intersel.fr/doku.php?id=intersel:projets_internes:site_intersel",
+  "https://wiki.intersel.fr/doku.php?id=intersel:projets_internes:slc_suivi_livrables_client:start",
+  "https://wiki.intersel.fr/doku.php?id=intersel:resume_annuaire",
+  "https://wiki.intersel.fr/doku.php?id=intersel:resume_clients",
+  "https://wiki.intersel.fr/doku.php?id=intersel:resume_viadeo",
+  "https://wiki.intersel.fr/doku.php?id=intersel:reunions_internes",
+  "https://wiki.intersel.fr/doku.php?id=intersel:rh:formulaires",
+  "https://wiki.intersel.fr/doku.php?id=intersel:rh:guide_pour_les_nouveaux_arrivants",
+  "https://wiki.intersel.fr/doku.php?id=intersel:securite:securite_site_internet",
+  "https://wiki.intersel.fr/doku.php?id=intersel:start",
+  "https://wiki.intersel.fr/doku.php?id=intersel:technique",
+  "https://wiki.intersel.fr/doku.php?id=produit:developpement:livinweb:animation_lettres:start",
+  "https://wiki.intersel.fr/doku.php?id=produit:developpement:livinweb:automation:preparation:lwstarter:start",
+  "https://wiki.intersel.fr/doku.php?id=produit:developpement:livinweb:automation:start",
+  "https://wiki.intersel.fr/doku.php?id=produit:developpement:livinweb:cold_calling:start",
+  "https://wiki.intersel.fr/doku.php?id=produit:developpement:livinweb:conception:import-de-ressources-csv",
+  "https://wiki.intersel.fr/doku.php?id=produit:developpement:livinweb:conception:import-export-de-ressources",
+  "https://wiki.intersel.fr/doku.php?id=produit:developpement:livinweb:conception_mx4:start",
+  "https://wiki.intersel.fr/doku.php?id=produit:developpement:livinweb:documentations:admin_manual:start",
+  "https://wiki.intersel.fr/doku.php?id=produit:developpement:livinweb:documentations:dev_manual:start",
+  "https://wiki.intersel.fr/doku.php?id=produit:developpement:livinweb:documentations:manuel-utilisateur-tres-simple:start",
+  "https://wiki.intersel.fr/doku.php?id=produit:developpement:livinweb:documentations:user_manual:start",
+  "https://wiki.intersel.fr/doku.php?id=produit:developpement:livinweb:documentations:user_manual:video:start",
+  "https://wiki.intersel.fr/doku.php?id=produit:developpement:livinweb:documentations:user_manual_expert:start",
+  "https://wiki.intersel.fr/doku.php?id=produit:developpement:livinweb:imx_demo:start",
+  "https://wiki.intersel.fr/doku.php?id=produit:developpement:livinweb:marketing:accroches:annuaire:start",
+  "https://wiki.intersel.fr/doku.php?id=produit:developpement:livinweb:marketing:accroches:start",
+  "https://wiki.intersel.fr/doku.php?id=produit:developpement:livinweb:nouveau_menu_panel",
+  "https://wiki.intersel.fr/doku.php?id=produit:developpement:livinweb:plan-type-contenu-imx",
+  "https://wiki.intersel.fr/doku.php?id=produit:developpement:livinweb:projects:template_slider_avec_swiper1",
+  "https://wiki.intersel.fr/doku.php?id=produit:developpement:livinweb:projets:amelioration_vitesse_generation_lw:start",
+  "https://wiki.intersel.fr/doku.php?id=produit:developpement:livinweb:projets:blapy:start",
+  "https://wiki.intersel.fr/doku.php?id=produit:developpement:livinweb:projets:commerce:specs",
+  "https://wiki.intersel.fr/doku.php?id=produit:developpement:livinweb:projets:evol_babel_202501",
+  "https://wiki.intersel.fr/doku.php?id=produit:developpement:livinweb:projets:imx_otp:start",
+  "https://wiki.intersel.fr/doku.php?id=produit:developpement:livinweb:projets:integration_metronic:start",
+  "https://wiki.intersel.fr/doku.php?id=produit:developpement:livinweb:projets:panier:specs",
+  "https://wiki.intersel.fr/doku.php?id=produit:developpement:livinweb:projets:panier:start",
+  "https://wiki.intersel.fr/doku.php?id=produit:developpement:livinweb:projets:solefy:start",
+  "https://wiki.intersel.fr/doku.php?id=produit:developpement:livinweb:projets:supergen:start",
+  "https://wiki.intersel.fr/doku.php?id=produit:developpement:livinweb:projets:webtimepilot:start",
+  "https://wiki.intersel.fr/doku.php?id=produit:developpement:livinweb:projetsimx",
+  "https://wiki.intersel.fr/doku.php?id=produit:developpement:livinweb:start",
+  "https://wiki.intersel.fr/doku.php?id=produit:developpement:livinweb:vente:cahier_des_charges:start",
+  "https://wiki.intersel.fr/doku.php?id=projets:samsic:anticipia:start",
+  "https://wiki.intersel.fr/doku.php?id=projets:samsic:start",
+  "https://wiki.intersel.fr/doku.php?id=securite:virus:virus_et_nettoyage_pc",
+  "https://wiki.intersel.fr/doku.php?id=start",
+  "https://wiki.intersel.fr/doku.php?id=technique:codes_source_utiles",
+  "https://wiki.intersel.fr/doku.php?id=technique:developpement:codes_source_utiles:shell:scripts_migration_versions",
+  "https://wiki.intersel.fr/doku.php?id=technique:developpement:developpement_limesurvey:manuel_utilisateur_limesurvey",
+  "https://wiki.intersel.fr/doku.php?id=technique:developpement:developpement_limesurvey:start",
+  "https://wiki.intersel.fr/doku.php?id=technique:developpement:developpement_modx:affectation_header_content_type",
+  "https://wiki.intersel.fr/doku.php?id=technique:developpement:developpement_modx:apimodx",
+  "https://wiki.intersel.fr/doku.php?id=technique:developpement:developpement_modx:arborescence",
+  "https://wiki.intersel.fr/doku.php?id=technique:developpement:developpement_modx:auditor",
+  "https://wiki.intersel.fr/doku.php?id=technique:developpement:developpement_modx:displaymessagealert",
+  "https://wiki.intersel.fr/doku.php?id=technique:developpement:developpement_modx:ditto",
+  "https://wiki.intersel.fr/doku.php?id=technique:developpement:developpement_modx:ditto_probleme_cache",
+  "https://wiki.intersel.fr/doku.php?id=technique:developpement:developpement_modx:docmanager",
+  "https://wiki.intersel.fr/doku.php?id=technique:developpement:developpement_modx:documentpublisher",
+  "https://wiki.intersel.fr/doku.php?id=technique:developpement:developpement_modx:editarea",
+  "https://wiki.intersel.fr/doku.php?id=technique:developpement:developpement_modx:evolution_cms",
+  "https://wiki.intersel.fr/doku.php?id=technique:developpement:developpement_modx:fichiers_style_css",
+  "https://wiki.intersel.fr/doku.php?id=technique:developpement:developpement_modx:fileupload",
+  "https://wiki.intersel.fr/doku.php?id=technique:developpement:developpement_modx:formations:start",
+  "https://wiki.intersel.fr/doku.php?id=technique:developpement:developpement_modx:generation_de_fichiers_incorrecte",
+  "https://wiki.intersel.fr/doku.php?id=technique:developpement:developpement_modx:gestion_de_documents",
+  "https://wiki.intersel.fr/doku.php?id=technique:developpement:developpement_modx:insertion_editeur",
+  "https://wiki.intersel.fr/doku.php?id=technique:developpement:developpement_modx:integration_modx_dokuwiki",
+  "https://wiki.intersel.fr/doku.php?id=technique:developpement:developpement_modx:linkedin",
+  "https://wiki.intersel.fr/doku.php?id=technique:developpement:developpement_modx:loginlogout",
+  "https://wiki.intersel.fr/doku.php?id=technique:developpement:developpement_modx:modx_evolution",
+  "https://wiki.intersel.fr/doku.php?id=technique:developpement:developpement_modx:modx_evolution:bug_ie",
+  "https://wiki.intersel.fr/doku.php?id=technique:developpement:developpement_modx:modx_evolution:droits_acces",
+  "https://wiki.intersel.fr/doku.php?id=technique:developpement:developpement_modx:modx_evolution:preparemovieplayer.snippet",
+  "https://wiki.intersel.fr/doku.php?id=technique:developpement:developpement_modx:modx_evolution:snippet:wayfinder",
+  "https://wiki.intersel.fr/doku.php?id=technique:developpement:developpement_modx:modx_evolution:snippets_a_installer",
+  "https://wiki.intersel.fr/doku.php?id=technique:developpement:developpement_modx:modx_evolution:templates_de_base",
+  "https://wiki.intersel.fr/doku.php?id=technique:developpement:developpement_modx:modx_evolution:upgrade:modx_1_0_5_vers_1_0_12",
+  "https://wiki.intersel.fr/doku.php?id=technique:developpement:developpement_modx:modx_evolution:upgrade:modx_1_x_vers_1_4.x",
+  "https://wiki.intersel.fr/doku.php?id=technique:developpement:developpement_modx:modx_probleme_cache",
+  "https://wiki.intersel.fr/doku.php?id=technique:developpement:developpement_modx:modx_revolution",
+  "https://wiki.intersel.fr/doku.php?id=technique:developpement:developpement_modx:modx_revolution:architecture_modx_revo",
+  "https://wiki.intersel.fr/doku.php?id=technique:developpement:developpement_modx:modx_revolution:intersel:start",
+  "https://wiki.intersel.fr/doku.php?id=technique:developpement:developpement_modx:molecule",
+  "https://wiki.intersel.fr/doku.php?id=technique:developpement:developpement_modx:moteur_de_recherche",
+  "https://wiki.intersel.fr/doku.php?id=technique:developpement:developpement_modx:page_navigation",
+  "https://wiki.intersel.fr/doku.php?id=technique:developpement:developpement_modx:phx",
+  "https://wiki.intersel.fr/doku.php?id=technique:developpement:developpement_modx:picture_editor",
+  "https://wiki.intersel.fr/doku.php?id=technique:developpement:developpement_modx:probleme_appel_snippet",
+  "https://wiki.intersel.fr/doku.php?id=technique:developpement:developpement_modx:probleme_editeur_riche",
+  "https://wiki.intersel.fr/doku.php?id=technique:developpement:developpement_modx:probleme_eventlog",
+  "https://wiki.intersel.fr/doku.php?id=technique:developpement:developpement_modx:probleme_filtrage_modx",
+  "https://wiki.intersel.fr/doku.php?id=technique:developpement:developpement_modx:probleme_htaccess",
+  "https://wiki.intersel.fr/doku.php?id=technique:developpement:developpement_modx:probleme_utf8_ansi",
+  "https://wiki.intersel.fr/doku.php?id=technique:developpement:developpement_modx:quickedit",
+  "https://wiki.intersel.fr/doku.php?id=technique:developpement:developpement_modx:sitemap",
+  "https://wiki.intersel.fr/doku.php?id=technique:developpement:developpement_modx:snippet_probleme_cache",
+  "https://wiki.intersel.fr/doku.php?id=technique:developpement:developpement_modx:start",
+  "https://wiki.intersel.fr/doku.php?id=technique:developpement:developpement_modx:template_reference:start",
+  "https://wiki.intersel.fr/doku.php?id=technique:developpement:developpement_modx:tinymce",
+  "https://wiki.intersel.fr/doku.php?id=technique:developpement:developpement_modx:weblogin",
+  "https://wiki.intersel.fr/doku.php?id=technique:developpement:developpement_phplist:start",
+  "https://wiki.intersel.fr/doku.php?id=technique:developpement:developpement_prestashop:start",
+  "https://wiki.intersel.fr/doku.php?id=technique:developpement:developpement_wordpress:start",
+  "https://wiki.intersel.fr/doku.php?id=technique:hebergement:aides_hebergement",
+  "https://wiki.intersel.fr/doku.php?id=technique:hebergement:archinet:archinet-mutu1",
+  "https://wiki.intersel.fr/doku.php?id=technique:hebergement:archinet:archinet-mutu2",
+  "https://wiki.intersel.fr/doku.php?id=technique:hebergement:archinet:archinet-mutu3",
+  "https://wiki.intersel.fr/doku.php?id=technique:hebergement:archinet:archinet-mutu4",
+  "https://wiki.intersel.fr/doku.php?id=technique:hebergement:archinet:start",
+  "https://wiki.intersel.fr/doku.php?id=technique:hebergement:architecture_intersel_2014:start",
+  "https://wiki.intersel.fr/doku.php?id=technique:hebergement:backups:scripts:intersel_dump",
+  "https://wiki.intersel.fr/doku.php?id=technique:hebergement:ikoula:mutu-iko-1.intersel.net",
+  "https://wiki.intersel.fr/doku.php?id=technique:hebergement:ikoula:start",
+  "https://wiki.intersel.fr/doku.php?id=technique:hebergement:ovh:jobsc-ovh-1.intersel.net",
+  "https://wiki.intersel.fr/doku.php?id=technique:hebergement:ovh:mutu-ovh-1.intersel.net",
+  "https://wiki.intersel.fr/doku.php?id=technique:hebergement:ovh:mutu-ovh-2.intersel.net",
+  "https://wiki.intersel.fr/doku.php?id=technique:hebergement:ovh:nas-ovh-1.intersel.net",
+  "https://wiki.intersel.fr/doku.php?id=technique:hebergement:ovh:oc-ovh-1.intersel.net",
+  "https://wiki.intersel.fr/doku.php?id=technique:hebergement:ovh:rl-ovh-1.intersel.net",
+  "https://wiki.intersel.fr/doku.php?id=technique:hebergement:ovh:start",
+  "https://wiki.intersel.fr/doku.php?id=technique:hebergement:scaleway:mutu-scw-1.intersel.net",
+  "https://wiki.intersel.fr/doku.php?id=technique:hebergement:scaleway:mutu-scw-2.intersel.net",
+  "https://wiki.intersel.fr/doku.php?id=technique:hebergement:scaleway:mutu-scw-3.intersel.net",
+  "https://wiki.intersel.fr/doku.php?id=technique:hebergement:scaleway:mutu-scw-o1.intersel.net",
+  "https://wiki.intersel.fr/doku.php?id=technique:hebergement:scaleway:start",
+  "https://wiki.intersel.fr/doku.php?id=technique:hebergement:start",
+  "https://wiki.intersel.fr/doku.php?id=technique:linux:aide_commandes_linux",
+  "https://wiki.intersel.fr/doku.php?id=technique:linux:apt-get_ou_aptitude",
+  "https://wiki.intersel.fr/doku.php?id=technique:linux:architecture_ha_lb",
+  "https://wiki.intersel.fr/doku.php?id=technique:linux:fichiers_linux",
+  "https://wiki.intersel.fr/doku.php?id=technique:linux:fichiers_linux:htaccess",
+  "https://wiki.intersel.fr/doku.php?id=technique:linux:nagios",
+  "https://wiki.intersel.fr/doku.php?id=technique:linux:serveur_dedie_linux",
+  "https://wiki.intersel.fr/doku.php?id=technique:linux:start:aides_hebergement:copie_vm_mutu:start",
+  "https://wiki.intersel.fr/doku.php?id=technique:matomo:start",
+  "https://wiki.intersel.fr/doku.php?id=technique:mysql:start",
+  "https://wiki.intersel.fr/doku.php?id=technique:postgresql:start",
+  "https://wiki.intersel.fr/doku.php?id=technique:start"
+]

+ 25 - 0
src/models/VLM.py

@@ -0,0 +1,25 @@
+
+from transformers import BlipProcessor, BlipForQuestionAnswering
+import torch
+from PIL import Image
+
+device = "cuda" if torch.cuda.is_available() else "cpu"
+
+# Chargement du modèle BLIP pré-entraîné (VQA)
+processor = BlipProcessor.from_pretrained("Salesforce/blip-vqa-base", use_fast=True)
+model = BlipForQuestionAnswering.from_pretrained("Salesforce/blip-vqa-base").to(device)
+model.eval()
+
+def ask_blip(image_path, question):
+    image = Image.open(image_path).convert("RGB")
+
+    # Préparer les inputs (image + question)
+    inputs = processor(image, question, return_tensors="pt").to(device)
+
+    # Générer la réponse
+    with torch.no_grad():
+        outputs = model.generate(**inputs)
+        answer = processor.tokenizer.decode(outputs[0], skip_special_tokens=True)
+
+    return answer
+

+ 0 - 0
src/models/__init__.py


BIN
src/models/__pycache__/VLM.cpython-312.pyc


BIN
src/models/__pycache__/__init__.cpython-312.pyc


+ 540 - 0
src/templates/index.html

@@ -0,0 +1,540 @@
+<!DOCTYPE html>
+<html lang="fr">
+<head>
+  <meta charset="UTF-8" />
+  <meta name="viewport" content="width=device-width, initial-scale=1" />
+  <title>Chatbot Documentaire</title>
+  <link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Inter:wght@400;600&display=swap" />
+  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
+
+  <style>
+    body {
+      margin: 0;
+      font-family: 'Inter', sans-serif;
+      background-color: #f4f6f8;
+      height: 100vh;
+      width: 100vw;
+      overflow: hidden;
+      display: flex;
+      flex-direction: column;
+    }
+    .chat-container {
+      flex: 1;
+      display: flex;
+      flex-direction: column;
+      height: 100vh;
+      width: 100vw;
+    }
+    .chat-header {
+      height: 64px;
+      background: #10a37f;
+      color: white;
+      padding: 1rem;
+      font-size: 1.25rem;
+      font-weight: bold;
+      text-align: center;
+      flex-shrink: 0;
+    }
+    .chat-body {
+      display: flex;
+      flex: 1;
+      height: calc(100vh - 64px);
+      overflow: hidden;
+    }
+    .chat-sidebar {
+      width: 20%;
+      background-color: #e9f5f2;
+      border-right: 1px solid #ccc;
+      padding: 1rem;
+      overflow-y: auto;
+    }
+    .chat-title {
+      font-weight: bold;
+      margin-bottom: 1rem;
+    }
+    .chat-main {
+      flex: 1;
+      display: flex;
+      flex-direction: column;
+      background-color: #f7f9fa;
+    }
+    .chat-history {
+      flex: 1;
+      padding: 1rem;
+      overflow-y: auto;
+      display: flex;
+      flex-direction: column;
+      gap: 1rem;
+    }
+    .chat-input {
+      padding: 1rem;
+      background: white;
+      border-top: 1px solid #ddd;
+      flex-shrink: 0;
+    }
+    form {
+      display: flex;
+      flex-direction: column;
+      gap: 1rem;
+    }
+    input[type="text"] {
+      padding: 0.75rem;
+      border-radius: 8px;
+      border: 1px solid #ccc;
+      font-size: 1rem;
+      width: 100%;
+      box-sizing: border-box;
+    }
+    button {
+      background-color: #10a37f;
+      color: white;
+      padding: 0.75rem;
+      border: none;
+      border-radius: 8px;
+      cursor: pointer;
+      font-weight: bold;
+      transition: background-color 0.3s;
+    }
+    button:hover {
+      background-color: #0d8f6a;
+    }
+    .upload-label {
+      display: inline-block;
+      background-color: #e0f7f1;
+      color: #10a37f;
+      padding: 0.5rem 1rem;
+      border-radius: 8px;
+      cursor: pointer;
+      font-weight: bold;
+      font-size: 0.95rem;
+      width: fit-content;
+    }
+    input[type="file"] {
+      display: none;
+    }
+    .file-preview {
+      background-color: #f0f0f0;
+      padding: 0.5rem;
+      border-radius: 6px;
+      font-size: 0.9rem;
+      color: #555;
+      max-width: 100%;
+      word-break: break-word;
+    }
+    .message {
+      display: flex;
+      max-width: 70%;
+      line-height: 1.4;
+      position: relative;
+      gap: 0.5rem;
+    }
+    .message.user {
+      align-self: flex-end;
+      flex-direction: row-reverse;
+    }
+    .message.bot {
+      align-self: flex-start;
+      flex-direction: row;
+    }
+    .message .avatar {
+      font-size: 1.5rem;
+      user-select: none;
+      flex-shrink: 0;
+      align-self: flex-end;
+      margin: 0 0.5rem;
+    }
+    .message .bubble {
+      padding: 0.8rem 1rem;
+      border-radius: 16px;
+      box-shadow: 0 1px 3px rgba(0,0,0,0.1);
+      white-space: pre-wrap;
+      word-wrap: break-word;
+      font-size: 1rem;
+      line-height: 1.4;
+      position: relative;
+    }
+    .message.user .bubble {
+      background-color: #d1e7dd;
+      color: #0f5132;
+      border-bottom-right-radius: 0;
+    }
+    .message.user .bubble::after {
+      content: "";
+      position: absolute;
+      bottom: 0;
+      right: -8px;
+      width: 0;
+      height: 0;
+      border-top: 12px solid #d1e7dd;
+      border-left: 8px solid transparent;
+    }
+    .message.bot .bubble {
+      background-color: #e2e3e5;
+      color: #41464b;
+      border-bottom-left-radius: 0;
+    }
+    .message.bot .bubble::after {
+      content: "";
+      position: absolute;
+      bottom: 0;
+      left: -8px;
+      width: 0;
+      height: 0;
+      border-top: 12px solid #e2e3e5;
+      border-right: 8px solid transparent;
+    }
+
+
+
+    body.dark {
+      background-color: #1e1e1e;
+      color: #f0f0f0;
+    }
+
+    body.dark .chat-header {
+      background: #333;
+    }
+
+    body.dark .chat-sidebar {
+      background-color: #2d2d2d;
+      border-color: #444;
+    }
+
+    body.dark .chat-main {
+      background-color: #1e1e1e;
+    }
+
+    body.dark .chat-history {
+      background-color: #1e1e1e;
+    }
+
+    body.dark .chat-input {
+      background-color: #2c2c2c;
+      border-color: #444;
+    }
+
+    body.dark input[type="text"] {
+      background-color: #3a3a3a;
+      color: #f0f0f0;
+      border-color: #555;
+    }
+
+    body.dark button {
+      background-color: #10a37f;
+      color: white;
+    }
+
+    body.dark .upload-label {
+      background-color: #37474f;
+      color: #10a37f;
+    }
+
+    body.dark .file-preview {
+      background-color: #333;
+      color: #ccc;
+    }
+
+    body.dark .message.user .bubble {
+      background-color: #264d3d;
+      color: #c8e6c9;
+    }
+
+    body.dark .message.user .bubble::after {
+      border-top-color: #264d3d;
+    }
+
+    body.dark .message.bot .bubble {
+      background-color: #444;
+      color: #eee;
+    }
+
+    body.dark .message.bot .bubble::after {
+      border-top-color: #444;
+    }
+
+/* Header layout */
+.header {
+  display: flex;
+  justify-content: space-between;
+  align-items: center;
+  padding: 12px 24px;
+  background-color: var(--header-bg, #f5f5f5);
+  border-bottom: 1px solid #ccc;
+  color: var(--text-color, #333);
+}
+
+.header h1 {
+  font-size: 1.5em;
+  margin: 0;
+}
+
+/* Right section layout */
+.header-right {
+  display: flex;
+  gap: 16px;
+}
+
+/* Shared button/icon style */
+.icon-button {
+  background: none;
+  border: none;
+  font-size: 1.4em;
+  color: var(--text-color, #333);
+  cursor: pointer;
+  transition: color 0.3s ease;
+  text-decoration: none;
+}
+
+.icon-button:hover {
+  color: #007bff;
+}
+
+/* Dark mode support */
+@media (prefers-color-scheme: dark) {
+  .header {
+    --header-bg: #1e1e1e;
+    --text-color: #f0f0f0;
+  }
+
+  .icon-button {
+    color: var(--text-color);
+  }
+
+  .icon-button:hover {
+    color: #66b0ff;
+  }
+}
+
+.header-buttons {
+  position: absolute;
+  right: 1rem;
+  top: 1rem;
+  display: flex;
+  align-items: center;
+  gap: 10px;
+   z-index: 1000;
+}
+
+.theme-toggle,
+.signup-btn {
+  background-color: rgba(255, 255, 255, 0.2);
+  color: white;
+  border: none;
+  border-radius: 6px;
+  width: 40px;
+  height: 40px;
+  font-size: 20px;
+  line-height: 1;
+  display: flex;
+  align-items: center;
+  justify-content: center;
+  cursor: pointer;
+}
+
+.theme-toggle:hover,
+.signup-btn:hover {
+  background-color: rgba(255, 255, 255, 0.35);
+}
+.chat-sidebar {
+  width: 200px;
+  background-color: #202020;
+  color: white;
+  padding: 1rem;
+}
+
+.chat-title {
+  font-weight: bold;
+  margin-bottom: 1rem;
+}
+
+.chat-item {
+  padding: 0.5rem;
+  cursor: pointer;
+  border-radius: 4px;
+}
+
+.chat-item:hover {
+  background-color: #333;
+}
+
+  </style>
+</head>
+
+<body>
+  <div class="chat-container">
+    <div class="chat-header">📎 Chatbot Documentaire</div>
+<div class="header-buttons">
+  <button class="theme-toggle" id="themeToggle" title="Changer de thème">🌙</button>
+  <button class="signup-btn" id="signupBtn" title="Créer un compte">📝</button>
+</div>
+
+    <div class="chat-body">
+
+      <div class="chat-sidebar" id="chatSidebar">
+        <div class="chat-title">💬 Vos Chats</div>
+<div id="chatList"></div>
+  <button onclick="addNewChat()">➕ Nouveau Chat</button>
+
+        <div class="chat-item">🗂️ Chat du 1 août</div>
+        <div class="chat-item">🗂️ Chat du 2 août</div>
+      </div>
+
+      <div class="chat-main">
+        <div class="chat-history" id="chatHistory"></div>
+
+        <div class="chat-input">
+          <form id="questionForm" enctype="multipart/form-data">
+            <label class="upload-label" for="file">📁 Ajouter un fichier (PDF, TXT, Image)</label>
+            <input type="file" id="file" name="file" accept=".pdf,.txt,image/*" />
+            <div class="file-preview" id="filePreview" style="display: none;"></div>
+
+            <input type="text" id="question" name="question" placeholder="Posez votre question…" autocomplete="off" required />
+            <button type="submit">Envoyer</button>
+          </form>
+        </div>
+      </div>
+    </div>
+
+    <div id="status" style="color: gray; margin-top: 0.5rem;"></div>
+  </div>
+
+  <script>
+    const chatHistoryDiv = document.getElementById("chatHistory");
+    const questionForm = document.getElementById("questionForm");
+    const questionInput = document.getElementById("question");
+    const status = document.getElementById("status");
+    const fileInput = document.getElementById("file");
+    const filePreview = document.getElementById("filePreview");
+
+    // Affiche nom fichier sélectionné
+    fileInput.addEventListener('change', () => {
+      if (fileInput.files.length > 0) {
+        filePreview.style.display = 'block';
+        filePreview.textContent = `Fichier sélectionné : ${fileInput.files[0].name}`;
+      } else {
+        filePreview.style.display = 'none';
+        filePreview.textContent = '';
+      }
+    });
+
+    // Fonction ajout message
+    function appendMessage(sender, text) {
+      const message = document.createElement("div");
+      message.className = `message ${sender}`;
+
+      const avatar = document.createElement("div");
+      avatar.className = "avatar";
+      avatar.textContent = sender === "user" ? "👤" : "🤖";
+
+      const bubble = document.createElement("div");
+      bubble.className = "bubble";
+      bubble.textContent = text;
+
+      message.appendChild(avatar);
+      message.appendChild(bubble);
+      chatHistoryDiv.appendChild(message);
+
+      chatHistoryDiv.scrollTop = chatHistoryDiv.scrollHeight;
+    }
+
+    // Charger historique si tu as cette route backend
+    async function loadChatHistory() {
+      try {
+        const response = await fetch("/chat_history");
+        if (response.ok) {
+          const chatHistory = await response.json();
+          chatHistoryDiv.innerHTML = "";
+          chatHistory.forEach(({ question, answer }) => {
+            appendMessage("user", question);
+            appendMessage("bot", answer);
+          });
+        }
+      } catch (error) {
+        console.warn("Erreur chargement historique :", error);
+      }
+    }
+    loadChatHistory();
+
+    // Gestion submit formulaire unique
+    questionForm.addEventListener("submit", async (e) => {
+      e.preventDefault();
+
+      const question = questionInput.value.trim();
+      if (!question) return;
+
+      appendMessage("user", question);
+      status.textContent = "En attente de la réponse...";
+
+      // Si fichier sélectionné, on envoie en multipart/form-data vers /upload_file
+      if (fileInput.files.length > 0) {
+        const formData = new FormData();
+        formData.append("file", fileInput.files[0]);
+        formData.append("question", question);
+
+        try {
+          const res = await fetch("/upload_file", {
+            method: "POST",
+            body: formData,
+          });
+          if (res.ok) {
+            const data = await res.json();
+            appendMessage("bot", data.answer || "Réponse reçue.");
+          } else {
+            appendMessage("bot", `Erreur serveur: ${res.status}`);
+          }
+        } catch (error) {
+          appendMessage("bot", "Erreur réseau ou serveur.");
+          console.error(error);
+        }
+      } else {
+        // Pas de fichier, on envoie JSON vers /qa_chain
+        try {
+          const res = await fetch("/qa_chain", {
+            method: "POST",
+            headers: { "Content-Type": "application/json" },
+            body: JSON.stringify({ query: question }),
+          });
+          if (res.ok) {
+            const data = await res.json();
+            appendMessage("bot", data.answer || "Réponse reçue.");
+          } else {
+            appendMessage("bot", `Erreur serveur: ${res.status}`);
+          }
+        } catch (error) {
+          appendMessage("bot", "Erreur réseau ou serveur.");
+          console.error(error);
+        }
+      }
+
+      status.textContent = "";
+      questionInput.value = "";
+      fileInput.value = "";
+      filePreview.style.display = 'none';
+    });
+
+        const themeToggle = document.getElementById("themeToggle");
+
+    function setTheme(mode) {
+      document.body.classList.toggle("dark", mode === "dark");
+      themeToggle.textContent = mode === "dark" ? "☀️" : "🌙";
+      localStorage.setItem("theme", mode);
+    }
+
+    themeToggle.addEventListener("click", () => {
+      const currentMode = document.body.classList.contains("dark") ? "dark" : "light";
+      const newMode = currentMode === "dark" ? "light" : "dark";
+      setTheme(newMode);
+    });
+
+    // Appliquer le thème sauvegardé
+    const savedTheme = localStorage.getItem("theme") || "light";
+    setTheme(savedTheme);
+
+  function addNewChat() {
+    const today = new Date().toLocaleDateString('fr-FR', { day: 'numeric', month: 'long' });
+    chatData.push({ label: `Chat du ${today}`, icon: "🗂️" });
+    renderChatList();
+  }
+  </script>
+</body>
+</html>

BIN
src/uploads/cos.png


BIN
src/uploads/cross.png


BIN
src/uploads/methodologie.png


+ 24 - 0
src/uploads/ocr_output.html

@@ -0,0 +1,24 @@
+
+    <html><head><meta charset="utf-8"><title>Résultat OCR Organisé</title>
+    <style>
+      body { font-family: Arial, sans-serif; background: #f0f0f0; }
+      .page {
+        position: relative;
+        width: 800px; height: 1120px; /* ratio approx A4 */
+        margin: 20px auto;
+        background: white;
+        box-shadow: 0 0 8px rgba(0,0,0,0.2);
+      }
+      .block {
+        position: absolute;
+        border: 1px solid rgba(255,0,0,0.5);
+        background: rgba(255,255,255,0.7);
+        padding: 4px;
+        font-size: 14px;
+        line-height: 1.2em;
+        overflow-wrap: break-word;
+      }
+    </style>
+    </head><body>
+    <h1>Résultat OCR Organisé</h1>
+    <div class="page"><h2>Page 1</h2><div class="block" style="left:25.78125px; top:53.81754322766571px; width:749.21875px; height:981.0417417146973px;">Collecte des<br>Preparation des<br>Exploration des<br>données<br>données<br>données<br>(Collecter les<br>(nettoyage jeu de<br>(Analyse<br>donneés pertinentes<br>données, créer des<br>exploratoire et<br>comme la méteo,<br>variables<br>visualisation des<br>date du vol...)<br>supplementaires...)<br>donnees)<br>Evaluation des<br>Visualisation des<br>Modelisation<br>performances<br>resultats<br>(Prediction)<br>modele<br>(Presenter les<br>(Choisir un modele<br>(voir la performance<br>predictions dans<br>et l'entrainer sur des<br>du modele sur des<br>dashboard)<br>données histiriques)<br>données non vues)<br>Deploiement<br>(déploie le modèle<br>sur un serveur pour<br>qu'il fonctionne<br>automatiquement - )<br></div></div></body></html>

+ 2123 - 0
src/uploads/ocr_output.json

@@ -0,0 +1,2123 @@
+{
+  "pages": [
+    {
+      "page_idx": 0,
+      "dimensions": [
+        694,
+        795
+      ],
+      "orientation": {
+        "value": null,
+        "confidence": null
+      },
+      "language": {
+        "value": null,
+        "confidence": null
+      },
+      "blocks": [
+        {
+          "geometry": [
+            [
+              0.0322265625,
+              0.04805137788184438
+            ],
+            [
+              0.96875,
+              0.9239815044128242
+            ]
+          ],
+          "objectness_score": 0.816634056688864,
+          "lines": [
+            {
+              "geometry": [
+                [
+                  0.0810546875,
+                  0.04805137788184438
+                ],
+                [
+                  0.2568359375,
+                  0.07601849558717577
+                ]
+              ],
+              "objectness_score": 0.8275238573551178,
+              "words": [
+                {
+                  "value": "Collecte",
+                  "confidence": 0.9877678751945496,
+                  "geometry": [
+                    [
+                      0.0810546875,
+                      0.04917006259005763
+                    ],
+                    [
+                      0.1953125,
+                      0.07489981087896252
+                    ]
+                  ],
+                  "objectness_score": 0.805518388748169,
+                  "crop_orientation": {
+                    "value": 0,
+                    "confidence": null
+                  }
+                },
+                {
+                  "value": "des",
+                  "confidence": 0.9382218718528748,
+                  "geometry": [
+                    [
+                      0.205078125,
+                      0.04805137788184438
+                    ],
+                    [
+                      0.2568359375,
+                      0.07601849558717577
+                    ]
+                  ],
+                  "objectness_score": 0.8495293259620667,
+                  "crop_orientation": {
+                    "value": 0,
+                    "confidence": null
+                  }
+                }
+              ]
+            },
+            {
+              "geometry": [
+                [
+                  0.3896484375,
+                  0.04805137788184438
+                ],
+                [
+                  0.61328125,
+                  0.07937454971181557
+                ]
+              ],
+              "objectness_score": 0.8656781613826752,
+              "words": [
+                {
+                  "value": "Preparation",
+                  "confidence": 0.6832982301712036,
+                  "geometry": [
+                    [
+                      0.3896484375,
+                      0.050288747298270875
+                    ],
+                    [
+                      0.55078125,
+                      0.07937454971181557
+                    ]
+                  ],
+                  "objectness_score": 0.9028745293617249,
+                  "crop_orientation": {
+                    "value": 0,
+                    "confidence": null
+                  }
+                },
+                {
+                  "value": "des",
+                  "confidence": 0.985428512096405,
+                  "geometry": [
+                    [
+                      0.5625,
+                      0.04805137788184438
+                    ],
+                    [
+                      0.61328125,
+                      0.07713718029538907
+                    ]
+                  ],
+                  "objectness_score": 0.8284817934036255,
+                  "crop_orientation": {
+                    "value": 0,
+                    "confidence": null
+                  }
+                }
+              ]
+            },
+            {
+              "geometry": [
+                [
+                  0.72265625,
+                  0.04805137788184438
+                ],
+                [
+                  0.9443359375,
+                  0.07937454971181557
+                ]
+              ],
+              "objectness_score": 0.8440051674842834,
+              "words": [
+                {
+                  "value": "Exploration",
+                  "confidence": 0.9612176418304443,
+                  "geometry": [
+                    [
+                      0.72265625,
+                      0.050288747298270875
+                    ],
+                    [
+                      0.8828125,
+                      0.07937454971181557
+                    ]
+                  ],
+                  "objectness_score": 0.8654814958572388,
+                  "crop_orientation": {
+                    "value": 0,
+                    "confidence": null
+                  }
+                },
+                {
+                  "value": "des",
+                  "confidence": 0.98373943567276,
+                  "geometry": [
+                    [
+                      0.8935546875,
+                      0.04805137788184438
+                    ],
+                    [
+                      0.9443359375,
+                      0.07713718029538907
+                    ]
+                  ],
+                  "objectness_score": 0.8225288391113281,
+                  "crop_orientation": {
+                    "value": 0,
+                    "confidence": null
+                  }
+                }
+              ]
+            },
+            {
+              "geometry": [
+                [
+                  0.107421875,
+                  0.0883240273775216
+                ],
+                [
+                  0.228515625,
+                  0.1140537756664265
+                ]
+              ],
+              "objectness_score": 0.8256243467330933,
+              "words": [
+                {
+                  "value": "données",
+                  "confidence": 0.8609145283699036,
+                  "geometry": [
+                    [
+                      0.107421875,
+                      0.0883240273775216
+                    ],
+                    [
+                      0.228515625,
+                      0.1140537756664265
+                    ]
+                  ],
+                  "objectness_score": 0.8256243467330933,
+                  "crop_orientation": {
+                    "value": 0,
+                    "confidence": null
+                  }
+                }
+              ]
+            },
+            {
+              "geometry": [
+                [
+                  0.439453125,
+                  0.0883240273775216
+                ],
+                [
+                  0.560546875,
+                  0.1140537756664265
+                ]
+              ],
+              "objectness_score": 0.8341006636619568,
+              "words": [
+                {
+                  "value": "données",
+                  "confidence": 0.8609145283699036,
+                  "geometry": [
+                    [
+                      0.439453125,
+                      0.0883240273775216
+                    ],
+                    [
+                      0.560546875,
+                      0.1140537756664265
+                    ]
+                  ],
+                  "objectness_score": 0.8341006636619568,
+                  "crop_orientation": {
+                    "value": 0,
+                    "confidence": null
+                  }
+                }
+              ]
+            },
+            {
+              "geometry": [
+                [
+                  0.767578125,
+                  0.0883240273775216
+                ],
+                [
+                  0.8876953125,
+                  0.1140537756664265
+                ]
+              ],
+              "objectness_score": 0.824738621711731,
+              "words": [
+                {
+                  "value": "données",
+                  "confidence": 0.9612035751342773,
+                  "geometry": [
+                    [
+                      0.767578125,
+                      0.0883240273775216
+                    ],
+                    [
+                      0.8876953125,
+                      0.1140537756664265
+                    ]
+                  ],
+                  "objectness_score": 0.824738621711731,
+                  "crop_orientation": {
+                    "value": 0,
+                    "confidence": null
+                  }
+                }
+              ]
+            },
+            {
+              "geometry": [
+                [
+                  0.0771484375,
+                  0.12524062274855907
+                ],
+                [
+                  0.2607421875,
+                  0.15880116399495675
+                ]
+              ],
+              "objectness_score": 0.8089526891708374,
+              "words": [
+                {
+                  "value": "(Collecter",
+                  "confidence": 0.9168035984039307,
+                  "geometry": [
+                    [
+                      0.0771484375,
+                      0.12524062274855907
+                    ],
+                    [
+                      0.21484375,
+                      0.15880116399495675
+                    ]
+                  ],
+                  "objectness_score": 0.743909478187561,
+                  "crop_orientation": {
+                    "value": 0,
+                    "confidence": null
+                  }
+                },
+                {
+                  "value": "les",
+                  "confidence": 0.9869842529296875,
+                  "geometry": [
+                    [
+                      0.2216796875,
+                      0.12524062274855907
+                    ],
+                    [
+                      0.2607421875,
+                      0.155445109870317
+                    ]
+                  ],
+                  "objectness_score": 0.8739959001541138,
+                  "crop_orientation": {
+                    "value": 0,
+                    "confidence": null
+                  }
+                }
+              ]
+            },
+            {
+              "geometry": [
+                [
+                  0.3857421875,
+                  0.12524062274855907
+                ],
+                [
+                  0.6171875,
+                  0.1610385334113833
+                ]
+              ],
+              "objectness_score": 0.8517009615898132,
+              "words": [
+                {
+                  "value": "(nettoyage",
+                  "confidence": 0.7188050746917725,
+                  "geometry": [
+                    [
+                      0.3857421875,
+                      0.12635930745677232
+                    ],
+                    [
+                      0.5244140625,
+                      0.15991984870317005
+                    ]
+                  ],
+                  "objectness_score": 0.8291909694671631,
+                  "crop_orientation": {
+                    "value": 0,
+                    "confidence": null
+                  }
+                },
+                {
+                  "value": "jeu",
+                  "confidence": 0.9746283888816833,
+                  "geometry": [
+                    [
+                      0.5322265625,
+                      0.12524062274855907
+                    ],
+                    [
+                      0.5751953125,
+                      0.1610385334113833
+                    ]
+                  ],
+                  "objectness_score": 0.8322051167488098,
+                  "crop_orientation": {
+                    "value": 0,
+                    "confidence": null
+                  }
+                },
+                {
+                  "value": "de",
+                  "confidence": 0.9980244636535645,
+                  "geometry": [
+                    [
+                      0.58203125,
+                      0.12524062274855907
+                    ],
+                    [
+                      0.6171875,
+                      0.155445109870317
+                    ]
+                  ],
+                  "objectness_score": 0.8937067985534668,
+                  "crop_orientation": {
+                    "value": 0,
+                    "confidence": null
+                  }
+                }
+              ]
+            },
+            {
+              "geometry": [
+                [
+                  0.7763671875,
+                  0.12859667687319887
+                ],
+                [
+                  0.888671875,
+                  0.15880116399495675
+                ]
+              ],
+              "objectness_score": 0.8885737657546997,
+              "words": [
+                {
+                  "value": "(Analyse",
+                  "confidence": 0.9893469214439392,
+                  "geometry": [
+                    [
+                      0.7763671875,
+                      0.12859667687319887
+                    ],
+                    [
+                      0.888671875,
+                      0.15880116399495675
+                    ]
+                  ],
+                  "objectness_score": 0.8885737657546997,
+                  "crop_orientation": {
+                    "value": 0,
+                    "confidence": null
+                  }
+                }
+              ]
+            },
+            {
+              "geometry": [
+                [
+                  0.0322265625,
+                  0.16439458753602304
+                ],
+                [
+                  0.3017578125,
+                  0.19683644407420747
+                ]
+              ],
+              "objectness_score": 0.8225630521774292,
+              "words": [
+                {
+                  "value": "donneés",
+                  "confidence": 0.9632758498191833,
+                  "geometry": [
+                    [
+                      0.0322265625,
+                      0.16439458753602304
+                    ],
+                    [
+                      0.146484375,
+                      0.19348038994956773
+                    ]
+                  ],
+                  "objectness_score": 0.8078020215034485,
+                  "crop_orientation": {
+                    "value": 0,
+                    "confidence": null
+                  }
+                },
+                {
+                  "value": "pertinentes",
+                  "confidence": 0.6743541955947876,
+                  "geometry": [
+                    [
+                      0.158203125,
+                      0.1666319569524496
+                    ],
+                    [
+                      0.3017578125,
+                      0.19683644407420747
+                    ]
+                  ],
+                  "objectness_score": 0.8373240828514099,
+                  "crop_orientation": {
+                    "value": 0,
+                    "confidence": null
+                  }
+                }
+              ]
+            },
+            {
+              "geometry": [
+                [
+                  0.3720703125,
+                  0.1632759028278098
+                ],
+                [
+                  0.6298828125,
+                  0.19795512878242078
+                ]
+              ],
+              "objectness_score": 0.8254188895225525,
+              "words": [
+                {
+                  "value": "données,",
+                  "confidence": 0.9874939322471619,
+                  "geometry": [
+                    [
+                      0.3720703125,
+                      0.1632759028278098
+                    ],
+                    [
+                      0.4931640625,
+                      0.19795512878242078
+                    ]
+                  ],
+                  "objectness_score": 0.7603554725646973,
+                  "crop_orientation": {
+                    "value": 0,
+                    "confidence": null
+                  }
+                },
+                {
+                  "value": "créer",
+                  "confidence": 0.9589602947235107,
+                  "geometry": [
+                    [
+                      0.50390625,
+                      0.1655132722442363
+                    ],
+                    [
+                      0.572265625,
+                      0.19236170524135449
+                    ]
+                  ],
+                  "objectness_score": 0.8975253105163574,
+                  "crop_orientation": {
+                    "value": 0,
+                    "confidence": null
+                  }
+                },
+                {
+                  "value": "des",
+                  "confidence": 0.9953073859214783,
+                  "geometry": [
+                    [
+                      0.5810546875,
+                      0.16439458753602304
+                    ],
+                    [
+                      0.6298828125,
+                      0.19348038994956773
+                    ]
+                  ],
+                  "objectness_score": 0.8183758854866028,
+                  "crop_orientation": {
+                    "value": 0,
+                    "confidence": null
+                  }
+                }
+              ]
+            },
+            {
+              "geometry": [
+                [
+                  0.73828125,
+                  0.16439458753602304
+                ],
+                [
+                  0.9296875,
+                  0.19795512878242078
+                ]
+              ],
+              "objectness_score": 0.820769876241684,
+              "words": [
+                {
+                  "value": "exploratoire",
+                  "confidence": 0.9378995299339294,
+                  "geometry": [
+                    [
+                      0.73828125,
+                      0.16439458753602304
+                    ],
+                    [
+                      0.8935546875,
+                      0.19795512878242078
+                    ]
+                  ],
+                  "objectness_score": 0.7567607760429382,
+                  "crop_orientation": {
+                    "value": 0,
+                    "confidence": null
+                  }
+                },
+                {
+                  "value": "et",
+                  "confidence": 0.8651161193847656,
+                  "geometry": [
+                    [
+                      0.90234375,
+                      0.1666319569524496
+                    ],
+                    [
+                      0.9296875,
+                      0.19348038994956773
+                    ]
+                  ],
+                  "objectness_score": 0.8847789764404297,
+                  "crop_orientation": {
+                    "value": 0,
+                    "confidence": null
+                  }
+                }
+              ]
+            },
+            {
+              "geometry": [
+                [
+                  0.052734375,
+                  0.20131118290706052
+                ],
+                [
+                  0.2822265625,
+                  0.2326343547370317
+                ]
+              ],
+              "objectness_score": 0.8012694120407104,
+              "words": [
+                {
+                  "value": "comme",
+                  "confidence": 0.9968090653419495,
+                  "geometry": [
+                    [
+                      0.052734375,
+                      0.2069046064481268
+                    ],
+                    [
+                      0.1513671875,
+                      0.23151567002881845
+                    ]
+                  ],
+                  "objectness_score": 0.7506269216537476,
+                  "crop_orientation": {
+                    "value": 0,
+                    "confidence": null
+                  }
+                },
+                {
+                  "value": "la",
+                  "confidence": 0.9957412481307983,
+                  "geometry": [
+                    [
+                      0.1591796875,
+                      0.20131118290706052
+                    ],
+                    [
+                      0.1845703125,
+                      0.23151567002881845
+                    ]
+                  ],
+                  "objectness_score": 0.8192916512489319,
+                  "crop_orientation": {
+                    "value": 0,
+                    "confidence": null
+                  }
+                },
+                {
+                  "value": "méteo,",
+                  "confidence": 0.9663773775100708,
+                  "geometry": [
+                    [
+                      0.1923828125,
+                      0.20242986761527376
+                    ],
+                    [
+                      0.2822265625,
+                      0.2326343547370317
+                    ]
+                  ],
+                  "objectness_score": 0.8338896632194519,
+                  "crop_orientation": {
+                    "value": 0,
+                    "confidence": null
+                  }
+                }
+              ]
+            },
+            {
+              "geometry": [
+                [
+                  0.4404296875,
+                  0.203548552323487
+                ],
+                [
+                  0.55859375,
+                  0.2292783006123919
+                ]
+              ],
+              "objectness_score": 0.8311287760734558,
+              "words": [
+                {
+                  "value": "variables",
+                  "confidence": 0.5077484250068665,
+                  "geometry": [
+                    [
+                      0.4404296875,
+                      0.203548552323487
+                    ],
+                    [
+                      0.55859375,
+                      0.2292783006123919
+                    ]
+                  ],
+                  "objectness_score": 0.8311287760734558,
+                  "crop_orientation": {
+                    "value": 0,
+                    "confidence": null
+                  }
+                }
+              ]
+            },
+            {
+              "geometry": [
+                [
+                  0.7216796875,
+                  0.20242986761527376
+                ],
+                [
+                  0.9423828125,
+                  0.2303969853206052
+                ]
+              ],
+              "objectness_score": 0.8476908206939697,
+              "words": [
+                {
+                  "value": "visualisation",
+                  "confidence": 0.9528688788414001,
+                  "geometry": [
+                    [
+                      0.7216796875,
+                      0.20242986761527376
+                    ],
+                    [
+                      0.8837890625,
+                      0.2303969853206052
+                    ]
+                  ],
+                  "objectness_score": 0.7872260808944702,
+                  "crop_orientation": {
+                    "value": 0,
+                    "confidence": null
+                  }
+                },
+                {
+                  "value": "des",
+                  "confidence": 0.9943244457244873,
+                  "geometry": [
+                    [
+                      0.89453125,
+                      0.20242986761527376
+                    ],
+                    [
+                      0.9423828125,
+                      0.2303969853206052
+                    ]
+                  ],
+                  "objectness_score": 0.9081555604934692,
+                  "crop_orientation": {
+                    "value": 0,
+                    "confidence": null
+                  }
+                }
+              ]
+            },
+            {
+              "geometry": [
+                [
+                  0.0771484375,
+                  0.24046514769452448
+                ],
+                [
+                  0.2587890625,
+                  0.27402568894092216
+                ]
+              ],
+              "objectness_score": 0.8521583477656046,
+              "words": [
+                {
+                  "value": "date",
+                  "confidence": 0.9927149415016174,
+                  "geometry": [
+                    [
+                      0.0771484375,
+                      0.24158383240273773
+                    ],
+                    [
+                      0.134765625,
+                      0.2695509501080692
+                    ]
+                  ],
+                  "objectness_score": 0.8823536038398743,
+                  "crop_orientation": {
+                    "value": 0,
+                    "confidence": null
+                  }
+                },
+                {
+                  "value": "du",
+                  "confidence": 0.993779718875885,
+                  "geometry": [
+                    [
+                      0.142578125,
+                      0.24046514769452448
+                    ],
+                    [
+                      0.177734375,
+                      0.2706696348162824
+                    ]
+                  ],
+                  "objectness_score": 0.8689723014831543,
+                  "crop_orientation": {
+                    "value": 0,
+                    "confidence": null
+                  }
+                },
+                {
+                  "value": "vol...)",
+                  "confidence": 0.817709743976593,
+                  "geometry": [
+                    [
+                      0.185546875,
+                      0.24158383240273773
+                    ],
+                    [
+                      0.2587890625,
+                      0.27402568894092216
+                    ]
+                  ],
+                  "objectness_score": 0.8051491379737854,
+                  "crop_orientation": {
+                    "value": 0,
+                    "confidence": null
+                  }
+                }
+              ]
+            },
+            {
+              "geometry": [
+                [
+                  0.373046875,
+                  0.24270251711095103
+                ],
+                [
+                  0.625,
+                  0.27514437364913547
+                ]
+              ],
+              "objectness_score": 0.7972156405448914,
+              "words": [
+                {
+                  "value": "supplementaires...)",
+                  "confidence": 0.7050409913063049,
+                  "geometry": [
+                    [
+                      0.373046875,
+                      0.24270251711095103
+                    ],
+                    [
+                      0.625,
+                      0.27514437364913547
+                    ]
+                  ],
+                  "objectness_score": 0.7972156405448914,
+                  "crop_orientation": {
+                    "value": 0,
+                    "confidence": null
+                  }
+                }
+              ]
+            },
+            {
+              "geometry": [
+                [
+                  0.771484375,
+                  0.24270251711095103
+                ],
+                [
+                  0.892578125,
+                  0.27290700423270897
+                ]
+              ],
+              "objectness_score": 0.8575900197029114,
+              "words": [
+                {
+                  "value": "donnees)",
+                  "confidence": 0.7150509357452393,
+                  "geometry": [
+                    [
+                      0.771484375,
+                      0.24270251711095103
+                    ],
+                    [
+                      0.892578125,
+                      0.27290700423270897
+                    ]
+                  ],
+                  "objectness_score": 0.8575900197029114,
+                  "crop_orientation": {
+                    "value": 0,
+                    "confidence": null
+                  }
+                }
+              ]
+            },
+            {
+              "geometry": [
+                [
+                  0.396484375,
+                  0.3590457267651297
+                ],
+                [
+                  0.60546875,
+                  0.38813152917867433
+                ]
+              ],
+              "objectness_score": 0.838508129119873,
+              "words": [
+                {
+                  "value": "Evaluation",
+                  "confidence": 0.9654068946838379,
+                  "geometry": [
+                    [
+                      0.396484375,
+                      0.3612830961815562
+                    ],
+                    [
+                      0.5439453125,
+                      0.38589415976224783
+                    ]
+                  ],
+                  "objectness_score": 0.8400536775588989,
+                  "crop_orientation": {
+                    "value": 0,
+                    "confidence": null
+                  }
+                },
+                {
+                  "value": "des",
+                  "confidence": 0.9658872485160828,
+                  "geometry": [
+                    [
+                      0.5546875,
+                      0.3590457267651297
+                    ],
+                    [
+                      0.60546875,
+                      0.38813152917867433
+                    ]
+                  ],
+                  "objectness_score": 0.8369625806808472,
+                  "crop_orientation": {
+                    "value": 0,
+                    "confidence": null
+                  }
+                }
+              ]
+            },
+            {
+              "geometry": [
+                [
+                  0.0458984375,
+                  0.37806336680475505
+                ],
+                [
+                  0.291015625,
+                  0.40603048451008644
+                ]
+              ],
+              "objectness_score": 0.8438914716243744,
+              "words": [
+                {
+                  "value": "Visualisation",
+                  "confidence": 0.8689184188842773,
+                  "geometry": [
+                    [
+                      0.0458984375,
+                      0.3791820515129683
+                    ],
+                    [
+                      0.228515625,
+                      0.40379311509365995
+                    ]
+                  ],
+                  "objectness_score": 0.8300719857215881,
+                  "crop_orientation": {
+                    "value": 0,
+                    "confidence": null
+                  }
+                },
+                {
+                  "value": "des",
+                  "confidence": 0.998823344707489,
+                  "geometry": [
+                    [
+                      0.23828125,
+                      0.37806336680475505
+                    ],
+                    [
+                      0.291015625,
+                      0.40603048451008644
+                    ]
+                  ],
+                  "objectness_score": 0.8577109575271606,
+                  "crop_orientation": {
+                    "value": 0,
+                    "confidence": null
+                  }
+                }
+              ]
+            },
+            {
+              "geometry": [
+                [
+                  0.7421875,
+                  0.3791820515129683
+                ],
+                [
+                  0.9208984375,
+                  0.40379311509365995
+                ]
+              ],
+              "objectness_score": 0.8251617550849915,
+              "words": [
+                {
+                  "value": "Modelisation",
+                  "confidence": 0.962478756904602,
+                  "geometry": [
+                    [
+                      0.7421875,
+                      0.3791820515129683
+                    ],
+                    [
+                      0.9208984375,
+                      0.40379311509365995
+                    ]
+                  ],
+                  "objectness_score": 0.8251617550849915,
+                  "crop_orientation": {
+                    "value": 0,
+                    "confidence": null
+                  }
+                }
+              ]
+            },
+            {
+              "geometry": [
+                [
+                  0.40234375,
+                  0.39819969155259366
+                ],
+                [
+                  0.5986328125,
+                  0.43176023279899134
+                ]
+              ],
+              "objectness_score": 0.6945668458938599,
+              "words": [
+                {
+                  "value": "performances",
+                  "confidence": 0.9785539507865906,
+                  "geometry": [
+                    [
+                      0.40234375,
+                      0.39819969155259366
+                    ],
+                    [
+                      0.5986328125,
+                      0.43176023279899134
+                    ]
+                  ],
+                  "objectness_score": 0.6945668458938599,
+                  "crop_orientation": {
+                    "value": 0,
+                    "confidence": null
+                  }
+                }
+              ]
+            },
+            {
+              "geometry": [
+                [
+                  0.107421875,
+                  0.41833601630043227
+                ],
+                [
+                  0.2294921875,
+                  0.44406576458933716
+                ]
+              ],
+              "objectness_score": 0.7634888291358948,
+              "words": [
+                {
+                  "value": "resultats",
+                  "confidence": 0.9981811046600342,
+                  "geometry": [
+                    [
+                      0.107421875,
+                      0.41833601630043227
+                    ],
+                    [
+                      0.2294921875,
+                      0.44406576458933716
+                    ]
+                  ],
+                  "objectness_score": 0.7634888291358948,
+                  "crop_orientation": {
+                    "value": 0,
+                    "confidence": null
+                  }
+                }
+              ]
+            },
+            {
+              "geometry": [
+                [
+                  0.75,
+                  0.417217331592219
+                ],
+                [
+                  0.9130859375,
+                  0.4507778728386167
+                ]
+              ],
+              "objectness_score": 0.7848072648048401,
+              "words": [
+                {
+                  "value": "(Prediction)",
+                  "confidence": 0.6085659265518188,
+                  "geometry": [
+                    [
+                      0.75,
+                      0.417217331592219
+                    ],
+                    [
+                      0.9130859375,
+                      0.4507778728386167
+                    ]
+                  ],
+                  "objectness_score": 0.7848072648048401,
+                  "crop_orientation": {
+                    "value": 0,
+                    "confidence": null
+                  }
+                }
+              ]
+            },
+            {
+              "geometry": [
+                [
+                  0.44921875,
+                  0.4384723410482709
+                ],
+                [
+                  0.5517578125,
+                  0.46420208933717577
+                ]
+              ],
+              "objectness_score": 0.8305306434631348,
+              "words": [
+                {
+                  "value": "modele",
+                  "confidence": 0.9977617263793945,
+                  "geometry": [
+                    [
+                      0.44921875,
+                      0.4384723410482709
+                    ],
+                    [
+                      0.5517578125,
+                      0.46420208933717577
+                    ]
+                  ],
+                  "objectness_score": 0.8305306434631348,
+                  "crop_orientation": {
+                    "value": 0,
+                    "confidence": null
+                  }
+                }
+              ]
+            },
+            {
+              "geometry": [
+                [
+                  0.0771484375,
+                  0.45525261167146974
+                ],
+                [
+                  0.2626953125,
+                  0.48657578350144093
+                ]
+              ],
+              "objectness_score": 0.8596967160701752,
+              "words": [
+                {
+                  "value": "(Presenter",
+                  "confidence": 0.6310722231864929,
+                  "geometry": [
+                    [
+                      0.0771484375,
+                      0.456371296379683
+                    ],
+                    [
+                      0.2138671875,
+                      0.48657578350144093
+                    ]
+                  ],
+                  "objectness_score": 0.8357106447219849,
+                  "crop_orientation": {
+                    "value": 0,
+                    "confidence": null
+                  }
+                },
+                {
+                  "value": "les",
+                  "confidence": 0.9968156218528748,
+                  "geometry": [
+                    [
+                      0.22265625,
+                      0.45525261167146974
+                    ],
+                    [
+                      0.2626953125,
+                      0.48433841408501443
+                    ]
+                  ],
+                  "objectness_score": 0.8836827874183655,
+                  "crop_orientation": {
+                    "value": 0,
+                    "confidence": null
+                  }
+                }
+              ]
+            },
+            {
+              "geometry": [
+                [
+                  0.70703125,
+                  0.4541339269632565
+                ],
+                [
+                  0.9580078125,
+                  0.4888131529178674
+                ]
+              ],
+              "objectness_score": 0.8198439876238505,
+              "words": [
+                {
+                  "value": "(Choisir",
+                  "confidence": 0.9063538908958435,
+                  "geometry": [
+                    [
+                      0.70703125,
+                      0.4541339269632565
+                    ],
+                    [
+                      0.8095703125,
+                      0.4888131529178674
+                    ]
+                  ],
+                  "objectness_score": 0.8057355284690857,
+                  "crop_orientation": {
+                    "value": 0,
+                    "confidence": null
+                  }
+                },
+                {
+                  "value": "un",
+                  "confidence": 0.9998005032539368,
+                  "geometry": [
+                    [
+                      0.8173828125,
+                      0.46084603521253603
+                    ],
+                    [
+                      0.8525390625,
+                      0.4854570987932277
+                    ]
+                  ],
+                  "objectness_score": 0.7646810412406921,
+                  "crop_orientation": {
+                    "value": 0,
+                    "confidence": null
+                  }
+                },
+                {
+                  "value": "modele",
+                  "confidence": 0.9942703247070312,
+                  "geometry": [
+                    [
+                      0.861328125,
+                      0.45748998108789624
+                    ],
+                    [
+                      0.9580078125,
+                      0.4821010446685879
+                    ]
+                  ],
+                  "objectness_score": 0.8891153931617737,
+                  "crop_orientation": {
+                    "value": 0,
+                    "confidence": null
+                  }
+                }
+              ]
+            },
+            {
+              "geometry": [
+                [
+                  0.3662109375,
+                  0.4742702517110951
+                ],
+                [
+                  0.6318359375,
+                  0.5111868470821326
+                ]
+              ],
+              "objectness_score": 0.8241175611813863,
+              "words": [
+                {
+                  "value": "(voir",
+                  "confidence": 0.9973810315132141,
+                  "geometry": [
+                    [
+                      0.3662109375,
+                      0.4742702517110951
+                    ],
+                    [
+                      0.4267578125,
+                      0.5111868470821326
+                    ]
+                  ],
+                  "objectness_score": 0.8463975191116333,
+                  "crop_orientation": {
+                    "value": 0,
+                    "confidence": null
+                  }
+                },
+                {
+                  "value": "la",
+                  "confidence": 0.9981163740158081,
+                  "geometry": [
+                    [
+                      0.43359375,
+                      0.4742702517110951
+                    ],
+                    [
+                      0.4580078125,
+                      0.5055934235410663
+                    ]
+                  ],
+                  "objectness_score": 0.8432861566543579,
+                  "crop_orientation": {
+                    "value": 0,
+                    "confidence": null
+                  }
+                },
+                {
+                  "value": "performance",
+                  "confidence": 0.9783651232719421,
+                  "geometry": [
+                    [
+                      0.466796875,
+                      0.47762630583573484
+                    ],
+                    [
+                      0.6318359375,
+                      0.5078307929574928
+                    ]
+                  ],
+                  "objectness_score": 0.7826690077781677,
+                  "crop_orientation": {
+                    "value": 0,
+                    "confidence": null
+                  }
+                }
+              ]
+            },
+            {
+              "geometry": [
+                [
+                  0.060546875,
+                  0.49552526116714696
+                ],
+                [
+                  0.27734375,
+                  0.525729748288905
+                ]
+              ],
+              "objectness_score": 0.8490830659866333,
+              "words": [
+                {
+                  "value": "predictions",
+                  "confidence": 0.5426515936851501,
+                  "geometry": [
+                    [
+                      0.060546875,
+                      0.49552526116714696
+                    ],
+                    [
+                      0.2021484375,
+                      0.525729748288905
+                    ]
+                  ],
+                  "objectness_score": 0.8191495537757874,
+                  "crop_orientation": {
+                    "value": 0,
+                    "confidence": null
+                  }
+                },
+                {
+                  "value": "dans",
+                  "confidence": 0.9975013136863708,
+                  "geometry": [
+                    [
+                      0.2138671875,
+                      0.49552526116714696
+                    ],
+                    [
+                      0.27734375,
+                      0.5223736941642652
+                    ]
+                  ],
+                  "objectness_score": 0.8790165781974792,
+                  "crop_orientation": {
+                    "value": 0,
+                    "confidence": null
+                  }
+                }
+              ]
+            },
+            {
+              "geometry": [
+                [
+                  0.693359375,
+                  0.4944065764589337
+                ],
+                [
+                  0.96875,
+                  0.525729748288905
+                ]
+              ],
+              "objectness_score": 0.8130820393562317,
+              "words": [
+                {
+                  "value": "et",
+                  "confidence": 0.8902291655540466,
+                  "geometry": [
+                    [
+                      0.693359375,
+                      0.4944065764589337
+                    ],
+                    [
+                      0.724609375,
+                      0.525729748288905
+                    ]
+                  ],
+                  "objectness_score": 0.7699534296989441,
+                  "crop_orientation": {
+                    "value": 0,
+                    "confidence": null
+                  }
+                },
+                {
+                  "value": "l'entrainer",
+                  "confidence": 0.91228187084198,
+                  "geometry": [
+                    [
+                      0.7314453125,
+                      0.49552526116714696
+                    ],
+                    [
+                      0.861328125,
+                      0.5212550094560519
+                    ]
+                  ],
+                  "objectness_score": 0.8133661150932312,
+                  "crop_orientation": {
+                    "value": 0,
+                    "confidence": null
+                  }
+                },
+                {
+                  "value": "sur",
+                  "confidence": 0.9974398612976074,
+                  "geometry": [
+                    [
+                      0.8701171875,
+                      0.5
+                    ],
+                    [
+                      0.9130859375,
+                      0.5223736941642652
+                    ]
+                  ],
+                  "objectness_score": 0.8441946506500244,
+                  "crop_orientation": {
+                    "value": 0,
+                    "confidence": null
+                  }
+                },
+                {
+                  "value": "des",
+                  "confidence": 0.9702199697494507,
+                  "geometry": [
+                    [
+                      0.919921875,
+                      0.4944065764589337
+                    ],
+                    [
+                      0.96875,
+                      0.5234923788724783
+                    ]
+                  ],
+                  "objectness_score": 0.824813961982727,
+                  "crop_orientation": {
+                    "value": 0,
+                    "confidence": null
+                  }
+                }
+              ]
+            },
+            {
+              "geometry": [
+                [
+                  0.375,
+                  0.5123055317903458
+                ],
+                [
+                  0.625,
+                  0.543628703620317
+                ]
+              ],
+              "objectness_score": 0.8126386255025864,
+              "words": [
+                {
+                  "value": "du",
+                  "confidence": 0.9909602403640747,
+                  "geometry": [
+                    [
+                      0.375,
+                      0.5123055317903458
+                    ],
+                    [
+                      0.41015625,
+                      0.543628703620317
+                    ]
+                  ],
+                  "objectness_score": 0.8536072373390198,
+                  "crop_orientation": {
+                    "value": 0,
+                    "confidence": null
+                  }
+                },
+                {
+                  "value": "modele",
+                  "confidence": 0.8897013664245605,
+                  "geometry": [
+                    [
+                      0.4189453125,
+                      0.5134242164985591
+                    ],
+                    [
+                      0.5166015625,
+                      0.5425100189121037
+                    ]
+                  ],
+                  "objectness_score": 0.8270806074142456,
+                  "crop_orientation": {
+                    "value": 0,
+                    "confidence": null
+                  }
+                },
+                {
+                  "value": "sur",
+                  "confidence": 0.9979320764541626,
+                  "geometry": [
+                    [
+                      0.5244140625,
+                      0.5190176400396254
+                    ],
+                    [
+                      0.5693359375,
+                      0.543628703620317
+                    ]
+                  ],
+                  "objectness_score": 0.7769684195518494,
+                  "crop_orientation": {
+                    "value": 0,
+                    "confidence": null
+                  }
+                },
+                {
+                  "value": "des",
+                  "confidence": 0.8242294788360596,
+                  "geometry": [
+                    [
+                      0.576171875,
+                      0.5134242164985591
+                    ],
+                    [
+                      0.625,
+                      0.5425100189121037
+                    ]
+                  ],
+                  "objectness_score": 0.7928982377052307,
+                  "crop_orientation": {
+                    "value": 0,
+                    "confidence": null
+                  }
+                }
+              ]
+            },
+            {
+              "geometry": [
+                [
+                  0.0927734375,
+                  0.5346792259546109
+                ],
+                [
+                  0.2412109375,
+                  0.5648837130763689
+                ]
+              ],
+              "objectness_score": 0.8164286017417908,
+              "words": [
+                {
+                  "value": "dashboard)",
+                  "confidence": 0.9945673942565918,
+                  "geometry": [
+                    [
+                      0.0927734375,
+                      0.5346792259546109
+                    ],
+                    [
+                      0.2412109375,
+                      0.5648837130763689
+                    ]
+                  ],
+                  "objectness_score": 0.8164286017417908,
+                  "crop_orientation": {
+                    "value": 0,
+                    "confidence": null
+                  }
+                }
+              ]
+            },
+            {
+              "geometry": [
+                [
+                  0.697265625,
+                  0.5335605412463977
+                ],
+                [
+                  0.96484375,
+                  0.5671210824927954
+                ]
+              ],
+              "objectness_score": 0.7987184822559357,
+              "words": [
+                {
+                  "value": "données",
+                  "confidence": 0.9885821342468262,
+                  "geometry": [
+                    [
+                      0.697265625,
+                      0.5335605412463977
+                    ],
+                    [
+                      0.8125,
+                      0.5626463436599424
+                    ]
+                  ],
+                  "objectness_score": 0.8079077005386353,
+                  "crop_orientation": {
+                    "value": 0,
+                    "confidence": null
+                  }
+                },
+                {
+                  "value": "histiriques)",
+                  "confidence": 0.950248658657074,
+                  "geometry": [
+                    [
+                      0.822265625,
+                      0.5335605412463977
+                    ],
+                    [
+                      0.96484375,
+                      0.5671210824927954
+                    ]
+                  ],
+                  "objectness_score": 0.7895292639732361,
+                  "crop_orientation": {
+                    "value": 0,
+                    "confidence": null
+                  }
+                }
+              ]
+            },
+            {
+              "geometry": [
+                [
+                  0.373046875,
+                  0.5536968659942363
+                ],
+                [
+                  0.626953125,
+                  0.5850200378242075
+                ]
+              ],
+              "objectness_score": 0.8351868987083435,
+              "words": [
+                {
+                  "value": "données",
+                  "confidence": 0.8836828470230103,
+                  "geometry": [
+                    [
+                      0.373046875,
+                      0.5536968659942363
+                    ],
+                    [
+                      0.4873046875,
+                      0.5794266142831412
+                    ]
+                  ],
+                  "objectness_score": 0.8597532510757446,
+                  "crop_orientation": {
+                    "value": 0,
+                    "confidence": null
+                  }
+                },
+                {
+                  "value": "non",
+                  "confidence": 0.9986007809638977,
+                  "geometry": [
+                    [
+                      0.4970703125,
+                      0.5581716048270894
+                    ],
+                    [
+                      0.5458984375,
+                      0.5805452989913544
+                    ]
+                  ],
+                  "objectness_score": 0.8361157774925232,
+                  "crop_orientation": {
+                    "value": 0,
+                    "confidence": null
+                  }
+                },
+                {
+                  "value": "vues)",
+                  "confidence": 0.9901139736175537,
+                  "geometry": [
+                    [
+                      0.5537109375,
+                      0.5536968659942363
+                    ],
+                    [
+                      0.626953125,
+                      0.5850200378242075
+                    ]
+                  ],
+                  "objectness_score": 0.8096916675567627,
+                  "crop_orientation": {
+                    "value": 0,
+                    "confidence": null
+                  }
+                }
+              ]
+            },
+            {
+              "geometry": [
+                [
+                  0.4130859375,
+                  0.713668779268732
+                ],
+                [
+                  0.5888671875,
+                  0.7427545816822767
+                ]
+              ],
+              "objectness_score": 0.850524365901947,
+              "words": [
+                {
+                  "value": "Deploiement",
+                  "confidence": 0.6806442737579346,
+                  "geometry": [
+                    [
+                      0.4130859375,
+                      0.713668779268732
+                    ],
+                    [
+                      0.5888671875,
+                      0.7427545816822767
+                    ]
+                  ],
+                  "objectness_score": 0.850524365901947,
+                  "crop_orientation": {
+                    "value": 0,
+                    "confidence": null
+                  }
+                }
+              ]
+            },
+            {
+              "geometry": [
+                [
+                  0.3740234375,
+                  0.7729590688040346
+                ],
+                [
+                  0.6259765625,
+                  0.8076382947586456
+                ]
+              ],
+              "objectness_score": 0.8079845110575358,
+              "words": [
+                {
+                  "value": "(déploie",
+                  "confidence": 0.9897415637969971,
+                  "geometry": [
+                    [
+                      0.3740234375,
+                      0.7729590688040346
+                    ],
+                    [
+                      0.4873046875,
+                      0.8076382947586456
+                    ]
+                  ],
+                  "objectness_score": 0.7893381118774414,
+                  "crop_orientation": {
+                    "value": 0,
+                    "confidence": null
+                  }
+                },
+                {
+                  "value": "le",
+                  "confidence": 0.9997684359550476,
+                  "geometry": [
+                    [
+                      0.49609375,
+                      0.7729590688040346
+                    ],
+                    [
+                      0.521484375,
+                      0.8031635559257926
+                    ]
+                  ],
+                  "objectness_score": 0.7943187355995178,
+                  "crop_orientation": {
+                    "value": 0,
+                    "confidence": null
+                  }
+                },
+                {
+                  "value": "modèle",
+                  "confidence": 0.9219999313354492,
+                  "geometry": [
+                    [
+                      0.5302734375,
+                      0.775196438220461
+                    ],
+                    [
+                      0.6259765625,
+                      0.800926186509366
+                    ]
+                  ],
+                  "objectness_score": 0.8402966856956482,
+                  "crop_orientation": {
+                    "value": 0,
+                    "confidence": null
+                  }
+                }
+              ]
+            },
+            {
+              "geometry": [
+                [
+                  0.369140625,
+                  0.8177064571325648
+                ],
+                [
+                  0.6318359375,
+                  0.8467922595461095
+                ]
+              ],
+              "objectness_score": 0.8303013145923615,
+              "words": [
+                {
+                  "value": "sur",
+                  "confidence": 0.9938849806785583,
+                  "geometry": [
+                    [
+                      0.369140625,
+                      0.8188251418407781
+                    ],
+                    [
+                      0.412109375,
+                      0.8411988360050433
+                    ]
+                  ],
+                  "objectness_score": 0.8680939674377441,
+                  "crop_orientation": {
+                    "value": 0,
+                    "confidence": null
+                  }
+                },
+                {
+                  "value": "un",
+                  "confidence": 0.9983118772506714,
+                  "geometry": [
+                    [
+                      0.4189453125,
+                      0.8188251418407781
+                    ],
+                    [
+                      0.4541015625,
+                      0.8411988360050433
+                    ]
+                  ],
+                  "objectness_score": 0.8339855670928955,
+                  "crop_orientation": {
+                    "value": 0,
+                    "confidence": null
+                  }
+                },
+                {
+                  "value": "serveur",
+                  "confidence": 0.9163511395454407,
+                  "geometry": [
+                    [
+                      0.4609375,
+                      0.8177064571325648
+                    ],
+                    [
+                      0.5625,
+                      0.8411988360050433
+                    ]
+                  ],
+                  "objectness_score": 0.7940940856933594,
+                  "crop_orientation": {
+                    "value": 0,
+                    "confidence": null
+                  }
+                },
+                {
+                  "value": "pour",
+                  "confidence": 0.9337925910949707,
+                  "geometry": [
+                    [
+                      0.5712890625,
+                      0.8188251418407781
+                    ],
+                    [
+                      0.6318359375,
+                      0.8467922595461095
+                    ]
+                  ],
+                  "objectness_score": 0.8250316381454468,
+                  "crop_orientation": {
+                    "value": 0,
+                    "confidence": null
+                  }
+                }
+              ]
+            },
+            {
+              "geometry": [
+                [
+                  0.3994140625,
+                  0.8512669983789625
+                ],
+                [
+                  0.599609375,
+                  0.8870649090417868
+                ]
+              ],
+              "objectness_score": 0.7906262278556824,
+              "words": [
+                {
+                  "value": "qu'il",
+                  "confidence": 0.5704904198646545,
+                  "geometry": [
+                    [
+                      0.3994140625,
+                      0.8512669983789625
+                    ],
+                    [
+                      0.4521484375,
+                      0.8870649090417868
+                    ]
+                  ],
+                  "objectness_score": 0.7620018124580383,
+                  "crop_orientation": {
+                    "value": 0,
+                    "confidence": null
+                  }
+                },
+                {
+                  "value": "fonctionne",
+                  "confidence": 0.9132682085037231,
+                  "geometry": [
+                    [
+                      0.462890625,
+                      0.8523856830871758
+                    ],
+                    [
+                      0.599609375,
+                      0.8781154313760806
+                    ]
+                  ],
+                  "objectness_score": 0.8192506432533264,
+                  "crop_orientation": {
+                    "value": 0,
+                    "confidence": null
+                  }
+                }
+              ]
+            },
+            {
+              "geometry": [
+                [
+                  0.375,
+                  0.8904209631664265
+                ],
+                [
+                  0.625,
+                  0.9239815044128242
+                ]
+              ],
+              "objectness_score": 0.5923550923665365,
+              "words": [
+                {
+                  "value": "automatiquement",
+                  "confidence": 0.7246941924095154,
+                  "geometry": [
+                    [
+                      0.375,
+                      0.8904209631664265
+                    ],
+                    [
+                      0.611328125,
+                      0.9239815044128242
+                    ]
+                  ],
+                  "objectness_score": 0.7002537250518799,
+                  "crop_orientation": {
+                    "value": 0,
+                    "confidence": null
+                  }
+                },
+                {
+                  "value": "-",
+                  "confidence": 0.4151031970977783,
+                  "geometry": [
+                    [
+                      0.6083984375,
+                      0.9027264949567724
+                    ],
+                    [
+                      0.6162109375,
+                      0.913913342038905
+                    ]
+                  ],
+                  "objectness_score": 0.5287280082702637,
+                  "crop_orientation": {
+                    "value": 0,
+                    "confidence": null
+                  }
+                },
+                {
+                  "value": ")",
+                  "confidence": 0.4633558988571167,
+                  "geometry": [
+                    [
+                      0.615234375,
+                      0.892658332582853
+                    ],
+                    [
+                      0.625,
+                      0.9072012337896254
+                    ]
+                  ],
+                  "objectness_score": 0.5480835437774658,
+                  "crop_orientation": {
+                    "value": 0,
+                    "confidence": null
+                  }
+                }
+              ]
+            }
+          ],
+          "artefacts": []
+        }
+      ]
+    }
+  ]
+}

Dosya farkı çok büyük olduğundan ihmal edildi
+ 25 - 0
src/uploads/ocr_output_words.html


BIN
src/uploads/processus_.png


BIN
src/uploads/reg_chunk.png


+ 0 - 0
src/utils/__init__.py


BIN
src/utils/__pycache__/__init__.cpython-312.pyc


BIN
src/utils/__pycache__/ocr.cpython-312.pyc


BIN
src/utils/__pycache__/processing.cpython-312.pyc


BIN
src/utils/__pycache__/security.cpython-312.pyc


+ 162 - 0
src/utils/ocr.py

@@ -0,0 +1,162 @@
+import os
+import json
+from doctr.io import DocumentFile
+from doctr.models import ocr_predictor
+
+
+def load_document(file_path: str):
+    ext = os.path.splitext(file_path)[-1].lower()
+    if ext == ".pdf":
+        return DocumentFile.from_pdf(file_path)
+    elif ext in [".png", ".jpg", ".jpeg"]:
+        return DocumentFile.from_images(file_path)
+    else:
+        raise ValueError(f"Type de fichier non supporté: {ext}")
+
+
+def run_ocr(file_path: str):
+    doc = load_document(file_path)
+    model = ocr_predictor(pretrained=True)
+    result = model(doc)
+    output = result.export()
+    return doc, output
+
+
+def generate_html(output, output_html_path="ocr_output.html"):
+    html_head = """
+    <html><head><meta charset="utf-8"><title>Résultat OCR Organisé</title>
+    <style>
+      body { font-family: Arial, sans-serif; background: #f0f0f0; }
+      .page {
+        position: relative;
+        width: 800px; height: 1120px; /* ratio approx A4 */
+        margin: 20px auto;
+        background: white;
+        box-shadow: 0 0 8px rgba(0,0,0,0.2);
+      }
+      .block {
+        position: absolute;
+        border: 1px solid rgba(255,0,0,0.5);
+        background: rgba(255,255,255,0.7);
+        padding: 4px;
+        font-size: 14px;
+        line-height: 1.2em;
+        overflow-wrap: break-word;
+      }
+    </style>
+    </head><body>
+    <h1>Résultat OCR Organisé</h1>
+    """
+
+    html_body = ""
+
+    for page_idx, page in enumerate(output['pages']):
+        html_body += f'<div class="page"><h2>Page {page_idx + 1}</h2>'
+
+        # Pour chaque bloc de texte, positionner la div selon la bounding box normalisée
+        for block in page['blocks']:
+            # bbox format: [[x_min, y_min], [x_max, y_max]] (normé 0-1)
+            (x_min, y_min), (x_max, y_max) = block['geometry']
+            left = x_min * 800  # correspond à width page
+            top = y_min * 1120  # correspond à height page
+            width = (x_max - x_min) * 800
+            height = (y_max - y_min) * 1120
+
+            # Récupérer le texte complet du bloc (concaténation des lignes et mots)
+            block_text = ""
+            for line in block['lines']:
+                line_text = " ".join(word['value'] for word in line['words'])
+                block_text += line_text + "<br>"
+
+            html_body += f'<div class="block" style="left:{left}px; top:{top}px; width:{width}px; height:{height}px;">{block_text}</div>'
+
+        html_body += "</div>"  # fin page div
+
+    html_tail = "</body></html>"
+
+    with open(output_html_path, "w", encoding="utf-8") as f:
+        f.write(html_head + html_body + html_tail)
+
+    print(f"Fichier HTML sauvegardé sous : {output_html_path}")
+
+
+
+
+def extract_text_from_file(file_path: str) -> str:
+    _, output = run_ocr(file_path)
+    text = ""
+
+    for page in output['pages']:
+        for block in page['blocks']:
+            for line in block['lines']:
+                for word in line['words']:
+                    text += word['value'] + " "
+                text += "\n"
+            text += "\n"
+        text += "\n"
+
+    # Sauvegarde du JSON OCR
+    with open("uploads/ocr_output.json", "w", encoding="utf-8") as fjson:
+        json.dump(output, fjson, ensure_ascii=False, indent=2)
+
+    # Génération HTML
+    generate_html(output)
+
+    return text
+ 
+
+
+def generate_word_level_html(output, output_html_path="uploads/ocr_output_words.html"):
+    html_head = """
+    <html><head><meta charset="utf-8"><title>OCR mots avec bounding boxes</title>
+    <style>
+      body { font-family: Arial, sans-serif; background: #f0f0f0; }
+      .page {
+        position: relative;
+        width: 800px; height: 1120px; /* ratio A4 approx */
+        margin: 20px auto;
+        background: white;
+        box-shadow: 0 0 8px rgba(0,0,0,0.2);
+      }
+      .word {
+        position: absolute;
+        border: 1px solid rgba(0, 0, 255, 0.5);
+        background: rgba(255,255,255,0.8);
+        font-size: 12px;
+        line-height: 1em;
+        padding: 1px 2px;
+        white-space: nowrap;
+        overflow: hidden;
+        text-overflow: ellipsis;
+      }
+    </style>
+    </head><body>
+    <h1>OCR mots avec bounding boxes</h1>
+    """
+
+    html_body = ""
+
+    for page_idx, page in enumerate(output['pages']):
+        html_body += f'<div class="page"><h2>Page {page_idx + 1}</h2>'
+
+        for block in page['blocks']:
+            for line in block['lines']:
+                for word in line['words']:
+                    # bbox normalized format: [[x_min, y_min], [x_max, y_max]]
+                    (x_min, y_min), (x_max, y_max) = word['geometry']
+                    left = x_min * 800
+                    top = y_min * 1120
+                    width = (x_max - x_min) * 800
+                    height = (y_max - y_min) * 1120
+
+                    word_text = word['value']
+                    html_body += f'<div class="word" style="left:{left}px; top:{top}px; width:{width}px; height:{height}px;">{word_text}</div>'
+
+        html_body += "</div>"  # fin page
+
+    html_tail = "</body></html>"
+
+    with open(output_html_path, "w", encoding="utf-8") as f:
+        f.write(html_head + html_body + html_tail)
+
+    print(f"Fichier HTML mots sauvegardé sous : {output_html_path}")

+ 115 - 0
src/utils/processing.py

@@ -0,0 +1,115 @@
+import os
+import json
+import re
+import faiss
+import numpy as np
+from sentence_transformers import SentenceTransformer
+from src.agent_ai.chunking import semantic_chunking
+from src.agent_ai.scraping import scrape_pages
+
+
+
+# === Paths ===
+os.makedirs("data", exist_ok=True)
+CHUNKS_FILE = "data/All_chunks.json"
+INDEX_FILE = "data/faiss_index.index"
+RAW_PAGES_FILE = "data/raw_pages.json"
+
+# === Embedding Model ===
+'''model = SentenceTransformer(
+    'nomic-ai/nomic-embed-text-v1',
+    device='cuda',
+    trust_remote_code=True
+)'''
+model = SentenceTransformer('sentence-transformers/all-MiniLM-L6-v2', device='cpu')
+
+
+# === Cleaning Utility ===
+def clean_text(text):
+    text = re.sub(r"~~.*?~~", " ", text)
+    text = re.sub(r"<[^>]+>", " ", text)
+    text = re.sub(r"[^\x00-\x7FÀ-ÿ]+", " ", text)
+    text = re.sub(r"\s+", " ", text)
+    return text.strip()
+
+# === Step 2: Update Chunks ===
+def update_chunks(pages_dict):
+    all_chunks = []
+    if os.path.exists(CHUNKS_FILE):
+        try:
+            with open(CHUNKS_FILE, "r", encoding="utf-8") as f:
+                all_chunks = json.load(f)
+        except Exception as e:
+            print(f"⚠️ Could not load old chunks: {e}")
+
+    # Supprimer tous les chunks des URLs modifiées
+    existing_urls = set(pages_dict.keys())
+    all_chunks = [c for c in all_chunks if c.get("url") not in existing_urls]
+
+    new_chunks = []
+    chunk_id_start = len(all_chunks)
+
+    for url, text in pages_dict.items():
+        cleaned = clean_text(text)
+        if not cleaned:
+            continue
+        chunks = semantic_chunking(cleaned, with_metadata=True)
+        for ch in chunks:
+            if not isinstance(ch, dict) or not isinstance(ch.get("text"), str):
+                print(f"⚠️ Ignored malformed chunk: {ch}")
+                continue
+
+            new_chunks.append({
+                "chunk_id": chunk_id_start + len(new_chunks),
+                "text": ch["text"],
+                "url": url,
+                "word_count": ch["word_count"],
+                "token_count": ch["token_count"]
+            })
+
+    all_chunks.extend(new_chunks)
+    with open(CHUNKS_FILE, "w", encoding="utf-8") as f:
+        json.dump(all_chunks, f, indent=2, ensure_ascii=False)
+
+    print(f"📄 Chunks updated: {len(new_chunks)} new chunks added, total chunks: {len(all_chunks)}.")
+    return all_chunks
+
+# === Step 3: Build Index ===
+def build_and_save_index(chunks):
+    if not chunks:
+        print("⚠️ No chunks to index.")
+        return None
+
+    texts = [c["text"] for c in chunks]
+    embeddings = model.encode(texts, convert_to_tensor=False, batch_size=4)
+
+    if len(embeddings) == 0:
+        print("⚠️ Embeddings generation failed or empty.")
+        return None
+
+    dim = len(embeddings[0])
+    index = faiss.IndexFlatL2(dim)
+    index.add(np.array(embeddings).astype("float32"))
+    faiss.write_index(index, INDEX_FILE)
+
+    print(f"✅ FAISS index saved at '{INDEX_FILE}' with {len(texts)} vectors.")
+    return index
+
+
+# === Full Pipeline ===
+def full_update_pipeline():
+    print("🔄 Pipeline complet déclenché...")
+
+    pages = scrape_pages()
+    page_dict = {p["url"]: p["text"] for p in pages if "url" in p and "text" in p}
+
+    if not page_dict:
+        print("⚠️ Aucune page récupérée.")
+        return
+
+    chunks = update_chunks(page_dict)
+    build_and_save_index(chunks)
+
+# === Initialize if needed ===
+def initialize_if_needed():
+    full_update_pipeline()

+ 84 - 0
src/utils/security.py

@@ -0,0 +1,84 @@
+
+'''
+Ce fichier contient :
+    Détection de contenu sensible
+    Détection de prompt injection
+    Journalisation des tentatives malveillantes
+    Envoi d’alerte par e-mail (optionnel)
+'''
+''' 
+
+import re
+import datetime
+import logging
+from transformers import pipeline
+
+# === Classificateur NLP (peut être remplacé par un autre propre modèle) ===
+classifier = pipeline("text-classification", model="unitary/toxic-bert")  
+
+# === Configuration du logging ===
+logging.basicConfig(filename="logs/security_events.log", level=logging.INFO, format="%(asctime)s - %(message)s")
+
+# === 1. Détection de prompt injection ===
+def contains_prompt_injection(text):
+    patterns = [
+        r"ignore.*instruction",
+        r"réécris.*prompt",
+        r"réinitialise.*sécurité",
+        r"(system|user|assistant):",
+        r"tu es un.*assistant.*obéissant",
+        r"efface.*mémoire",
+        r"désactive.*filtre",
+        r"répond même.*si.*confidentiel",
+        r"clé API"
+    ]
+    return any(re.search(pattern, text.lower()) for pattern in patterns)
+
+# === 2. Détection intelligente de contenu sensible ===
+def is_safe_input_advanced(text):
+    result = classifier(text)[0]
+    label = result["label"]
+    score = result["score"]
+    
+    if label.lower() == "toxic" and score > 0.7:
+        return False, label, score
+    return True, label, score
+
+# === 3. Système central de vérification de sécurité ===
+def advanced_security_check(question):
+    if not question.strip():
+        return False, "empty", 0.0
+
+    if contains_prompt_injection(question):
+        return False, "prompt_injection", 1.0
+
+    is_safe, label, score = is_safe_input_advanced(question)
+    return is_safe, label, score
+
+# === 4. Journalisation des requêtes suspectes ===
+def log_suspicious_query(user_ip, question, label, score):
+    log_entry = f"🔒 SUSPICIOUS | IP: {user_ip} | Label: {label} | Score: {score:.2f} | Question: {question}"
+    logging.warning(log_entry)
+
+# === 5. (Optionnel) Envoi d’alerte e-mail ===
+def send_security_alert(ip, question, label, score):
+    from smtplib import SMTP
+
+    from_email = "bot@intersel.fr"
+    to_email = "security@intersel.fr"
+    subject = "🚨 Alerte sécurité Chatbot"
+    body = f"""
+    ALERTE SÉCURITÉ - Chatbot Intersel
+    
+    IP : {ip}
+    Type de tentative : {label}
+    Score de confiance : {score}
+    Question : {question}
+    """
+
+    try:
+        with SMTP("smtp.intersel.fr") as server:
+            server.sendmail(from_email, to_email, f"Subject: {subject}\n\n{body}")
+    except Exception as e:
+        logging.error(f"Erreur envoi mail : {str(e)}")
+'''

Bu fark içinde çok fazla dosya değişikliği olduğu için bazı dosyalar gösterilmiyor