Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion v5/src/components/ChatFab.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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
// <cite index="1-9">…</cite>. 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(/<cite\b[^>]*>/gi, "").replace(/<\/cite>/gi, "");
}
Comment on lines +35 to +37

function Icon({
name,
}: {
Expand Down Expand Up @@ -419,7 +427,7 @@ export function ChatFab() {
remarkPlugins={[remarkGfm]}
components={markdownComponents}
>
{part.text}
{stripCitations(part.text)}
</ReactMarkdown>
</div>
) : (
Expand Down