Spaces:
Sleeping
Sleeping
Delete templates/index.html.Old
Browse files- templates/index.html.Old +0 -43
templates/index.html.Old
DELETED
@@ -1,43 +0,0 @@
|
|
1 |
-
<!DOCTYPE html>
|
2 |
-
<html lang="en">
|
3 |
-
<head>
|
4 |
-
<meta charset="UTF-8">
|
5 |
-
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
6 |
-
<title>QnA Chatbot</title>
|
7 |
-
<script>
|
8 |
-
async function askBot() {
|
9 |
-
const question = document.getElementById('question').value;
|
10 |
-
const responseBox = document.getElementById('response');
|
11 |
-
|
12 |
-
if (!question) {
|
13 |
-
responseBox.innerText = "Please enter a question.";
|
14 |
-
return;
|
15 |
-
}
|
16 |
-
|
17 |
-
responseBox.innerText = "Waiting for response...";
|
18 |
-
|
19 |
-
const response = await fetch('/ask', {
|
20 |
-
method: 'POST',
|
21 |
-
headers: {
|
22 |
-
'Content-Type': 'application/json',
|
23 |
-
},
|
24 |
-
body: JSON.stringify({ question: question }),
|
25 |
-
});
|
26 |
-
|
27 |
-
if (response.ok) {
|
28 |
-
const data = await response.json();
|
29 |
-
responseBox.innerText = data.answer || "No response from bot.";
|
30 |
-
} else {
|
31 |
-
const errorData = await response.json();
|
32 |
-
responseBox.innerText = `Error: ${errorData.error}`;
|
33 |
-
}
|
34 |
-
}
|
35 |
-
</script>
|
36 |
-
</head>
|
37 |
-
<body>
|
38 |
-
<h1>QnA Chatbot</h1>
|
39 |
-
<input type="text" id="question" placeholder="Ask a question" />
|
40 |
-
<button onclick="askBot()">Ask</button>
|
41 |
-
<p id="response"></p>
|
42 |
-
</body>
|
43 |
-
</html>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|