@crestapps/ai-chat-ui 2.0.0-preview.175 → 2.0.0-preview.186

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2727,30 +2727,42 @@ window.chatInteractionDocumentManager = function () {
2727
2727
  }
2728
2728
  interactionDocuments.forEach(function (documentInfo) {
2729
2729
  var row = window.document.createElement('div');
2730
- row.className = 'd-flex justify-content-between align-items-start gap-2 border rounded px-2 py-2 bg-white chat-document-row';
2730
+ row.className = 'd-flex align-items-center gap-2 border rounded px-2 py-2 bg-white chat-document-row';
2731
2731
  row.dataset.chatDocumentId = documentInfo.documentId;
2732
2732
  row.dataset.chatDocumentName = documentInfo.fileName;
2733
2733
  row.dataset.chatDocumentSize = documentInfo.fileSize;
2734
- var details = window.document.createElement('div');
2735
- details.className = 'me-2 min-w-0';
2736
- var name = createTextElement('div', 'fw-semibold small', documentInfo.fileName || 'Document');
2737
- var icon = window.document.createElement('i');
2738
- icon.className = 'fa-solid fa-file-lines me-1';
2739
- name.prepend(icon);
2740
- var size = createTextElement('div', 'text-muted small', formatFileSize(documentInfo.fileSize));
2741
- details.appendChild(name);
2742
- details.appendChild(size);
2743
- var removeButton = createTextElement('button', 'btn btn-sm btn-outline-danger remove-chat-document-btn', ' Remove');
2734
+ var actions = window.document.createElement('div');
2735
+ actions.className = 'd-flex gap-1';
2736
+ var downloadBaseUrl = config.downloadDocumentBaseUrl || '/ai/documents/';
2737
+ var downloadLink = createTextElement('a', 'btn btn-sm btn-outline-secondary', '');
2738
+ downloadLink.title = 'Download';
2739
+ downloadLink.href = downloadBaseUrl + encodeURIComponent(documentInfo.documentId) + '/download';
2740
+ var downloadIcon = window.document.createElement('i');
2741
+ downloadIcon.className = 'fa-solid fa-download';
2742
+ downloadLink.appendChild(downloadIcon);
2743
+ var removeButton = createTextElement('button', 'btn btn-sm btn-outline-danger remove-chat-document-btn', '');
2744
2744
  removeButton.type = 'button';
2745
+ removeButton.title = 'Remove';
2745
2746
  removeButton.dataset.documentId = documentInfo.documentId;
2746
2747
  var removeIcon = window.document.createElement('i');
2747
2748
  removeIcon.className = 'fa-solid fa-trash';
2748
- removeButton.prepend(removeIcon);
2749
+ removeButton.appendChild(removeIcon);
2749
2750
  removeButton.addEventListener('click', function () {
2750
2751
  return removeDocument(documentInfo.documentId);
2751
2752
  });
2753
+ actions.appendChild(downloadLink);
2754
+ actions.appendChild(removeButton);
2755
+ var details = window.document.createElement('div');
2756
+ details.className = 'min-w-0';
2757
+ var name = createTextElement('div', 'fw-semibold small text-truncate', documentInfo.fileName || 'Document');
2758
+ var icon = window.document.createElement('i');
2759
+ icon.className = 'fa-solid fa-file-lines me-1';
2760
+ name.prepend(icon);
2761
+ var size = createTextElement('div', 'text-muted small', formatFileSize(documentInfo.fileSize));
2762
+ details.appendChild(name);
2763
+ details.appendChild(size);
2764
+ row.appendChild(actions);
2752
2765
  row.appendChild(details);
2753
- row.appendChild(removeButton);
2754
2766
  documentsList.appendChild(row);
2755
2767
  });
2756
2768
  }