Spaces:
Runtime error
Runtime error
Update static/index.html
Browse files- static/index.html +7 -1
static/index.html
CHANGED
|
@@ -289,14 +289,20 @@
|
|
| 289 |
if (!prompt) return;
|
| 290 |
|
| 291 |
try {
|
|
|
|
| 292 |
const response = await fetch('/summarize', {
|
| 293 |
method: 'POST',
|
| 294 |
headers: { 'Content-Type': 'application/json' },
|
| 295 |
body: JSON.stringify({ text: prompt })
|
| 296 |
});
|
| 297 |
|
| 298 |
-
if (!response.ok)
|
|
|
|
|
|
|
|
|
|
|
|
|
| 299 |
const data = await response.json();
|
|
|
|
| 300 |
alert(`Response: ${data.summary}`);
|
| 301 |
} catch (error) {
|
| 302 |
console.error('Error:', error);
|
|
|
|
| 289 |
if (!prompt) return;
|
| 290 |
|
| 291 |
try {
|
| 292 |
+
console.log("Sending request with prompt:", prompt); // Debugging
|
| 293 |
const response = await fetch('/summarize', {
|
| 294 |
method: 'POST',
|
| 295 |
headers: { 'Content-Type': 'application/json' },
|
| 296 |
body: JSON.stringify({ text: prompt })
|
| 297 |
});
|
| 298 |
|
| 299 |
+
if (!response.ok) {
|
| 300 |
+
console.error("Response error:", response.status, response.statusText); // Debugging
|
| 301 |
+
throw new Error('Failed to fetch response');
|
| 302 |
+
}
|
| 303 |
+
|
| 304 |
const data = await response.json();
|
| 305 |
+
console.log("Response data:", data); // Debugging
|
| 306 |
alert(`Response: ${data.summary}`);
|
| 307 |
} catch (error) {
|
| 308 |
console.error('Error:', error);
|