diff --git a/v5/src/components/ChatFab.tsx b/v5/src/components/ChatFab.tsx index 18de337..f650ff1 100644 --- a/v5/src/components/ChatFab.tsx +++ b/v5/src/components/ChatFab.tsx @@ -28,6 +28,14 @@ function toolStatusLabel(partType: string, t: ChatT): string { return t("working"); } +// The assistant can wrap grounded text in inline source markup such as +// . react-markdown has no raw-HTML plugin, so those +// tags would render as literal text. Strip the tags while keeping the cited +// prose intact. +function stripCitations(text: string): string { + return text.replace(/]*>/gi, "").replace(/<\/cite>/gi, ""); +} + function Icon({ name, }: { @@ -419,7 +427,7 @@ export function ChatFab() { remarkPlugins={[remarkGfm]} components={markdownComponents} > - {part.text} + {stripCitations(part.text)} ) : (