diff --git a/src/interface/web/app/components/chatHistory/chatHistory.tsx b/src/interface/web/app/components/chatHistory/chatHistory.tsx index 772f1d35..37b44f3a 100644 --- a/src/interface/web/app/components/chatHistory/chatHistory.tsx +++ b/src/interface/web/app/components/chatHistory/chatHistory.tsx @@ -373,6 +373,7 @@ export default function ChatHistory(props: ChatHistoryProps) { images: message.images, conversationId: props.conversationId, turnId: messageTurnId, + attachedFiles: message.attachedFiles, }} customClassName="fullHistory" borderLeftColor={`${data?.agent?.color}-500`} diff --git a/src/interface/web/app/components/chatMessage/chatMessage.tsx b/src/interface/web/app/components/chatMessage/chatMessage.tsx index d05d9829..9f9cff12 100644 --- a/src/interface/web/app/components/chatMessage/chatMessage.tsx +++ b/src/interface/web/app/components/chatMessage/chatMessage.tsx @@ -40,6 +40,18 @@ import { AgentData } from "@/app/agents/page"; import renderMathInElement from "katex/contrib/auto-render"; import "katex/dist/katex.min.css"; import ExcalidrawComponent from "../excalidraw/excalidraw"; +import { AttachedFileText } from "../chatInputArea/chatInputArea"; +import { + Dialog, + DialogContent, + DialogDescription, + DialogHeader, + DialogTrigger, +} from "@/components/ui/dialog"; +import { DialogTitle } from "@radix-ui/react-dialog"; +import { convertBytesToText } from "@/app/common/utils"; +import { ScrollArea } from "@/components/ui/scroll-area"; +import { getIconFromFileType } from "@/app/common/iconUtils"; const md = new markdownIt({ html: true, @@ -149,6 +161,7 @@ export interface SingleChatMessage { images?: string[]; conversationId: string; turnId?: string; + attachedFiles?: AttachedFileText[]; } export interface StreamMessage { @@ -165,6 +178,7 @@ export interface StreamMessage { intentType?: string; inferredQueries?: string[]; turnId?: string; + attachedFiles?: AttachedFileText[]; } export interface ChatHistoryData { @@ -398,7 +412,6 @@ const ChatMessage = forwardRef((props, ref) => if (props.chatMessage.intent) { const { type, "inferred-queries": inferredQueries } = props.chatMessage.intent; - console.log("intent type", type); if (type in intentTypeHandlers) { message = intentTypeHandlers[type as keyof typeof intentTypeHandlers](message); } @@ -695,6 +708,33 @@ const ChatMessage = forwardRef((props, ref) => onMouseLeave={(event) => setIsHovering(false)} onMouseEnter={(event) => setIsHovering(true)} > + {props.chatMessage.attachedFiles && props.chatMessage.attachedFiles.length > 0 && ( +
+ {props.chatMessage.attachedFiles.map((file, index) => ( + + +
+ {getIconFromFileType(file.file_type)} + {file.name} + {file.size && ( + + ({convertBytesToText(file.size)}) + + )} +
+
+ + + {file.name} + + + {file.content} + + +
+ ))} +
+ )}