fix: let prose handle table rendering
This commit is contained in:
parent
8f64c55896
commit
0fa620719b
1 changed files with 1 additions and 31 deletions
|
|
@ -42,16 +42,7 @@ export function ChatMessage({ message, ...props }: ChatMessageProps) {
|
||||||
remarkPlugins={[remarkGfm, remarkMath]}
|
remarkPlugins={[remarkGfm, remarkMath]}
|
||||||
components={{
|
components={{
|
||||||
p({ children }) {
|
p({ children }) {
|
||||||
return (
|
return <p className={cn('mb-2 last:mb-0')}>{children}</p>
|
||||||
<p
|
|
||||||
className={cn(
|
|
||||||
'mb-2 last:mb-0',
|
|
||||||
message.role === 'user' && 'font-semibold'
|
|
||||||
)}
|
|
||||||
>
|
|
||||||
{children}
|
|
||||||
</p>
|
|
||||||
)
|
|
||||||
},
|
},
|
||||||
code({ node, inline, className, children, ...props }) {
|
code({ node, inline, className, children, ...props }) {
|
||||||
if (children.length) {
|
if (children.length) {
|
||||||
|
|
@ -78,27 +69,6 @@ export function ChatMessage({ message, ...props }: ChatMessageProps) {
|
||||||
{children}
|
{children}
|
||||||
</code>
|
</code>
|
||||||
)
|
)
|
||||||
},
|
|
||||||
table({ children }) {
|
|
||||||
return (
|
|
||||||
<table className="border-collapse border border-black px-3 py-1 ">
|
|
||||||
{children}
|
|
||||||
</table>
|
|
||||||
)
|
|
||||||
},
|
|
||||||
th({ children }) {
|
|
||||||
return (
|
|
||||||
<th className="break-words border border-black bg-gray-500 px-3 py-1 text-white ">
|
|
||||||
{children}
|
|
||||||
</th>
|
|
||||||
)
|
|
||||||
},
|
|
||||||
td({ children }) {
|
|
||||||
return (
|
|
||||||
<td className="break-words border border-black px-3 py-1">
|
|
||||||
{children}
|
|
||||||
</td>
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue