@@ -4,59 +4,8 @@ import {
44 MessagePrimitive ,
55 type ToolCallMessagePartProps ,
66} from "@assistant-ui/react" ;
7- import ReactMarkdown from "react-markdown" ;
8- import type { FC , ReactNode } from "react" ;
9-
10- const markdownComponents = {
11- h1 : ( { children } : { children ?: ReactNode } ) => (
12- < h1 className = "text-lg font-semibold text-gray-900 dark:text-gray-100 mb-3" >
13- { children }
14- </ h1 >
15- ) ,
16- h2 : ( { children } : { children ?: ReactNode } ) => (
17- < h2 className = "text-base font-semibold text-gray-900 dark:text-gray-100 mb-2 mt-4" >
18- { children }
19- </ h2 >
20- ) ,
21- h3 : ( { children } : { children ?: ReactNode } ) => (
22- < h3 className = "text-sm font-semibold text-gray-900 dark:text-gray-100 mb-2 mt-3" >
23- { children }
24- </ h3 >
25- ) ,
26- p : ( { children } : { children ?: ReactNode } ) => (
27- < p className = "text-sm text-gray-700 dark:text-gray-300 leading-relaxed mb-3" >
28- { children }
29- </ p >
30- ) ,
31- strong : ( { children } : { children ?: ReactNode } ) => (
32- < strong className = "font-semibold text-gray-900 dark:text-gray-100" >
33- { children }
34- </ strong >
35- ) ,
36- ul : ( { children } : { children ?: ReactNode } ) => (
37- < ul className = "list-disc ml-4 mb-3 space-y-1 text-sm text-gray-700 dark:text-gray-300" >
38- { children }
39- </ ul >
40- ) ,
41- ol : ( { children } : { children ?: ReactNode } ) => (
42- < ol className = "list-decimal ml-4 mb-3 space-y-1 text-sm text-gray-700 dark:text-gray-300" >
43- { children }
44- </ ol >
45- ) ,
46- li : ( { children } : { children ?: ReactNode } ) => (
47- < li className = "leading-relaxed" > { children } </ li >
48- ) ,
49- code : ( { children } : { children ?: ReactNode } ) => (
50- < code className = "bg-gray-100 dark:bg-gray-800 text-primary px-1 py-0.5 rounded text-xs font-mono" >
51- { children }
52- </ code >
53- ) ,
54- pre : ( { children } : { children ?: ReactNode } ) => (
55- < pre className = "bg-gray-50 dark:bg-gray-900 rounded-lg p-3 overflow-x-auto mb-3 text-xs" >
56- { children }
57- </ pre >
58- ) ,
59- } ;
7+ import type { FC } from "react" ;
8+ import { MarkdownText } from "./markdown-text" ;
609
6110// Only show a minimal loading indicator while tool is running, hide result
6211const ToolFallback : FC < ToolCallMessagePartProps > = ( { toolName, result } ) => {
@@ -89,11 +38,7 @@ const AssistantMessage: FC = () => {
8938 < div className = "max-w-[95%]" >
9039 < MessagePrimitive . Content
9140 components = { {
92- Text : ( { text } ) => (
93- < ReactMarkdown components = { markdownComponents } >
94- { text }
95- </ ReactMarkdown >
96- ) ,
41+ Text : MarkdownText ,
9742 tools : {
9843 Fallback : ToolFallback ,
9944 } ,
0 commit comments