perf: memo GridCard, fuse save fns, fix slash tab active color
Some checks failed
CI / Lint, Unit Tests & Build (push) Failing after 1m32s
CI / Deploy production (on server) (push) Has been skipped

This commit is contained in:
Antigravity
2026-06-14 14:06:05 +00:00
parent a8785ed4f1
commit a623454347
120 changed files with 12301 additions and 785 deletions

View File

@@ -20,6 +20,21 @@ interface MarkdownContentProps {
}
export const MarkdownContent = memo(function MarkdownContent({ content, className }: MarkdownContentProps) {
// Strip <think>...</think> and <thinking>...</thinking> blocks produced by reasoning models
// (MiniMax, DeepSeek R1, etc.) before passing to ReactMarkdown — rehypeRaw would otherwise
// try to render them as HTML elements causing React warnings.
// Also handles partial/unclosed blocks during streaming (e.g. <think> without </think> yet).
const safeContent = useMemo(
() => content
.replace(/<think>[\s\S]*?<\/think>/gi, '') // complete think blocks
.replace(/<think>[\s\S]*/i, '') // unclosed think block (still streaming)
.replace(/<thinking>[\s\S]*?<\/thinking>/gi, '') // complete thinking blocks
.replace(/<thinking>[\s\S]*/i, '') // unclosed thinking block
.trim(),
[content]
)
return (
<div dir="auto" className={`prose prose-sm prose-compact dark:prose-invert max-w-none break-words ${className}`}>
<ReactMarkdown
@@ -56,8 +71,9 @@ export const MarkdownContent = memo(function MarkdownContent({ content, classNam
},
}}
>
{content}
{safeContent}
</ReactMarkdown>
</div>
)
})