diff --git a/frontend/src/components/AttachmentUpload.vue b/frontend/src/components/AttachmentUpload.vue index a24bfd6f..c99338a5 100644 --- a/frontend/src/components/AttachmentUpload.vue +++ b/frontend/src/components/AttachmentUpload.vue @@ -3,6 +3,7 @@ import { ref, computed, onMounted, onUnmounted } from 'vue'; import { MessagePlugin } from 'tdesign-vue-next'; import { useI18n } from 'vue-i18n'; import { MAX_FILE_SIZE_MB } from '@/utils'; +import ArtifactFileIcon from '@/views/chat/components/ArtifactFileIcon.vue'; import { useEditorResourcesStore } from '@/stores/editorResources'; import { deleteTemporaryAttachment, @@ -216,22 +217,6 @@ const formatFileSize = (bytes: number): string => { return (bytes / (1024 * 1024)).toFixed(1) + ' MB'; }; -const getFileExt = (fileName: string): string => { - return fileName.split('.').pop()?.toUpperCase() || 'FILE'; -}; - -const getFileIcon = (fileName: string): string => { - const ext = fileName.split('.').pop()?.toLowerCase(); - if (['pdf'].includes(ext || '')) return 'file-pdf'; - if (['doc', 'docx'].includes(ext || '')) return 'file-word'; - if (['xls', 'xlsx'].includes(ext || '')) return 'file-excel'; - if (['ppt', 'pptx'].includes(ext || '')) return 'file-powerpoint'; - if (['epub', 'mhtml'].includes(ext || '')) return 'file'; - if (['txt', 'md'].includes(ext || '')) return 'file'; - if (['mp3', 'wav', 'm4a', 'flac', 'ogg', 'aac'].includes(ext || '')) return 'sound'; - return 'file'; -}; - const statusLabel = (attachment: AttachmentFile): string => { if (attachment.status === 'uploading') return t('chat.attachmentUploading', { progress: attachment.progress || 0 }); if (attachment.status === 'uploaded' || attachment.status === 'processing') return t('chat.attachmentParsing'); @@ -278,19 +263,10 @@ defineExpose({ :key="attachment.id" class="attachment-preview-item" > -
+