2 import type { ChatAttachmentDisplayItem } from '$lib/types';
3 import { Image, Music, Video, FileText, FileIcon } from '@lucide/svelte';
4 import ChatAttachmentsPreviewCurrentItemPdf from './ChatAttachmentsPreviewCurrentItemPdf.svelte';
5 import ChatAttachmentsPreviewCurrentItemImage from './ChatAttachmentsPreviewCurrentItemImage.svelte';
6 import ChatAttachmentsPreviewCurrentItemAudio from './ChatAttachmentsPreviewCurrentItemAudio.svelte';
7 import ChatAttachmentsPreviewCurrentItemVideo from './ChatAttachmentsPreviewCurrentItemVideo.svelte';
8 import ChatAttachmentsPreviewCurrentItemText from './ChatAttachmentsPreviewCurrentItemText.svelte';
9 import ChatAttachmentsPreviewCurrentItemUnavailable from './ChatAttachmentsPreviewCurrentItemUnavailable.svelte';
12 currentItem: ChatAttachmentDisplayItem | null;
18 displayPreview: string | undefined;
19 displayTextContent: string | undefined;
20 audioSrc: string | null;
21 videoSrc: string | null;
23 hasVisionModality: boolean;
24 activeModelId?: string;
43 let IconComponent = $derived(
44 isImage ? Image : isText || isPdf ? FileText : isAudio ? Music : isVideo ? Video : FileIcon
47 let isUnavailable = $derived(
48 !isPdf && !isImage && !(isText && displayTextContent) && !isAudio && !isVideo
55 <ChatAttachmentsPreviewCurrentItemPdf
57 displayName={currentItem.name}
63 <ChatAttachmentsPreviewCurrentItemImage {currentItem} {displayPreview} />
64 {:else if isText && displayTextContent}
65 <ChatAttachmentsPreviewCurrentItemText {displayTextContent} {language} />
67 <ChatAttachmentsPreviewCurrentItemAudio {currentItem} {audioSrc} />
69 <ChatAttachmentsPreviewCurrentItemVideo {currentItem} {videoSrc} />
70 {:else if isUnavailable}
71 <ChatAttachmentsPreviewCurrentItemUnavailable {IconComponent} />