github-actions[bot] commited on
Commit
b0d8269
·
1 Parent(s): 25bb60f

Auto-deploy from GitHub: 1a5c5751fc1cc39af6c504a981628b4ff2f74518

Browse files
Files changed (1) hide show
  1. index.html +19 -2
index.html CHANGED
@@ -672,6 +672,9 @@
672
  const API_URL = '/api';
673
  let selectedFile = null;
674
 
 
 
 
675
  // Upload zone interactions
676
  const uploadZone = document.getElementById('uploadZone');
677
  const fileInput = document.getElementById('audioFile');
@@ -774,12 +777,20 @@
774
 
775
  const tbody = document.getElementById('filesTable');
776
 
 
 
 
777
  if (files.length === 0) {
778
  tbody.innerHTML = '<tr><td colspan="6" class="empty-state">No files uploaded yet. Start by uploading an audio file!</td></tr>';
779
  return;
780
  }
781
 
782
  tbody.innerHTML = files.map(file => {
 
 
 
 
 
783
  const captionPreview = file.caption ?
784
  (file.caption.length > 50 ? file.caption.substring(0, 50) + '...' : file.caption) :
785
  '—';
@@ -814,7 +825,7 @@
814
  <td>${estWait}</td>
815
  <td class="caption-cell">
816
  ${file.caption ?
817
- `<button class="btn btn-small btn-secondary" onclick='showCaption(${JSON.stringify(file.caption)})' style="margin-left: 0.5rem;">Show</button>`
818
  : '—'}
819
  </td>
820
  <td>${new Date(file.created_at).toLocaleString()}</td>
@@ -828,7 +839,13 @@
828
  }
829
 
830
  // Modal functions
831
- function showCaption(caption) {
 
 
 
 
 
 
832
  const modal = document.getElementById('captionModal');
833
  const codeBlock = document.getElementById('captionCode');
834
 
 
672
  const API_URL = '/api';
673
  let selectedFile = null;
674
 
675
+ // Store captions by file ID to avoid inline JSON issues with large texts
676
+ const captionStore = new Map();
677
+
678
  // Upload zone interactions
679
  const uploadZone = document.getElementById('uploadZone');
680
  const fileInput = document.getElementById('audioFile');
 
777
 
778
  const tbody = document.getElementById('filesTable');
779
 
780
+ // Clear old captions and store new ones
781
+ captionStore.clear();
782
+
783
  if (files.length === 0) {
784
  tbody.innerHTML = '<tr><td colspan="6" class="empty-state">No files uploaded yet. Start by uploading an audio file!</td></tr>';
785
  return;
786
  }
787
 
788
  tbody.innerHTML = files.map(file => {
789
+ // Store caption in Map to avoid inline JSON issues with large texts
790
+ if (file.caption) {
791
+ captionStore.set(file.id, file.caption);
792
+ }
793
+
794
  const captionPreview = file.caption ?
795
  (file.caption.length > 50 ? file.caption.substring(0, 50) + '...' : file.caption) :
796
  '—';
 
825
  <td>${estWait}</td>
826
  <td class="caption-cell">
827
  ${file.caption ?
828
+ `<button class="btn btn-small btn-secondary" onclick="showCaption('${file.id}')" style="margin-left: 0.5rem;">Show</button>`
829
  : '—'}
830
  </td>
831
  <td>${new Date(file.created_at).toLocaleString()}</td>
 
839
  }
840
 
841
  // Modal functions
842
+ function showCaption(fileId) {
843
+ const caption = captionStore.get(fileId);
844
+ if (!caption) {
845
+ console.error('Caption not found for file:', fileId);
846
+ return;
847
+ }
848
+
849
  const modal = document.getElementById('captionModal');
850
  const codeBlock = document.getElementById('captionCode');
851