mirror of
https://github.com/infiniflow/ragflow.git
synced 2025-12-08 12:32: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 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.
|
||||
const MarkdownContent = ({
|
||||
reference,
|
||||
@ -121,7 +121,7 @@ const MarkdownContent = ({
|
||||
document,
|
||||
};
|
||||
},
|
||||
[fileThumbnails, reference?.chunks, reference?.doc_aggs],
|
||||
[fileThumbnails, reference],
|
||||
);
|
||||
|
||||
const getPopoverContent = useCallback(
|
||||
|
||||
@ -29,9 +29,9 @@ export const buildMessageItemReference = (
|
||||
conversation: { message: IMessage[]; reference: IReference[] },
|
||||
message: IMessage,
|
||||
) => {
|
||||
const assistantMessages = conversation.message?.filter(
|
||||
(x) => x.role === MessageType.Assistant,
|
||||
);
|
||||
const assistantMessages = conversation.message
|
||||
?.filter((x) => x.role === MessageType.Assistant)
|
||||
.slice(1);
|
||||
const referenceIndex = assistantMessages.findIndex(
|
||||
(x) => x.id === message.id,
|
||||
);
|
||||
@ -47,11 +47,7 @@ export const currentReg = /\[ID:(\d+)\]/g;
|
||||
|
||||
// To be compatible with the old index matching mode
|
||||
export const replaceTextByOldReg = (text: string) => {
|
||||
return (
|
||||
text
|
||||
// ?.replace(currentReg, transformReg)
|
||||
.replace(oldReg, (substring: string) => {
|
||||
return `[ID:${substring.slice(2, -2)}]`;
|
||||
})
|
||||
);
|
||||
return text.replace(oldReg, (substring: string) => {
|
||||
return `[ID:${substring.slice(2, -2)}]`;
|
||||
});
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user