diff --git a/webapp/components/message-content.tsx b/webapp/components/message-content.tsx index 4eb2473..3953fa3 100644 --- a/webapp/components/message-content.tsx +++ b/webapp/components/message-content.tsx @@ -1,6 +1,7 @@ import { Markdown } from './markdown'; import { ChatMessageContentDto } from './chat.type'; import { Card } from './ui/card'; +import { useMemo } from 'react'; export interface ChatMessageProps { @@ -9,10 +10,12 @@ export interface ChatMessageProps { export function MessageContent({ content }: ChatMessageProps) { const textContent = content?.filter((contentItem) => contentItem.type === 'text')?.map((contentItem) => contentItem.text.value).join(''); + const markdown = useMemo(() => {textContent}, [textContent]); const images = content?.filter((contentItem) => contentItem.type === 'image_file' || contentItem.type === 'image_url'); + return ( <> - {textContent} + { markdown } { images?.map((image, index) => {JSON.stringify(image)})} );