Feat: Show formulas when answering, show reference labels in style, remove cursor flashing effect. #5173 (#5174)

### What problem does this PR solve?

Feat: Show formulas when answering, show reference labels in style,
remove cursor flashing effect. #5173

### Type of change


- [x] New Feature (non-breaking change which adds functionality)
This commit is contained in:
balibabu 2025-02-20 12:19:53 +08:00 committed by GitHub
parent 0c6d787f92
commit ed943b1b5b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 10 additions and 9 deletions

View File

@ -6,6 +6,10 @@
margin-bottom: 10px; margin-bottom: 10px;
font-size: 12px; font-size: 12px;
} }
:global(blockquote) {
padding-left: 10px;
border-left: 4px solid #ccc;
}
} }
.referencePopoverWrapper { .referencePopoverWrapper {

View File

@ -27,7 +27,7 @@ import { pipe } from 'lodash/fp';
import styles from './index.less'; import styles from './index.less';
const reg = /(~{2}\d+={2})/g; const reg = /(~{2}\d+={2})/g;
const curReg = /(~{2}\d+\${2})/g; // const curReg = /(~{2}\d+\${2})/g;
const getChunkIndex = (match: string) => Number(match.slice(2, -2)); const getChunkIndex = (match: string) => Number(match.slice(2, -2));
// TODO: The display of the table is inconsistent with the display previously placed in the MessageItem. // TODO: The display of the table is inconsistent with the display previously placed in the MessageItem.
@ -35,7 +35,6 @@ const MarkdownContent = ({
reference, reference,
clickDocumentButton, clickDocumentButton,
content, content,
loading,
}: { }: {
content: string; content: string;
loading: boolean; loading: boolean;
@ -51,10 +50,8 @@ const MarkdownContent = ({
text = t('chat.searching'); text = t('chat.searching');
} }
const nextText = replaceTextByOldReg(text); const nextText = replaceTextByOldReg(text);
return loading return pipe(replaceThinkToSection, preprocessLaTeX)(nextText);
? nextText?.concat('~~2$$') // TODO: The style of thinking also needs to be displayed when outputting }, [content, t]);
: pipe(replaceThinkToSection, preprocessLaTeX)(nextText);
}, [content, loading, t]);
useEffect(() => { useEffect(() => {
const docAggs = reference?.doc_aggs; const docAggs = reference?.doc_aggs;
@ -173,9 +170,9 @@ const MarkdownContent = ({
); );
}); });
replacedText = reactStringReplace(replacedText, curReg, (match, i) => ( // replacedText = reactStringReplace(replacedText, curReg, (match, i) => (
<span className={styles.cursor} key={i}></span> // <span className={styles.cursor} key={i}></span>
)); // ));
return replacedText; return replacedText;
}, },