mirror of
https://git.mirrors.martin98.com/https://github.com/infiniflow/ragflow.git
synced 2025-06-30 17:55:09 +08:00
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)
This commit is contained in:
parent
a1f06a4fdc
commit
d73a08b9eb
@ -112,11 +112,6 @@ const MarkdownContent = ({
|
|||||||
const fileThumbnail = documentId ? fileThumbnails[documentId] : '';
|
const fileThumbnail = documentId ? fileThumbnails[documentId] : '';
|
||||||
const fileExtension = documentId ? getExtension(document?.doc_name) : '';
|
const fileExtension = documentId ? getExtension(document?.doc_name) : '';
|
||||||
const imageId = chunkItem?.image_id;
|
const imageId = chunkItem?.image_id;
|
||||||
const docType = chunkItem?.doc_type;
|
|
||||||
|
|
||||||
return showImage(docType) ? (
|
|
||||||
<Image id={imageId} className={styles.referenceChunkImage}></Image>
|
|
||||||
) : null;
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div key={chunkItem?.id} className="flex gap-2">
|
<div key={chunkItem?.id} className="flex gap-2">
|
||||||
@ -181,9 +176,15 @@ const MarkdownContent = ({
|
|||||||
const renderReference = useCallback(
|
const renderReference = useCallback(
|
||||||
(text: string) => {
|
(text: string) => {
|
||||||
let replacedText = reactStringReplace(text, reg, (match, i) => {
|
let replacedText = reactStringReplace(text, reg, (match, i) => {
|
||||||
|
const chunks = reference?.chunks ?? [];
|
||||||
const chunkIndex = getChunkIndex(match);
|
const chunkIndex = getChunkIndex(match);
|
||||||
return getPopoverContent(chunkIndex);
|
const chunkItem = chunks[chunkIndex];
|
||||||
return (
|
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}>
|
<Popover content={getPopoverContent(chunkIndex)} key={i}>
|
||||||
<InfoCircleOutlined className={styles.referenceIcon} />
|
<InfoCircleOutlined className={styles.referenceIcon} />
|
||||||
</Popover>
|
</Popover>
|
||||||
@ -196,7 +197,7 @@ const MarkdownContent = ({
|
|||||||
|
|
||||||
return replacedText;
|
return replacedText;
|
||||||
},
|
},
|
||||||
[getPopoverContent],
|
[getPopoverContent, reference?.chunks],
|
||||||
);
|
);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
Loading…
x
Reference in New Issue
Block a user