0xKer commited on
Commit
ff7380f
·
verified ·
1 Parent(s): 604344d

Update static/chatbot.js

Browse files
Files changed (1) hide show
  1. static/chatbot.js +21 -0
static/chatbot.js CHANGED
@@ -515,6 +515,25 @@ const Chatbot = (() => {
515
  📥 Download Report as PDF
516
  </button>`;
517
  addMessage(pdfBtnHtml, 'bot', true);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
518
  } else if (geminiReport && geminiReport.error) {
519
  await botSay(`⚠️ AI report note: ${geminiReport.error}`, false, 400);
520
  }
@@ -879,6 +898,8 @@ const Chatbot = (() => {
879
  detectionData = null;
880
  analysisResult = null;
881
  geminiReport = null;
 
 
882
  uploadedFiles = [];
883
  imageDimensions = { width: 0, height: 0 };
884
  state = 'WELCOME';
 
515
  📥 Download Report as PDF
516
  </button>`;
517
  addMessage(pdfBtnHtml, 'bot', true);
518
+
519
+ // Also inject PDF button at the bottom of the X-ray side panel
520
+ const existingPanelBtn = document.getElementById('panel-pdf-section');
521
+ if (existingPanelBtn) existingPanelBtn.remove();
522
+ const panelPdfSection = document.createElement('div');
523
+ panelPdfSection.id = 'panel-pdf-section';
524
+ panelPdfSection.style.cssText = 'padding:12px 16px;border-top:1px solid var(--border);flex-shrink:0;';
525
+ panelPdfSection.innerHTML = `
526
+ <div style="font-size:11px;color:var(--text-muted);margin-bottom:8px;font-weight:600;text-transform:uppercase;letter-spacing:.4px;">AI Clinical Report</div>
527
+ <button onclick="window._downloadGeminiPDF()" style="
528
+ width:100%;display:flex;align-items:center;justify-content:center;gap:8px;
529
+ padding:10px 0;border-radius:8px;border:none;cursor:pointer;
530
+ background:var(--accent);color:#fff;font-weight:600;font-size:13px;
531
+ box-shadow:0 2px 8px rgba(0,0,0,.2);transition:opacity .2s;
532
+ " onmouseover="this.style.opacity='.85'" onmouseout="this.style.opacity='1'">
533
+ 📥 Download AI Report PDF
534
+ </button>`;
535
+ sidePanel.appendChild(panelPdfSection);
536
+
537
  } else if (geminiReport && geminiReport.error) {
538
  await botSay(`⚠️ AI report note: ${geminiReport.error}`, false, 400);
539
  }
 
898
  detectionData = null;
899
  analysisResult = null;
900
  geminiReport = null;
901
+ const oldPdf = document.getElementById('panel-pdf-section');
902
+ if (oldPdf) oldPdf.remove();
903
  uploadedFiles = [];
904
  imageDimensions = { width: 0, height: 0 };
905
  state = 'WELCOME';