Переглянути джерело

Fix: Fixed the issue where message references could not be displayed (#7691)

### What problem does this PR solve?

Fix: Fixed the issue where message references could not be displayed

### Type of change

- [x] Bug Fix (non-breaking change which fixes an issue)
tags/v0.19.0
balibabu 5 місяці тому
джерело
коміт
d73a08b9eb
Аккаунт користувача з таким Email не знайдено
1 змінених файлів з 9 додано та 8 видалено
  1. 9
    8
      web/src/pages/chat/markdown-content/index.tsx

+ 9
- 8
web/src/pages/chat/markdown-content/index.tsx Переглянути файл

@@ -112,11 +112,6 @@ const MarkdownContent = ({
const fileThumbnail = documentId ? fileThumbnails[documentId] : '';
const fileExtension = documentId ? getExtension(document?.doc_name) : '';
const imageId = chunkItem?.image_id;
const docType = chunkItem?.doc_type;

return showImage(docType) ? (
<Image id={imageId} className={styles.referenceChunkImage}></Image>
) : null;

return (
<div key={chunkItem?.id} className="flex gap-2">
@@ -181,9 +176,15 @@ const MarkdownContent = ({
const renderReference = useCallback(
(text: string) => {
let replacedText = reactStringReplace(text, reg, (match, i) => {
const chunks = reference?.chunks ?? [];
const chunkIndex = getChunkIndex(match);
return getPopoverContent(chunkIndex);
return (
const chunkItem = chunks[chunkIndex];
const imageId = chunkItem?.image_id;
const docType = chunkItem?.doc_type;

return showImage(docType) ? (
<Image id={imageId} className={styles.referenceChunkImage}></Image>
) : (
<Popover content={getPopoverContent(chunkIndex)} key={i}>
<InfoCircleOutlined className={styles.referenceIcon} />
</Popover>
@@ -196,7 +197,7 @@ const MarkdownContent = ({

return replacedText;
},
[getPopoverContent],
[getPopoverContent, reference?.chunks],
);

return (

Завантаження…
Відмінити
Зберегти