From 469517414994e84d08db843e3d7e186326f25122 Mon Sep 17 00:00:00 2001 From: sabaimran Date: Fri, 8 Nov 2024 15:12:48 -0800 Subject: [PATCH] Add support for file preview in the chat input area (before message sent) --- .../chatInputArea/chatInputArea.tsx | 115 +++++++++++------- 1 file changed, 72 insertions(+), 43 deletions(-) diff --git a/src/interface/web/app/components/chatInputArea/chatInputArea.tsx b/src/interface/web/app/components/chatInputArea/chatInputArea.tsx index a5b2482b..bd22a0ee 100644 --- a/src/interface/web/app/components/chatInputArea/chatInputArea.tsx +++ b/src/interface/web/app/components/chatInputArea/chatInputArea.tsx @@ -44,6 +44,15 @@ import { InlineLoading } from "../loading/loading"; import { getIconForSlashCommand, getIconFromFileType } from "@/app/common/iconUtils"; import { packageFilesForUpload } from "@/app/common/chatFunctions"; import { convertBytesToText } from "@/app/common/utils"; +import { + Dialog, + DialogContent, + DialogDescription, + DialogHeader, + DialogTitle, + DialogTrigger, +} from "@/components/ui/dialog"; +import { ScrollArea } from "@/components/ui/scroll-area"; export interface ChatOptions { [key: string]: string; @@ -519,50 +528,70 @@ export const ChatInputArea = forwardRef((pr ))} {convertedAttachedFiles && Array.from(convertedAttachedFiles).map((file, index) => ( -
-
-
- - {file.name} - - - {getIconFromFileType(file.file_type)} - - {convertBytesToText(file.size)} - - + + +
+
+
+ + {file.name} + + + {getIconFromFileType(file.file_type)} + + {convertBytesToText(file.size)} + + +
+
+
-
- -
+ + + + {file.name} + + + + {file.content} + + + + ))}