fix: TypeScript error in react-markdown code component
This commit is contained in:
@@ -973,9 +973,10 @@ export default function AIAssist() {
|
|||||||
remarkPlugins={[remarkGfm]}
|
remarkPlugins={[remarkGfm]}
|
||||||
rehypePlugins={[rehypeHighlight]}
|
rehypePlugins={[rehypeHighlight]}
|
||||||
components={{
|
components={{
|
||||||
code({ node, inline, className, children, ...props }) {
|
code({ node, className, children, ...props }: any) {
|
||||||
const match = /language-(\w+)/.exec(className || "");
|
const match = /language-(\w+)/.exec(className || "");
|
||||||
return !inline ? (
|
const isInline = !match && !String(children).includes('\n');
|
||||||
|
return !isInline ? (
|
||||||
<div className="relative group/code w-full overflow-hidden">
|
<div className="relative group/code w-full overflow-hidden">
|
||||||
<pre className={cn(
|
<pre className={cn(
|
||||||
"p-4 rounded-xl bg-slate-950/50 border border-white/5 overflow-x-auto scrollbar-thin scrollbar-thumb-white/10",
|
"p-4 rounded-xl bg-slate-950/50 border border-white/5 overflow-x-auto scrollbar-thin scrollbar-thumb-white/10",
|
||||||
@@ -993,6 +994,7 @@ export default function AIAssist() {
|
|||||||
);
|
);
|
||||||
},
|
},
|
||||||
}}
|
}}
|
||||||
|
|
||||||
>
|
>
|
||||||
{parseStreamingContent(msg.content, msg.agent || "general").chatDisplay || (msg.role === "assistant" ? "..." : "")}
|
{parseStreamingContent(msg.content, msg.agent || "general").chatDisplay || (msg.role === "assistant" ? "..." : "")}
|
||||||
</ReactMarkdown>
|
</ReactMarkdown>
|
||||||
|
|||||||
Reference in New Issue
Block a user