fix: think content render as markdown (#4564)

* fix: think content render as markdown

* chore: fix linter issue failed on CI
This commit is contained in:
Faisal Amir 2025-02-04 14:54:21 +07:00 committed by GitHub
parent daa7c0ca21
commit f8557c78d5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 6 additions and 2 deletions

View File

@ -19,7 +19,7 @@ import { useClipboard } from '@/hooks/useClipboard'
import { getLanguageFromExtension } from '@/utils/codeLanguageExtension'
export const MarkdownTextMessage = memo(
({ text, isUser }: { id: string; text: string; isUser: boolean }) => {
({ text, isUser }: { id?: string; text: string; isUser?: boolean }) => {
const clipboard = useClipboard({ timeout: 1000 })
// Escapes headings

View File

@ -3,6 +3,8 @@ import React from 'react'
import { atom, useAtom } from 'jotai'
import { ChevronDown, ChevronUp, Loader } from 'lucide-react'
import { MarkdownTextMessage } from './MarkdownTextMessage'
interface Props {
text: string
status: string
@ -48,7 +50,9 @@ const ThinkingBlock = ({ id, text, status }: Props) => {
{isExpanded && (
<div className="mt-2 pl-6 text-[hsla(var(--text-secondary))]">
{text.replace(/<\/?think>/g, '').trim()}
<MarkdownTextMessage
text={text.replace(/<\/?think>/g, '').trim()}
/>
</div>
)}
</div>