| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384 |
- <!DOCTYPE html>
- <html lang="fr">
- <head>
- <meta charset="UTF-8" />
- <title>QA Agent Wiki</title>
- <style>
- body {
- font-family: Arial, sans-serif;
- margin: 40px;
- max-width: 800px;
- }
- h1 {
- color: #333;
- }
- input, textarea, button {
- width: 100%;
- padding: 10px;
- margin-top: 10px;
- margin-bottom: 20px;
- border: 1px solid #ccc;
- border-radius: 5px;
- }
- button {
- background-color: #007bff;
- color: white;
- font-weight: bold;
- cursor: pointer;
- }
- button:hover {
- background-color: #0056b3;
- }
- .response {
- background: #f1f1f1;
- padding: 15px;
- border-radius: 5px;
- white-space: pre-wrap;
- }
- </style>
- </head>
- <body>
- <h1>🔍 Posez une question à l’IA</h1>
- <!-- Affiché directement (plus de display: none) -->
- <div id="qa-section">
- <h3>Votre question</h3>
- <textarea id="question" rows="4" placeholder="Posez votre question ici..."></textarea>
- <button onclick="askQuestion()">Envoyer</button>
- <h3>Réponse de l'IA</h3>
- <div class="response" id="answer"></div>
- </div>
- <script>
- async function askQuestion() {
- const question = document.getElementById("question").value.trim();
- const answerBox = document.getElementById("answer");
- if (!question) {
- answerBox.innerText = "❗ Veuillez entrer une question.";
- return;
- }
- answerBox.innerText = "⏳ Recherche de la réponse...";
- try {
- const res = await fetch("/qa_chain", {
- method: "POST",
- headers: {
- "Content-Type": "application/json"
- },
- body: JSON.stringify({ question })
- });
- if (!res.ok) {
- throw new Error("Erreur du serveur");
- }
- const data = await res.json();
- answerBox.innerText = data.answer || "❌ Aucune réponse trouvée.";
- } catch (error) {
- answerBox.innerText = "❌ Erreur : " + error.message;
- }
- }
- </script>
- </body>
- </html>
|