Feat: Display Think for Deepseek R1 model #4903 (#4930)

### What problem does this PR solve?

Feat: Display Think for Deepseek R1 model #4903

### Type of change

- [x] New Feature (non-breaking change which adds functionality)
This commit is contained in:
balibabu
2025-02-13 15:59:42 +08:00
committed by GitHub
parent 50c99599f2
commit ff237f2dbc
3 changed files with 25 additions and 8 deletions

View File

@ -20,9 +20,10 @@ import { useTranslation } from 'react-i18next';
import 'katex/dist/katex.min.css'; // `rehype-katex` does not import the CSS for you
import { preprocessLaTeX } from '@/utils/chat';
import { preprocessLaTeX, replaceThinkToSection } from '@/utils/chat';
import { replaceTextByOldReg } from '../utils';
import { pipe } from 'lodash/fp';
import styles from './index.less';
const reg = /(~{2}\d+={2})/g;
@ -50,7 +51,9 @@ const MarkdownContent = ({
text = t('chat.searching');
}
const nextText = replaceTextByOldReg(text);
return loading ? nextText?.concat('~~2$$') : preprocessLaTeX(nextText);
return loading
? nextText?.concat('~~2$$')
: pipe(replaceThinkToSection, preprocessLaTeX)(nextText);
}, [content, loading, t]);
useEffect(() => {