mirror of
https://github.com/infiniflow/ragflow.git
synced 2025-12-08 20:42:30 +08:00
### What problem does this PR solve? Fix: Wrong Citation Display #8594 #8474 ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue)
This commit is contained in:
@ -31,7 +31,7 @@ import classNames from 'classnames';
|
|||||||
import { pipe } from 'lodash/fp';
|
import { pipe } from 'lodash/fp';
|
||||||
import styles from './index.less';
|
import styles from './index.less';
|
||||||
|
|
||||||
const getChunkIndex = (match: string) => Number(match.slice(2, -2));
|
const getChunkIndex = (match: string) => Number(match);
|
||||||
// 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.
|
||||||
const MarkdownContent = ({
|
const MarkdownContent = ({
|
||||||
reference,
|
reference,
|
||||||
@ -121,7 +121,7 @@ const MarkdownContent = ({
|
|||||||
document,
|
document,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
[fileThumbnails, reference?.chunks, reference?.doc_aggs],
|
[fileThumbnails, reference],
|
||||||
);
|
);
|
||||||
|
|
||||||
const getPopoverContent = useCallback(
|
const getPopoverContent = useCallback(
|
||||||
|
|||||||
@ -29,9 +29,9 @@ export const buildMessageItemReference = (
|
|||||||
conversation: { message: IMessage[]; reference: IReference[] },
|
conversation: { message: IMessage[]; reference: IReference[] },
|
||||||
message: IMessage,
|
message: IMessage,
|
||||||
) => {
|
) => {
|
||||||
const assistantMessages = conversation.message?.filter(
|
const assistantMessages = conversation.message
|
||||||
(x) => x.role === MessageType.Assistant,
|
?.filter((x) => x.role === MessageType.Assistant)
|
||||||
);
|
.slice(1);
|
||||||
const referenceIndex = assistantMessages.findIndex(
|
const referenceIndex = assistantMessages.findIndex(
|
||||||
(x) => x.id === message.id,
|
(x) => x.id === message.id,
|
||||||
);
|
);
|
||||||
@ -47,11 +47,7 @@ export const currentReg = /\[ID:(\d+)\]/g;
|
|||||||
|
|
||||||
// To be compatible with the old index matching mode
|
// To be compatible with the old index matching mode
|
||||||
export const replaceTextByOldReg = (text: string) => {
|
export const replaceTextByOldReg = (text: string) => {
|
||||||
return (
|
return text.replace(oldReg, (substring: string) => {
|
||||||
text
|
return `[ID:${substring.slice(2, -2)}]`;
|
||||||
// ?.replace(currentReg, transformReg)
|
});
|
||||||
.replace(oldReg, (substring: string) => {
|
|
||||||
return `[ID:${substring.slice(2, -2)}]`;
|
|
||||||
})
|
|
||||||
);
|
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user