|
@@ -0,0 +1,572 @@
|
|
|
|
|
+import gradio as gr
|
|
|
|
|
+import pdfplumber
|
|
|
|
|
+import pandas as pd
|
|
|
|
|
+import faiss
|
|
|
|
|
+from sentence_transformers import SentenceTransformer
|
|
|
|
|
+from langchain_community.llms import Ollama
|
|
|
|
|
+import pytesseract
|
|
|
|
|
+from PIL import Image
|
|
|
|
|
+import requests
|
|
|
|
|
+from bs4 import BeautifulSoup
|
|
|
|
|
+import json
|
|
|
|
|
+from serpapi import GoogleSearch
|
|
|
|
|
+
|
|
|
|
|
+# --- Initialisation des modèles ---
|
|
|
|
|
+embedding_model = SentenceTransformer("sentence-transformers/all-MiniLM-L6-v2")
|
|
|
|
|
+llm = Ollama(model="mistral")
|
|
|
|
|
+
|
|
|
|
|
+# --- Variables globales ---
|
|
|
|
|
+text_chunks = []
|
|
|
|
|
+Livinweb_chunks = []
|
|
|
|
|
+faiss_index = None
|
|
|
|
|
+chat_history = []
|
|
|
|
|
+
|
|
|
|
|
+session = requests.Session()
|
|
|
|
|
+
|
|
|
|
|
+# --- serpAPI ---
|
|
|
|
|
+SERPAPI_API_KEY = ""
|
|
|
|
|
+
|
|
|
|
|
+def serpapi_search(query, num_results=3):
|
|
|
|
|
+ try:
|
|
|
|
|
+ params = {
|
|
|
|
|
+ "q": query,
|
|
|
|
|
+ "api_key": SERPAPI_API_KEY,
|
|
|
|
|
+ "num": num_results
|
|
|
|
|
+ }
|
|
|
|
|
+ search = GoogleSearch(params)
|
|
|
|
|
+ results = search.get_dict()
|
|
|
|
|
+ snippets = []
|
|
|
|
|
+ if "organic_results" in results:
|
|
|
|
|
+ for item in results["organic_results"][:num_results]:
|
|
|
|
|
+ title = item.get("title", "")
|
|
|
|
|
+ snippet = item.get("snippet", "")
|
|
|
|
|
+ link = item.get("link", "")
|
|
|
|
|
+ snippets.append(f"{title}\n{snippet}\n{link}")
|
|
|
|
|
+ return "\n\n".join(snippets)
|
|
|
|
|
+ except Exception as e:
|
|
|
|
|
+ return f"❌ Erreur SerpApi: {e}"
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+# --- Fonctions Wiki ---
|
|
|
|
|
+def extract_wiki_pages(urls):
|
|
|
|
|
+ wiki_texts = []
|
|
|
|
|
+ for url in urls:
|
|
|
|
|
+ try:
|
|
|
|
|
+ r = session.get(url)
|
|
|
|
|
+ soup = BeautifulSoup(r.text, "html.parser")
|
|
|
|
|
+ div = soup.find("div", {"class": "page"})
|
|
|
|
|
+ if div:
|
|
|
|
|
+ wiki_texts.append(div.get_text(separator="\n", strip=True))
|
|
|
|
|
+ except Exception as e:
|
|
|
|
|
+ print(f"Erreur extraction wiki {url}: {e}")
|
|
|
|
|
+ return wiki_texts
|
|
|
|
|
+
|
|
|
|
|
+# --- Fonctions d'extraction ---
|
|
|
|
|
+def extract_text_from_pdfs(files):
|
|
|
|
|
+ texts = []
|
|
|
|
|
+ for file in files:
|
|
|
|
|
+ try:
|
|
|
|
|
+ with pdfplumber.open(file.name) as pdf:
|
|
|
|
|
+ for page in pdf.pages:
|
|
|
|
|
+ text = page.extract_text()
|
|
|
|
|
+ if text:
|
|
|
|
|
+ texts.append(text)
|
|
|
|
|
+ except Exception as e:
|
|
|
|
|
+ print(f"Erreur lecture PDF {file.name}: {e}")
|
|
|
|
|
+ return texts
|
|
|
|
|
+
|
|
|
|
|
+def extract_text_from_txt(files):
|
|
|
|
|
+ texts = []
|
|
|
|
|
+ for file in files:
|
|
|
|
|
+ try:
|
|
|
|
|
+ with open(file.name, "r", encoding="utf-8") as f:
|
|
|
|
|
+ texts.append(f.read())
|
|
|
|
|
+ except Exception as e:
|
|
|
|
|
+ print(f"Erreur lecture TXT {file.name}: {e}")
|
|
|
|
|
+ return texts
|
|
|
|
|
+
|
|
|
|
|
+def extract_text_from_csv(files):
|
|
|
|
|
+ texts = []
|
|
|
|
|
+ for file in files:
|
|
|
|
|
+ try:
|
|
|
|
|
+ df = pd.read_csv(file.name, encoding="utf-8")
|
|
|
|
|
+ content = df.astype(str).apply(lambda row: ' '.join(row.values), axis=1).str.cat(sep=' ')
|
|
|
|
|
+ texts.append(content)
|
|
|
|
|
+ except Exception as e:
|
|
|
|
|
+ print(f"Erreur lecture CSV {file.name}: {e}")
|
|
|
|
|
+ return texts
|
|
|
|
|
+
|
|
|
|
|
+def extract_text_from_images(files):
|
|
|
|
|
+ texts = []
|
|
|
|
|
+ for file in files:
|
|
|
|
|
+ try:
|
|
|
|
|
+ image = Image.open(file.name)
|
|
|
|
|
+ text = pytesseract.image_to_string(image, lang='fra')
|
|
|
|
|
+ if text:
|
|
|
|
|
+ texts.append(text)
|
|
|
|
|
+ except Exception as e:
|
|
|
|
|
+ print(f"Erreur OCR pour l'image {file.name} : {e}")
|
|
|
|
|
+ return texts
|
|
|
|
|
+
|
|
|
|
|
+def extract_text(files):
|
|
|
|
|
+ all_texts = []
|
|
|
|
|
+ for file in files:
|
|
|
|
|
+ name = file.name.lower()
|
|
|
|
|
+ if name.endswith(".pdf"):
|
|
|
|
|
+ all_texts.extend(extract_text_from_pdfs([file]))
|
|
|
|
|
+ elif name.endswith(".txt"):
|
|
|
|
|
+ all_texts.extend(extract_text_from_txt([file]))
|
|
|
|
|
+ elif name.endswith(".csv"):
|
|
|
|
|
+ all_texts.extend(extract_text_from_csv([file]))
|
|
|
|
|
+ elif name.endswith((".png", ".jpg", ".jpeg")):
|
|
|
|
|
+ all_texts.extend(extract_text_from_images([file]))
|
|
|
|
|
+ else:
|
|
|
|
|
+ print(f"Extension non prise en charge : {file.name}")
|
|
|
|
|
+ return all_texts
|
|
|
|
|
+
|
|
|
|
|
+# --- Analyse et indexation ---
|
|
|
|
|
+def contains_Livinweb(text):
|
|
|
|
|
+ text_clean = text.lower()
|
|
|
|
|
+ keywords = ["livinweb", "intersel"]
|
|
|
|
|
+ return any(keyword in text_clean for keyword in keywords)
|
|
|
|
|
+
|
|
|
|
|
+def create_faiss_index(texts):
|
|
|
|
|
+ global faiss_index
|
|
|
|
|
+ embeddings = embedding_model.encode(texts, convert_to_numpy=True)
|
|
|
|
|
+ dim = embeddings.shape[1]
|
|
|
|
|
+ index = faiss.IndexFlatL2(dim)
|
|
|
|
|
+ index.add(embeddings)
|
|
|
|
|
+ faiss_index = index
|
|
|
|
|
+ return index
|
|
|
|
|
+
|
|
|
|
|
+def load_documents(files):
|
|
|
|
|
+ global text_chunks, Livinweb_chunks, faiss_index
|
|
|
|
|
+
|
|
|
|
|
+ if not files:
|
|
|
|
|
+ return "⚠️ Aucun fichier fourni. Le chargement est facultatif, mais au moins un fichier ou le Wiki est requis pour interroger l'assistant."
|
|
|
|
|
+
|
|
|
|
|
+ texts = extract_text(files)
|
|
|
|
|
+ if not texts:
|
|
|
|
|
+ return "⚠️ Aucun texte extrait des fichiers fournis."
|
|
|
|
|
+
|
|
|
|
|
+ chunks = texts
|
|
|
|
|
+ Livinweb_chunks_local = [c for c in chunks if contains_Livinweb(c)]
|
|
|
|
|
+
|
|
|
|
|
+ if Livinweb_chunks_local:
|
|
|
|
|
+ Livinweb_chunks.extend(Livinweb_chunks_local)
|
|
|
|
|
+ create_faiss_index(Livinweb_chunks)
|
|
|
|
|
+ return f"📄 {len(Livinweb_chunks_local)} chunks Livinweb chargés (total {len(Livinweb_chunks)})."
|
|
|
|
|
+ else:
|
|
|
|
|
+ return "⚠️ Aucun contenu Livinweb détecté dans les fichiers."
|
|
|
|
|
+
|
|
|
|
|
+# --- Fonctions Wiki ---
|
|
|
|
|
+def login_to_wiki(username, password):
|
|
|
|
|
+ url = "https://wiki.intersel.fr/doku.php?id=start&do=login"
|
|
|
|
|
+ data = {'u': username, 'p': password, 'do': 'login'}
|
|
|
|
|
+ resp = session.post(url, data=data)
|
|
|
|
|
+ print("Status:", resp.status_code)
|
|
|
|
|
+ print("Response snippet:", resp.text[:500])
|
|
|
|
|
+ return 'logout' in resp.text.lower()
|
|
|
|
|
+
|
|
|
|
|
+def load_wiki_content(url_str):
|
|
|
|
|
+ global Livinweb_chunks, faiss_index
|
|
|
|
|
+ urls = [u.strip() for u in url_str.split(",") if u.strip()]
|
|
|
|
|
+ pages = extract_wiki_pages(urls)
|
|
|
|
|
+ if not pages:
|
|
|
|
|
+ return "⚠️ Aucune page wiki récupérée."
|
|
|
|
|
+ Livinweb_chunks.extend(pages)
|
|
|
|
|
+ create_faiss_index(Livinweb_chunks)
|
|
|
|
|
+ return f"🌐 {len(pages)} pages du wiki indexées (total {len(Livinweb_chunks)})."
|
|
|
|
|
+
|
|
|
|
|
+def reset_chat():
|
|
|
|
|
+ global chat_history
|
|
|
|
|
+ chat_history = []
|
|
|
|
|
+ return [], "", ""
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+def generate_answer(question, history):
|
|
|
|
|
+ global faiss_index, Livinweb_chunks, chat_history
|
|
|
|
|
+
|
|
|
|
|
+ PHRASES_VAGUES = [
|
|
|
|
|
+ "peut être trouvée", "vous pouvez consulter", "chercher dans la section",
|
|
|
|
|
+ "voir la page", "trouver les informations", "informations pertinentes",
|
|
|
|
|
+ "vous trouverez", "naviguer vers", "consulter", "je ne sais pas", "je ne suis pas sûr"
|
|
|
|
|
+ ]
|
|
|
|
|
+
|
|
|
|
|
+ def is_response_useful(text):
|
|
|
|
|
+ """Retourne False si la réponse est vague ou trop courte."""
|
|
|
|
|
+ if not text or len(text.strip()) < 30:
|
|
|
|
|
+ return False
|
|
|
|
|
+ text = text.lower()
|
|
|
|
|
+ return not any(phrase in text for phrase in PHRASES_VAGUES)
|
|
|
|
|
+
|
|
|
|
|
+ def search_web(question):
|
|
|
|
|
+ print("🔍 Utilisation de SerpAPI...")
|
|
|
|
|
+ google_results = serpapi_search(question)
|
|
|
|
|
+ if not google_results or google_results.startswith("❌ Erreur"):
|
|
|
|
|
+ return ("⚠️ Je n'ai pas trouvé de résultats pertinents sur le web actuellement. "
|
|
|
|
|
+ "Pouvez-vous reformuler ou poser une autre question ?")
|
|
|
|
|
+ try:
|
|
|
|
|
+ prompt = f"Voici des résultats de recherche web pertinents :\n{google_results}\n\nQuestion: {question}\nRéponse:"
|
|
|
|
|
+ response = llm.invoke(prompt).strip()
|
|
|
|
|
+ return response.split("Réponse:")[-1].strip()
|
|
|
|
|
+ except Exception as e:
|
|
|
|
|
+ return f"❌ Erreur génération depuis le web : {e}"
|
|
|
|
|
+
|
|
|
|
|
+ def answer_from_documents(question, top_k=2):
|
|
|
|
|
+ if not faiss_index or not Livinweb_chunks:
|
|
|
|
|
+ return None
|
|
|
|
|
+
|
|
|
|
|
+ q_emb = embedding_model.encode([question], convert_to_numpy=True)
|
|
|
|
|
+ D, I = faiss_index.search(q_emb, top_k)
|
|
|
|
|
+ print(f"📥 Résultats FAISS récupérés (sans utiliser la distance).")
|
|
|
|
|
+
|
|
|
|
|
+ context = "\n\n".join(
|
|
|
|
|
+ Livinweb_chunks[i][:500] for i in I[0] if i < len(Livinweb_chunks)
|
|
|
|
|
+ )
|
|
|
|
|
+ prompt = f"Contexte:\n{context}\n\nQuestion: {question}\nRéponse:"
|
|
|
|
|
+ try:
|
|
|
|
|
+ response = llm.invoke(prompt).strip()
|
|
|
|
|
+ return response.split("Réponse:")[-1].strip()
|
|
|
|
|
+ except Exception as e:
|
|
|
|
|
+ return f"❌ Erreur génération depuis les documents : {e}"
|
|
|
|
|
+
|
|
|
|
|
+ answer = answer_from_documents(question)
|
|
|
|
|
+
|
|
|
|
|
+# 2. Si réponse vague → on passe à SerpAPI
|
|
|
|
|
+ if answer is None or not is_response_useful(answer):
|
|
|
|
|
+ print("⚠️ Réponse document jugée insuffisante. Passage au web.")
|
|
|
|
|
+ answer = search_web(question)
|
|
|
|
|
+
|
|
|
|
|
+ chat_history.append([question, answer])
|
|
|
|
|
+ return chat_history, "", ""
|
|
|
|
|
+
|
|
|
|
|
+def is_response_useful(text):
|
|
|
|
|
+ """Retourne False si la réponse est vague, générique ou indique l'absence d'info."""
|
|
|
|
|
+ if not text or len(text.strip()) < 30:
|
|
|
|
|
+ return False
|
|
|
|
|
+
|
|
|
|
|
+ text = text.lower()
|
|
|
|
|
+
|
|
|
|
|
+ PHRASES_VAGUES = [
|
|
|
|
|
+ "je ne sais pas", "je ne suis pas sûr", "aucune information",
|
|
|
|
|
+ "il serait utile", "référez-vous", "veuillez consulter",
|
|
|
|
|
+ "non spécifié", "n'est pas mentionné", "pas indiqué",
|
|
|
|
|
+ "je ne peux pas", "vous pouvez chercher", "informations non disponibles"
|
|
|
|
|
+ ]
|
|
|
|
|
+
|
|
|
|
|
+ for phrase in PHRASES_VAGUES:
|
|
|
|
|
+ if phrase in text:
|
|
|
|
|
+ return False
|
|
|
|
|
+
|
|
|
|
|
+ return True
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+# --- Initial login and wiki loading ---
|
|
|
|
|
+login_page_url = "https://wiki.intersel.fr/doku.php?id=start&do=login"
|
|
|
|
|
+resp = session.get(login_page_url)
|
|
|
|
|
+soup = BeautifulSoup(resp.text, "html.parser")
|
|
|
|
|
+
|
|
|
|
|
+csrf_token = None
|
|
|
|
|
+token_input = soup.find("input", {"name": "token"})
|
|
|
|
|
+if token_input:
|
|
|
|
|
+ csrf_token = token_input.get("value")
|
|
|
|
|
+
|
|
|
|
|
+login_data = {
|
|
|
|
|
+ "u": "",
|
|
|
|
|
+ "p": "",
|
|
|
|
|
+ "do": "login"
|
|
|
|
|
+}
|
|
|
|
|
+if csrf_token:
|
|
|
|
|
+ login_data["token"] = csrf_token
|
|
|
|
|
+
|
|
|
|
|
+headers = {
|
|
|
|
|
+ "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/115.0 Safari/537.36",
|
|
|
|
|
+ "Referer": login_page_url
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+login_resp = session.post(login_page_url, data=login_data, headers=headers)
|
|
|
|
|
+
|
|
|
|
|
+if "logout" in login_resp.text.lower():
|
|
|
|
|
+ print("✅ Login successful!")
|
|
|
|
|
+
|
|
|
|
|
+ default_wiki_urls = [
|
|
|
|
|
+ "https://wiki.intersel.fr/doku.php?id=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=projets:samsic:agentai:start",
|
|
|
|
|
+ "https://wiki.intersel.fr/doku.php?id=intersel:presentation_equipe",
|
|
|
|
|
+ "https://wiki.intersel.fr/doku.php?id=intersel:presentation",
|
|
|
|
|
+ "https://wiki.intersel.fr/doku.php?id=intersel:resume_annuaire",
|
|
|
|
|
+ "https://wiki.intersel.fr/doku.php?id=intersel:resume_viadeo",
|
|
|
|
|
+ "https://wiki.intersel.fr/doku.php?id=intersel:resume_clients",
|
|
|
|
|
+ "https://wiki.intersel.fr/doku.php?id=intersel:rh:guide_pour_les_nouveaux_arrivants",
|
|
|
|
|
+ "https://wiki.intersel.fr/doku.php?id=intersel:technique",
|
|
|
|
|
+ "https://wiki.intersel.fr/doku.php?id=intersel:rh:formulaires",
|
|
|
|
|
+ "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:reunions_internes:reunion_20131210",
|
|
|
|
|
+ "https://wiki.intersel.fr/doku.php?id=intersel:projets_internes:campagne_no_stress:reunions:reunion_20130405",
|
|
|
|
|
+ "https://wiki.intersel.fr/doku.php?id=intersel:projets_internes:campagne_no_stress:reunions:reunion_20130307",
|
|
|
|
|
+ "https://wiki.intersel.fr/doku.php?id=intersel:reunions_internes:reunion_20121112",
|
|
|
|
|
+ "https://wiki.intersel.fr/doku.php?id=intersel:reunions_internes:reunion_20111010",
|
|
|
|
|
+ "https://wiki.intersel.fr/doku.php?id=intersel:guides:entretiens:stagiaires",
|
|
|
|
|
+ "https://wiki.intersel.fr/doku.php?id=intersel",
|
|
|
|
|
+ "https://wiki.intersel.fr/doku.php?id=intersel:rh",
|
|
|
|
|
+ "https://wiki.intersel.fr/doku.php?id=intersel:rh:inboarding",
|
|
|
|
|
+ "https://wiki.intersel.fr/doku.php?id=intersel:aides",
|
|
|
|
|
+ "https://wiki.intersel.fr/doku.php?id=intersel:aides:liste_de_selection_intersel_de_modeles_de_sites_web",
|
|
|
|
|
+ "https://wiki.intersel.fr/doku.php?id=intersel:aides:aide_integration_fckeditor",
|
|
|
|
|
+ "https://wiki.intersel.fr/doku.php?id=intersel:aides:tutorials",
|
|
|
|
|
+ "https://wiki.intersel.fr/doku.php?id=intersel:aides:tutorials:git",
|
|
|
|
|
+ "https://wiki.intersel.fr/doku.php?id=intersel:aides:aide_commande_mysql",
|
|
|
|
|
+ "https://wiki.intersel.fr/doku.php?id=intersel:aides:tutoriaux",
|
|
|
|
|
+ "https://wiki.intersel.fr/doku.php?id=intersel:aides:securite",
|
|
|
|
|
+ "https://wiki.intersel.fr/doku.php?id=intersel:aides:securite:cloud",
|
|
|
|
|
+ "https://wiki.intersel.fr/doku.php?id=intersel:aides:securite:cloud:securite",
|
|
|
|
|
+ "https://wiki.intersel.fr/doku.php?id=intersel:aides:securite:site_hacke",
|
|
|
|
|
+ "https://wiki.intersel.fr/doku.php?id=intersel:aides:securite:site_hacke:antivirus_site",
|
|
|
|
|
+ "https://wiki.intersel.fr/doku.php?id=intersel:aides:securite:site_hacke:surveillance_site",
|
|
|
|
|
+ "https://wiki.intersel.fr/doku.php?id=intersel:aides:exchange",
|
|
|
|
|
+ "https://wiki.intersel.fr/doku.php?id=intersel:aides:exchange:win_seven_pro_outlook_2010",
|
|
|
|
|
+ "https://wiki.intersel.fr/doku.php?id=intersel:produits",
|
|
|
|
|
+ "https://wiki.intersel.fr/doku.php?id=intersel:produits:demos",
|
|
|
|
|
+ "https://wiki.intersel.fr/doku.php?id=intersel:produits:demos:skydocks",
|
|
|
|
|
+ "https://wiki.intersel.fr/doku.php?id=intersel:produits:demos:skydocks:cdc",
|
|
|
|
|
+ "https://wiki.intersel.fr/doku.php?id=intersel:produits:demos:skydocks:cdc:sso_saml",
|
|
|
|
|
+ "https://wiki.intersel.fr/doku.php?id=intersel:produits:demos:skydocks:specs",
|
|
|
|
|
+ "https://wiki.intersel.fr/doku.php?id=intersel:produits:demos:skydocks:specs:sso_openid_connect",
|
|
|
|
|
+ "https://wiki.intersel.fr/doku.php?id=intersel:produits:demos:skydocks:specs:crud_compte",
|
|
|
|
|
+ "https://wiki.intersel.fr/doku.php?id=intersel:produits:demos:skydocks:specs:crud_compte:realisation",
|
|
|
|
|
+ "https://wiki.intersel.fr/doku.php?id=intersel:produits:skydocks",
|
|
|
|
|
+ "https://wiki.intersel.fr/doku.php?id=intersel:produits:skydocks:guides",
|
|
|
|
|
+ "https://wiki.intersel.fr/doku.php?id=intersel:produits:skydocks:guides:administrateur",
|
|
|
|
|
+ "https://wiki.intersel.fr/doku.php?id=intersel:produits:skydocks:guides:developpeur",
|
|
|
|
|
+ "https://wiki.intersel.fr/doku.php?id=intersel:produits:skydocks:marketing",
|
|
|
|
|
+ "https://wiki.intersel.fr/doku.php?id=intersel:produits:skydocks:installation_configuration",
|
|
|
|
|
+ "https://wiki.intersel.fr/doku.php?id=intersel:produits:skydocks:evolutions",
|
|
|
|
|
+ "https://wiki.intersel.fr/doku.php?id=intersel:prestataires",
|
|
|
|
|
+ "https://wiki.intersel.fr/doku.php?id=intersel:prestataires:amazili",
|
|
|
|
|
+ "https://wiki.intersel.fr/doku.php?id=intersel:prestataires:lets_encrypt",
|
|
|
|
|
+ "https://wiki.intersel.fr/doku.php?id=intersel:guides",
|
|
|
|
|
+ "https://wiki.intersel.fr/doku.php?id=intersel:guides:guide_de_developpement_intersel",
|
|
|
|
|
+ "https://wiki.intersel.fr/doku.php?id=intersel:guides:guide_de_developpement_intersel:microsoft_iis",
|
|
|
|
|
+ "https://wiki.intersel.fr/doku.php?id=intersel:guides:guide_de_developpement_intersel:ultravnc",
|
|
|
|
|
+ "https://wiki.intersel.fr/doku.php?id=intersel:guides:guide_de_developpement_intersel:microsoft_sql_server_express",
|
|
|
|
|
+ "https://wiki.intersel.fr/doku.php?id=intersel:guides:guide_de_developpement_intersel:pagemodele",
|
|
|
|
|
+ "https://wiki.intersel.fr/doku.php?id=intersel:guides:guide_de_developpement_intersel:gimp",
|
|
|
|
|
+ "https://wiki.intersel.fr/doku.php?id=intersel:guides:guide_de_developpement_intersel:phpunit",
|
|
|
|
|
+ "https://wiki.intersel.fr/doku.php?id=intersel:guides:guide_de_developpement_intersel:unbound",
|
|
|
|
|
+ "https://wiki.intersel.fr/doku.php?id=intersel:guides:guide_de_developpement_intersel:html5",
|
|
|
|
|
+ "https://wiki.intersel.fr/doku.php?id=intersel:guides:guide_de_developpement_intersel:html5:scss",
|
|
|
|
|
+ "https://wiki.intersel.fr/doku.php?id=intersel:guides:guide_de_developpement_intersel:faire_presentation_en_ligne",
|
|
|
|
|
+ "https://wiki.intersel.fr/doku.php?id=intersel:guides:guide_de_developpement_intersel:kaspersky",
|
|
|
|
|
+ "https://wiki.intersel.fr/doku.php?id=intersel:guides:guide_de_developpement_intersel:browser-sync",
|
|
|
|
|
+ "https://wiki.intersel.fr/doku.php?id=intersel:guides:guide_de_developpement_intersel:word",
|
|
|
|
|
+ "https://wiki.intersel.fr/doku.php?id=intersel:guides:guide_de_developpement_intersel:git",
|
|
|
|
|
+ "https://wiki.intersel.fr/doku.php?id=intersel:guides:guide_de_developpement_intersel:git:github",
|
|
|
|
|
+ "https://wiki.intersel.fr/doku.php?id=intersel:guides:guide_de_developpement_intersel:git:gogs",
|
|
|
|
|
+ "https://wiki.intersel.fr/doku.php?id=intersel:guides:guide_de_developpement_intersel:tightvnc",
|
|
|
|
|
+ "https://wiki.intersel.fr/doku.php?id=intersel:guides:guide_de_developpement_intersel:virtualbox",
|
|
|
|
|
+ "https://wiki.intersel.fr/doku.php?id=intersel:guides:guide_de_developpement_intersel:mantis",
|
|
|
|
|
+ "https://wiki.intersel.fr/doku.php?id=intersel:guides:guide_de_developpement_intersel:mantis:plugins",
|
|
|
|
|
+ "https://wiki.intersel.fr/doku.php?id=intersel:guides:guide_de_developpement_intersel:thunderbird",
|
|
|
|
|
+ "https://wiki.intersel.fr/doku.php?id=intersel:guides:guide_de_developpement_intersel:browser",
|
|
|
|
|
+ "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:sugarcrm",
|
|
|
|
|
+ "https://wiki.intersel.fr/doku.php?id=intersel:guides:guide_de_developpement_intersel:les_logiciels:typekit",
|
|
|
|
|
+ "https://wiki.intersel.fr/doku.php?id=intersel:guides:guide_de_developpement_intersel:les_logiciels:syncbackpro",
|
|
|
|
|
+ "https://wiki.intersel.fr/doku.php?id=intersel:guides:guide_de_developpement_intersel:les_logiciels:adminer",
|
|
|
|
|
+ "https://wiki.intersel.fr/doku.php?id=intersel:guides:guide_de_developpement_intersel:les_logiciels:vim",
|
|
|
|
|
+ "https://wiki.intersel.fr/doku.php?id=intersel:guides:guide_de_developpement_intersel:les_logiciels:baikal",
|
|
|
|
|
+ "https://wiki.intersel.fr/doku.php?id=intersel:guides:guide_de_developpement_intersel:les_logiciels:joe",
|
|
|
|
|
+ "https://wiki.intersel.fr/doku.php?id=intersel:guides:guide_de_developpement_intersel:les_logiciels:eclipse",
|
|
|
|
|
+ "https://wiki.intersel.fr/doku.php?id=intersel:guides:guide_de_developpement_intersel:les_logiciels:eclipse:svn",
|
|
|
|
|
+ "https://wiki.intersel.fr/doku.php?id=intersel:guides:guide_de_developpement_intersel:les_logiciels:libreoffice",
|
|
|
|
|
+ "https://wiki.intersel.fr/doku.php?id=intersel:guides:guide_de_developpement_intersel:les_logiciels:jwplayer",
|
|
|
|
|
+ "https://wiki.intersel.fr/doku.php?id=intersel:guides:guide_de_developpement_intersel:les_logiciels:mailjet",
|
|
|
|
|
+ "https://wiki.intersel.fr/doku.php?id=intersel:guides:guide_de_developpement_intersel:les_logiciels:atom",
|
|
|
|
|
+ "https://wiki.intersel.fr/doku.php?id=intersel:guides:guide_de_developpement_intersel:les_logiciels:dolibarr",
|
|
|
|
|
+ "https://wiki.intersel.fr/doku.php?id=intersel:guides:guide_de_developpement_intersel:les_logiciels:bouml",
|
|
|
|
|
+ "https://wiki.intersel.fr/doku.php?id=intersel:guides:entretiens",
|
|
|
|
|
+ "https://wiki.intersel.fr/doku.php?id=intersel:marketing",
|
|
|
|
|
+ "https://wiki.intersel.fr/doku.php?id=intersel:marketing:arguments",
|
|
|
|
|
+ "https://wiki.intersel.fr/doku.php?id=intersel:marketing:reflexions",
|
|
|
|
|
+ "https://wiki.intersel.fr/doku.php?id=intersel:marketing:presentations",
|
|
|
|
|
+ "https://wiki.intersel.fr/doku.php?id=intersel:marketing:modx",
|
|
|
|
|
+ "https://wiki.intersel.fr/doku.php?id=intersel:marketing:automatisation",
|
|
|
|
|
+ "https://wiki.intersel.fr/doku.php?id=intersel:marketing:david_edny",
|
|
|
|
|
+ "https://wiki.intersel.fr/doku.php?id=intersel:divers",
|
|
|
|
|
+ "https://wiki.intersel.fr/doku.php?id=intersel:divers:repas_noel",
|
|
|
|
|
+ "https://wiki.intersel.fr/doku.php?id=intersel:divers:exemples_courriers",
|
|
|
|
|
+ "https://wiki.intersel.fr/doku.php?id=intersel:reunions_internes",
|
|
|
|
|
+ "https://wiki.intersel.fr/doku.php?id=intersel:le_referentiel_qualite",
|
|
|
|
|
+ "https://wiki.intersel.fr/doku.php?id=intersel:le_referentiel_qualite:procedures",
|
|
|
|
|
+ "https://wiki.intersel.fr/doku.php?id=intersel:le_referentiel_qualite:guides",
|
|
|
|
|
+ "https://wiki.intersel.fr/doku.php?id=intersel:le_referentiel_qualite:ressources",
|
|
|
|
|
+ "https://wiki.intersel.fr/doku.php?id=intersel:archives",
|
|
|
|
|
+ "https://wiki.intersel.fr/doku.php?id=intersel:le_referentiel_qualite:cdc",
|
|
|
|
|
+ "https://wiki.intersel.fr/doku.php?id=intersel:le_referentiel_qualite:gestion_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:bureaucracy_forms",
|
|
|
|
|
+ "https://wiki.intersel.fr/doku.php?id=intersel:le_referentiel_qualite:accessibilite",
|
|
|
|
|
+ "https://wiki.intersel.fr/doku.php?id=intersel:projets_internes",
|
|
|
|
|
+ "https://wiki.intersel.fr/doku.php?id=intersel:projets_internes:campagne_no_stress",
|
|
|
|
|
+ "https://wiki.intersel.fr/doku.php?id=intersel:projets_internes:campagne_no_stress:reunions",
|
|
|
|
|
+ "https://wiki.intersel.fr/doku.php?id=intersel:projets_internes:slc_suivi_livrables_client",
|
|
|
|
|
+ "https://wiki.intersel.fr/doku.php?id=intersel:projets_internes:site_intersel",
|
|
|
|
|
+ "https://wiki.intersel.fr/doku.php?id=intersel:projets_internes:mep_dolibarr",
|
|
|
|
|
+ "https://wiki.intersel.fr/doku.php?id=intersel:projets_internes:sas",
|
|
|
|
|
+ "https://wiki.intersel.fr/doku.php?id=intersel:projets_internes:afp",
|
|
|
|
|
+ "https://wiki.intersel.fr/doku.php?id=intersel:projets_internes:librairies",
|
|
|
|
|
+ "https://wiki.intersel.fr/doku.php?id=intersel:projets_internes:librairies:upi",
|
|
|
|
|
+ "https://wiki.intersel.fr/doku.php?id=intersel:projets_internes:librairies:uji",
|
|
|
|
|
+ "https://wiki.intersel.fr/doku.php?id=intersel:projets_internes:psi",
|
|
|
|
|
+ "https://wiki.intersel.fr/doku.php?id=intersel:projets_internes:psi:sbl",
|
|
|
|
|
+ "https://wiki.intersel.fr/doku.php?id=intersel:projets_internes:psi:sbl:aa",
|
|
|
|
|
+ "https://wiki.intersel.fr/doku.php?id=intersel:projets_internes:psi:prototype",
|
|
|
|
|
+ "https://wiki.intersel.fr/doku.php?id=intersel:projets_internes:psi:documentation",
|
|
|
|
|
+ "https://wiki.intersel.fr/doku.php?id=intersel:securite",
|
|
|
|
|
+ "https://wiki.intersel.fr/doku.php?id=bpmcompany",
|
|
|
|
|
+ "https://wiki.intersel.fr/doku.php?id=bpmcompany:hebergement_bonita",
|
|
|
|
|
+ "https://wiki.intersel.fr/doku.php?id=bpmcompany:hebergement_bonita:installations",
|
|
|
|
|
+ "https://wiki.intersel.fr/doku.php?id=bpmcompany:hebergement_bonita:installations:ubuntu",
|
|
|
|
|
+ "https://wiki.intersel.fr/doku.php?id=bpmcompany:hebergement_bonita:installations:debian",
|
|
|
|
|
+ "https://wiki.intersel.fr/doku.php?id=technique",
|
|
|
|
|
+ "https://wiki.intersel.fr/doku.php?id=technique:openconcerto",
|
|
|
|
|
+ "https://wiki.intersel.fr/doku.php?id=technique:hebergement",
|
|
|
|
|
+ "https://wiki.intersel.fr/doku.php?id=technique:hebergement:dedies",
|
|
|
|
|
+ "https://wiki.intersel.fr/doku.php?id=technique:hebergement:dedies:91.121.147.29",
|
|
|
|
|
+ "https://wiki.intersel.fr/doku.php?id=technique:hebergement:mails",
|
|
|
|
|
+ "https://wiki.intersel.fr/doku.php?id=technique:hebergement:mails:aides_powermail",
|
|
|
|
|
+ "https://wiki.intersel.fr/doku.php?id=technique:hebergement:archinet",
|
|
|
|
|
+ "https://wiki.intersel.fr/doku.php?id=technique:hebergement:comparatif_prix",
|
|
|
|
|
+ "https://wiki.intersel.fr/doku.php?id=technique:hebergement:online",
|
|
|
|
|
+ "https://wiki.intersel.fr/doku.php?id=technique:hebergement:architecture_intersel_2014",
|
|
|
|
|
+ "https://wiki.intersel.fr/doku.php?id=technique:hebergement:ikoula",
|
|
|
|
|
+ "https://wiki.intersel.fr/doku.php?id=technique:hebergement:backups",
|
|
|
|
|
+ "https://wiki.intersel.fr/doku.php?id=technique:hebergement:backups:scripts",
|
|
|
|
|
+ "https://wiki.intersel.fr/doku.php?id=technique:hebergement:interne",
|
|
|
|
|
+ "https://wiki.intersel.fr/doku.php?id=technique:hebergement:mutualise",
|
|
|
|
|
+ "https://wiki.intersel.fr/doku.php?id=technique:hebergement:mutualise:haysoft",
|
|
|
|
|
+ "https://wiki.intersel.fr/doku.php?id=technique:hebergement:mutualise:ovh",
|
|
|
|
|
+ "https://wiki.intersel.fr/doku.php?id=technique:hebergement:mutualise:ovh:720gp",
|
|
|
|
|
+ "https://wiki.intersel.fr/doku.php?id=technique:hebergement:scaleway",
|
|
|
|
|
+ "https://wiki.intersel.fr/doku.php?id=technique:hebergement:ovh",
|
|
|
|
|
+ "https://wiki.intersel.fr/doku.php?id=technique:reseau",
|
|
|
|
|
+ "https://wiki.intersel.fr/doku.php?id=technique:reseau:switch",
|
|
|
|
|
+ "https://wiki.intersel.fr/doku.php?id=technique:matomo",
|
|
|
|
|
+ "https://wiki.intersel.fr/doku.php?id=technique:mysql",
|
|
|
|
|
+ "https://wiki.intersel.fr/doku.php?id=technique:svn",
|
|
|
|
|
+ "https://wiki.intersel.fr/doku.php?id=technique:marketing-automation",
|
|
|
|
|
+ "https://wiki.intersel.fr/doku.php?id=technique:marketing-automation:pardot",
|
|
|
|
|
+ "https://wiki.intersel.fr/doku.php?id=technique:marketing-automation:email",
|
|
|
|
|
+ "https://wiki.intersel.fr/doku.php?id=technique:linux",
|
|
|
|
|
+ "https://wiki.intersel.fr/doku.php?id=technique:linux:start",
|
|
|
|
|
+ "https://wiki.intersel.fr/doku.php?id=technique:linux:start:codes_source_utiles",
|
|
|
|
|
+ "https://wiki.intersel.fr/doku.php?id=technique:linux:start:codes_source_utiles:javascript",
|
|
|
|
|
+ "https://wiki.intersel.fr/doku.php?id=technique:linux:start:codes_source_utiles:javascript:framework",
|
|
|
|
|
+ "https://wiki.intersel.fr/doku.php?id=technique:linux:start:codes_source_utiles:javascript:dg-spinner",
|
|
|
|
|
+ "https://wiki.intersel.fr/doku.php?id=technique:linux:start:cdc",
|
|
|
|
|
+ "https://wiki.intersel.fr/doku.php?id=technique:linux:start:aides_hebergement",
|
|
|
|
|
+ "https://wiki.intersel.fr/doku.php?id=technique:linux:start:aides_hebergement:copie_vm_mutu",
|
|
|
|
|
+ "https://wiki.intersel.fr/doku.php?id=technique:linux:docker",
|
|
|
|
|
+ "https://wiki.intersel.fr/doku.php?id=technique:linux:zabbix",
|
|
|
|
|
+ "https://wiki.intersel.fr/doku.php?id=technique:linux:containerisation",
|
|
|
|
|
+ "https://wiki.intersel.fr/doku.php?id=technique:linux:nas",
|
|
|
|
|
+ "https://wiki.intersel.fr/doku.php?id=technique:linux:serveur_dedie_linux",
|
|
|
|
|
+ "https://wiki.intersel.fr/doku.php?id=technique:linux:serveur_dedie_linux:postfix",
|
|
|
|
|
+ "https://wiki.intersel.fr/doku.php?id=technique:linux:serveur_dedie_linux:tomcat",
|
|
|
|
|
+ "https://wiki.intersel.fr/doku.php?id=technique:linux:serveur_dedie_linux:tomcat:debian",
|
|
|
|
|
+ "https://wiki.intersel.fr/doku.php?id=technique:linux:serveur_dedie_linux:java",
|
|
|
|
|
+ "https://wiki.intersel.fr/doku.php?id=technique:linux:serveur_dedie_linux:serveur_nginx",
|
|
|
|
|
+ "https://wiki.intersel.fr/doku.php?id=technique:linux:serveur_dedie_linux:template",
|
|
|
|
|
+ "https://wiki.intersel.fr/doku.php?id=technique:linux:serveur_dedie_linux:template:git",
|
|
|
|
|
+ "https://wiki.intersel.fr/doku.php?id=technique:linux:serveur_dedie_linux:proxmox",
|
|
|
|
|
+ "https://wiki.intersel.fr/doku.php?id=technique:linux:serveur_dedie_linux:proxmox2",
|
|
|
|
|
+ "https://wiki.intersel.fr/doku.php?id=technique:linux:serveur_dedie_linux:postfixadmin",
|
|
|
|
|
+ "https://wiki.intersel.fr/doku.php?id=technique:linux:linux_serveur_dedie_linux_template",
|
|
|
|
|
+ "https://wiki.intersel.fr/doku.php?id=technique:linux:linux_serveur_dedie_linux_template:postfix",
|
|
|
|
|
+ "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:memcached",
|
|
|
|
|
+ "https://wiki.intersel.fr/doku.php?id=technique:outils",
|
|
|
|
|
+ "https://wiki.intersel.fr/doku.php?id=technique:outils:traductions",
|
|
|
|
|
+ "https://wiki.intersel.fr/doku.php?id=technique:outils:google_translate",
|
|
|
|
|
+ "https://wiki.intersel.fr/doku.php?id=technique:outils:selenium",
|
|
|
|
|
+ "https://wiki.intersel.fr/doku.php?id=technique:outils:postman",
|
|
|
|
|
+ "https://wiki.intersel.fr/doku.php?id=technique:outils:git",
|
|
|
|
|
+ "https://wiki.intersel.fr/doku.php?id=technique:outils:gitlab",
|
|
|
|
|
+ "https://wiki.intersel.fr/doku.php?id=technique:outils:jenkins",
|
|
|
|
|
+ "https://wiki.intersel.fr/doku.php?id=technique:outils:jenkins:configuration",
|
|
|
|
|
+ "https://wiki.intersel.fr/doku.php?id=technique:outils:jenkins:pipelines",
|
|
|
|
|
+ "https://wiki.intersel.fr/doku.php?id=technique:outils:jenkins:plugin",
|
|
|
|
|
+ "https://wiki.intersel.fr/doku.php?id=technique:outils:jenkins:sonar",
|
|
|
|
|
+ "https://wiki.intersel.fr/doku.php?id=technique:outils:jenkins:slave",
|
|
|
|
|
+ "https://wiki.intersel.fr/doku.php?id=technique:outils:jenkins:slave:windows",
|
|
|
|
|
+ "https://wiki.intersel.fr/doku.php?id=technique:outils:jenkins:slave:linux",
|
|
|
|
|
+ "https://wiki.intersel.fr/doku.php?id=technique:outils:jenkins:master_slave",
|
|
|
|
|
+ "https://wiki.intersel.fr/doku.php?id=technique:outils:jenkins:multibranch_pipelines",
|
|
|
|
|
+ "https://wiki.intersel.fr/doku.php?id=technique:outils:jenkins:multibranch_pipelines:pr",
|
|
|
|
|
+ "https://wiki.intersel.fr/doku.php?id=technique:outils:jenkins:multibranch_pipelines:example",
|
|
|
|
|
+ "https://wiki.intersel.fr/doku.php?id=technique:outils:jenkins:multibranch_pipelines:example2",
|
|
|
|
|
+ "https://wiki.intersel.fr/doku.php?id=technique:outils:jenkins:multibranch_pipelines:example3",
|
|
|
|
|
+ "https://wiki.intersel.fr/doku.php?id=technique:outils:jenkins:multibranch_pipelines:example4",
|
|
|
|
|
+ "https://wiki.intersel.fr/doku.php?id=technique:outils:jenkins:multibranch_pipelines:example5",
|
|
|
|
|
+ "https://wiki.intersel.fr/doku.php?id=technique:outils:jenkins:multibranch_pipelines:example6",
|
|
|
|
|
+ "https://wiki.intersel.fr/doku.php?id=technique:outils:jenkins:multibranch_pipelines:example7",
|
|
|
|
|
+ "https://wiki.intersel.fr/doku.php?id=technique:outils:jenkins:multibranch_pipelines:example8",
|
|
|
|
|
+ "https://wiki.intersel.fr/doku.php?id=technique:outils:jenkins:multibranch_pipelines:example9",
|
|
|
|
|
+ "https://wiki.intersel.fr/doku.php?id=technique:outils:jenkins:multibranch_pipelines:example10"
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ ]
|
|
|
|
|
+
|
|
|
|
|
+ wiki_texts = extract_wiki_pages(default_wiki_urls)
|
|
|
|
|
+ if wiki_texts:
|
|
|
|
|
+ Livinweb_chunks.extend(wiki_texts)
|
|
|
|
|
+ create_faiss_index(Livinweb_chunks)
|
|
|
|
|
+ print("Nombre d'éléments dans l'index FAISS :", faiss_index.ntotal)
|
|
|
|
|
+
|
|
|
|
|
+ print("Index FAISS créé avec", len(Livinweb_chunks), "chunks")
|
|
|
|
|
+
|
|
|
|
|
+ print(f"🌐 {len(wiki_texts)} pages wiki chargées et indexées.")
|
|
|
|
|
+ else:
|
|
|
|
|
+ print("⚠️ Impossible de récupérer les pages wiki.")
|
|
|
|
|
+
|
|
|
|
|
+else:
|
|
|
|
|
+ print("❌ Échec du login wiki.")
|
|
|
|
|
+
|
|
|
|
|
+# --- Interface Gradio ---
|
|
|
|
|
+with gr.Blocks() as demo:
|
|
|
|
|
+ gr.Markdown("# Assistant Livinweb")
|
|
|
|
|
+
|
|
|
|
|
+ with gr.Row():
|
|
|
|
|
+ file_input = gr.File(label="Téléversez vos documents (PDF, TXT, CSV, Images)",
|
|
|
|
|
+ file_types=[".pdf", ".txt", ".csv", ".png", ".jpg", ".jpeg"],
|
|
|
|
|
+ file_count="multiple")
|
|
|
|
|
+ load_files_btn = gr.Button("Charger les documents")
|
|
|
|
|
+
|
|
|
|
|
+ chatbox = gr.Chatbot(label="Assistant Livinweb")
|
|
|
|
|
+ question_input = gr.Textbox(label="Posez votre question ici")
|
|
|
|
|
+ send_btn = gr.Button("Envoyer")
|
|
|
|
|
+ reset_btn = gr.Button("Réinitialiser la conversation")
|
|
|
|
|
+ status_output = gr.Textbox(label="Statut", interactive=False)
|
|
|
|
|
+
|
|
|
|
|
+ def on_load_files(files):
|
|
|
|
|
+ msg = load_documents(files)
|
|
|
|
|
+ return msg
|
|
|
|
|
+
|
|
|
|
|
+ def on_reset():
|
|
|
|
|
+ history, q, a = reset_chat()
|
|
|
|
|
+ return history, q, a, "✅ Conversation réinitialisée."
|
|
|
|
|
+
|
|
|
|
|
+ def on_send(question, chat_history):
|
|
|
|
|
+ chat_history, _, _ = generate_answer(question, chat_history)
|
|
|
|
|
+ return chat_history, "", ""
|
|
|
|
|
+
|
|
|
|
|
+ load_files_btn.click(on_load_files, inputs=[file_input], outputs=[status_output])
|
|
|
|
|
+ reset_btn.click(on_reset, outputs=[chatbox, question_input, status_output])
|
|
|
|
|
+ send_btn.click(on_send, inputs=[question_input, chatbox], outputs=[chatbox, question_input, status_output])
|
|
|
|
|
+
|
|
|
|
|
+demo.launch()
|