Spaces:
Sleeping
Sleeping
Update src/api.js
Browse files- src/api.js +4 -3
src/api.js
CHANGED
|
@@ -3,13 +3,14 @@
|
|
| 3 |
export const API_BASE = "https://deepthoughtai-prolog-gateway.hf.space";
|
| 4 |
|
| 5 |
export async function sendChat(message, strictMode = true, history = []) {
|
| 6 |
-
const res = await fetch(`${API_BASE}/prolog/query`, {
|
| 7 |
method: "POST",
|
| 8 |
headers: {
|
| 9 |
"Content-Type": "application/json",
|
| 10 |
},
|
| 11 |
body: JSON.stringify({
|
| 12 |
-
|
|
|
|
| 13 |
strict_mode: strictMode,
|
| 14 |
history,
|
| 15 |
}),
|
|
@@ -25,5 +26,5 @@ export async function sendChat(message, strictMode = true, history = []) {
|
|
| 25 |
throw new Error(json.error || "Chat failed");
|
| 26 |
}
|
| 27 |
|
| 28 |
-
return json;
|
| 29 |
}
|
|
|
|
| 3 |
export const API_BASE = "https://deepthoughtai-prolog-gateway.hf.space";
|
| 4 |
|
| 5 |
export async function sendChat(message, strictMode = true, history = []) {
|
| 6 |
+
const res = await fetch(`${API_BASE}/prolog/query`, {
|
| 7 |
method: "POST",
|
| 8 |
headers: {
|
| 9 |
"Content-Type": "application/json",
|
| 10 |
},
|
| 11 |
body: JSON.stringify({
|
| 12 |
+
// Backend wants this:
|
| 13 |
+
query: message, // ✅ renamed from `message` to `query`
|
| 14 |
strict_mode: strictMode,
|
| 15 |
history,
|
| 16 |
}),
|
|
|
|
| 26 |
throw new Error(json.error || "Chat failed");
|
| 27 |
}
|
| 28 |
|
| 29 |
+
return json; // { ok, reply, prolog_query_info } (assuming backend returns this)
|
| 30 |
}
|