ommore86 commited on
Commit
59ae4b0
·
1 Parent(s): a808ca0

Update index.html

Browse files
Files changed (1) hide show
  1. templates/index.html +41 -39
templates/index.html CHANGED
@@ -101,14 +101,17 @@
101
 
102
  <!-- Summarize Section -->
103
  <div class="mt-6">
104
- <button id="btnSummarize"
105
- class="bg-indigo-500 hover:bg-indigo-600 text-white px-4 py-2 rounded disabled:opacity-50" disabled>
106
- Summarize PDF
107
- </button>
108
-
109
- <div id="summaryBox"
110
- class="mt-4 max-h-64 overflow-y-auto text-sm text-gray-700 p-3 border rounded bg-gray-50 hidden">
 
 
111
  </div>
 
112
  </div>
113
 
114
 
@@ -433,43 +436,42 @@
433
  }
434
  };
435
 
436
-
437
 
438
  // Summarize logic
439
  btnSummarize.onclick = async () => {
440
- if (!window.currentFileId) {
441
- summaryBox.textContent = "⚠️ Please upload a PDF first.";
442
- summaryBox.classList.remove("hidden");
443
- return;
444
- }
445
-
446
- btnSummarize.disabled = true;
447
- btnSummarize.textContent = "Summarizing…";
448
- summaryBox.textContent = "⏳ Generating summary...";
449
- summaryBox.classList.remove("hidden");
450
-
451
- try {
452
- const res = await fetch("/summarize", {
453
- method: "POST",
454
- headers: { "Content-Type": "application/json" },
455
- body: JSON.stringify({ file_id: window.currentFileId }),
456
- });
457
 
458
- const data = await res.json();
 
 
 
459
 
460
- if (res.ok) {
461
- summaryBox.textContent = data.summary || "No summary available.";
462
- } else {
463
- summaryBox.textContent = "" + (data.error || "Summarization failed.");
464
- }
465
- } catch (err) {
466
- summaryBox.textContent = "❌ Error summarizing file.";
467
- }
468
-
469
- btnSummarize.disabled = false;
470
- btnSummarize.textContent = "Summarize PDF";
471
- };
472
-
 
 
 
 
 
 
 
 
473
 
474
  </script>
475
 
 
101
 
102
  <!-- Summarize Section -->
103
  <div class="mt-6">
104
+ <div class="mt-2 flex items-start gap-3">
105
+ <button id="btnSummarize"
106
+ class="bg-indigo-500 hover:bg-indigo-600 text-white px-4 py-2 rounded disabled:opacity-50" disabled>
107
+ Summarize PDF
108
+ </button>
109
+
110
+ <div id="summaryBox"
111
+ class="flex-1 max-h-64 overflow-y-auto text-sm text-gray-700 p-3 border rounded bg-gray-50 hidden">
112
+ </div>
113
  </div>
114
+
115
  </div>
116
 
117
 
 
436
  }
437
  };
438
 
439
+
440
 
441
  // Summarize logic
442
  btnSummarize.onclick = async () => {
443
+ if (!window.currentFileId) {
444
+ summaryBox.textContent = "⚠️ Please upload a PDF first.";
445
+ summaryBox.classList.remove("hidden");
446
+ return;
447
+ }
 
 
 
 
 
 
 
 
 
 
 
 
448
 
449
+ btnSummarize.disabled = true;
450
+ btnSummarize.textContent = "Summarizing…";
451
+ summaryBox.textContent = "⏳ Generating summary...";
452
+ summaryBox.classList.remove("hidden");
453
 
454
+ try {
455
+ const res = await fetch("/summarize", {
456
+ method: "POST",
457
+ headers: { "Content-Type": "application/json" },
458
+ body: JSON.stringify({ file_id: window.currentFileId }),
459
+ });
460
+
461
+ const data = await res.json();
462
+
463
+ if (res.ok) {
464
+ summaryBox.textContent = data.summary || "No summary available.";
465
+ } else {
466
+ summaryBox.textContent = "❌ " + (data.error || "Summarization failed.");
467
+ }
468
+ } catch (err) {
469
+ summaryBox.textContent = "❌ Error summarizing file.";
470
+ }
471
+
472
+ btnSummarize.disabled = false;
473
+ btnSummarize.textContent = "Summarize PDF";
474
+ };
475
 
476
  </script>
477