diff --git a/frontend/src/components/Document.tsx b/frontend/src/components/Document.tsx index c2b194c3..e33468e8 100644 --- a/frontend/src/components/Document.tsx +++ b/frontend/src/components/Document.tsx @@ -18,6 +18,7 @@ function isValidHttpUrl(str: string) { function DocumentViewer(props: { document: MessageDocument; + markdown?: boolean; className?: string; }) { const [open, setOpen] = useState(false); @@ -79,7 +80,10 @@ function DocumentViewer(props: { - + {metadata.map(({ key, value }, idx) => { @@ -105,12 +109,20 @@ function DocumentViewer(props: { ); } -export function DocumentList(props: { documents: MessageDocument[] }) { +export function DocumentList(props: { + documents: MessageDocument[]; + markdown?: boolean; +}) { return (
{props.documents.map((document, idx) => ( - + ))}
diff --git a/frontend/src/components/Message.tsx b/frontend/src/components/Message.tsx index 7e66fec2..6ed16cc7 100644 --- a/frontend/src/components/Message.tsx +++ b/frontend/src/components/Message.tsx @@ -102,7 +102,10 @@ function isDocumentContent( export function MessageContent(props: { content: MessageType["content"] }) { if (typeof props.content === "string") { - return ; + if (!props.content.trim()) { + return null; + } + return ; } else if (isDocumentContent(props.content)) { return ; } else if ( @@ -113,6 +116,7 @@ export function MessageContent(props: { content: MessageType["content"] }) { ) { return ( ({ page_content: it.content, metadata: omit(it, "content"), diff --git a/frontend/src/components/String.tsx b/frontend/src/components/String.tsx index b547e834..f4360496 100644 --- a/frontend/src/components/String.tsx +++ b/frontend/src/components/String.tsx @@ -7,13 +7,21 @@ const OPTIONS: MarkedOptions = { breaks: true, }; -export function StringViewer(props: { value: string; className?: string }) { - return ( +export function StringViewer(props: { + value: string; + className?: string; + markdown?: boolean; +}) { + return props.markdown ? (
+ ) : ( +
+ {props.value} +
); }