feat: enhance image handling in chat and drop zone components

- Updated ImageAttachment interface to make 'id' and 'size' optional for better compatibility with server messages.
- Improved image display in AgentView for user messages, including a count of attached images and a clickable preview.
- Refined ImageDropZone to conditionally render file size and ensure proper handling of image removal actions.
This commit is contained in:
Kacper
2025-12-16 03:11:01 +01:00
parent 7eeba5f17c
commit 23cef5fd82
4 changed files with 65 additions and 19 deletions

View File

@@ -244,14 +244,16 @@ export function ImageDropZone({
<p className="text-xs font-medium text-foreground truncate">
{image.filename}
</p>
<p className="text-xs text-muted-foreground">
{formatFileSize(image.size)}
</p>
{image.size !== undefined && (
<p className="text-xs text-muted-foreground">
{formatFileSize(image.size)}
</p>
)}
</div>
{/* Remove button */}
{!disabled && (
{!disabled && image.id && (
<button
onClick={() => removeImage(image.id)}
onClick={() => removeImage(image.id!)}
className="opacity-0 group-hover:opacity-100 transition-opacity p-1 rounded-full hover:bg-destructive hover:text-destructive-foreground text-muted-foreground"
>
<X className="h-3 w-3" />