Hadiil commited on
Commit
f992b06
·
verified ·
1 Parent(s): 862463f

Update static/index.html

Browse files
Files changed (1) hide show
  1. static/index.html +0 -6
static/index.html CHANGED
@@ -283,33 +283,27 @@
283
  const promptForm = document.getElementById('promptForm');
284
  const promptInput = document.getElementById('promptInput');
285
  const fileInput = document.getElementById('fileInput');
286
-
287
  promptForm.addEventListener('submit', async (e) => {
288
  e.preventDefault();
289
  const prompt = promptInput.value.trim();
290
  const file = fileInput.files[0];
291
-
292
  if (!prompt && !file) {
293
  alert("Please enter a prompt or upload a file.");
294
  return;
295
  }
296
-
297
  try {
298
  const formData = new FormData();
299
  if (file) formData.append('file', file);
300
  if (prompt) formData.append('text', prompt);
301
-
302
  console.log("Sending request with:", { prompt, file }); // Debugging
303
  const response = await fetch('/summarize', {
304
  method: 'POST',
305
  body: formData
306
  });
307
-
308
  if (!response.ok) {
309
  console.error("Response error:", response.status, response.statusText); // Debugging
310
  throw new Error('Failed to fetch response');
311
  }
312
-
313
  const data = await response.json();
314
  console.log("Response data:", data); // Debugging
315
  alert(`Response: ${data.summary}`);
 
283
  const promptForm = document.getElementById('promptForm');
284
  const promptInput = document.getElementById('promptInput');
285
  const fileInput = document.getElementById('fileInput');
 
286
  promptForm.addEventListener('submit', async (e) => {
287
  e.preventDefault();
288
  const prompt = promptInput.value.trim();
289
  const file = fileInput.files[0];
 
290
  if (!prompt && !file) {
291
  alert("Please enter a prompt or upload a file.");
292
  return;
293
  }
 
294
  try {
295
  const formData = new FormData();
296
  if (file) formData.append('file', file);
297
  if (prompt) formData.append('text', prompt);
 
298
  console.log("Sending request with:", { prompt, file }); // Debugging
299
  const response = await fetch('/summarize', {
300
  method: 'POST',
301
  body: formData
302
  });
 
303
  if (!response.ok) {
304
  console.error("Response error:", response.status, response.statusText); // Debugging
305
  throw new Error('Failed to fetch response');
306
  }
 
307
  const data = await response.json();
308
  console.log("Response data:", data); // Debugging
309
  alert(`Response: ${data.summary}`);