Zubaish commited on
Commit ·
81345e2
1
Parent(s): ffadad7
Add simple HTML frontend for HF Space
Browse files- frontend/index.html +4 -2
frontend/index.html
CHANGED
|
@@ -44,7 +44,7 @@ async function ask() {
|
|
| 44 |
document.getElementById("answer").textContent = "Thinking...";
|
| 45 |
document.getElementById("status").innerHTML = "";
|
| 46 |
|
| 47 |
-
const res = await fetch("/
|
| 48 |
method: "POST",
|
| 49 |
headers: { "Content-Type": "application/json" },
|
| 50 |
body: JSON.stringify({ question: q })
|
|
@@ -52,7 +52,9 @@ async function ask() {
|
|
| 52 |
|
| 53 |
const data = await res.json();
|
| 54 |
|
| 55 |
-
document.getElementById("answer").textContent =
|
|
|
|
|
|
|
| 56 |
(data.status || []).forEach(s => {
|
| 57 |
const li = document.createElement("li");
|
| 58 |
li.textContent = s;
|
|
|
|
| 44 |
document.getElementById("answer").textContent = "Thinking...";
|
| 45 |
document.getElementById("status").innerHTML = "";
|
| 46 |
|
| 47 |
+
const res = await fetch("/ask", { // <-- ensure this matches backend
|
| 48 |
method: "POST",
|
| 49 |
headers: { "Content-Type": "application/json" },
|
| 50 |
body: JSON.stringify({ question: q })
|
|
|
|
| 52 |
|
| 53 |
const data = await res.json();
|
| 54 |
|
| 55 |
+
document.getElementById("answer").textContent =
|
| 56 |
+
data.answer || "No answer";
|
| 57 |
+
|
| 58 |
(data.status || []).forEach(s => {
|
| 59 |
const li = document.createElement("li");
|
| 60 |
li.textContent = s;
|