mirror of
https://github.com/infiniflow/ragflow.git
synced 2025-12-08 20:42:30 +08:00
### What problem does this PR solve? Fix: Display bug in the early stage of conversation chat #7904 ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue)
This commit is contained in:
@ -43,10 +43,17 @@ export const buildMessageItemReference = (
|
|||||||
};
|
};
|
||||||
|
|
||||||
const oldReg = /(#{2}\d+\${2})/g;
|
const oldReg = /(#{2}\d+\${2})/g;
|
||||||
|
const currentReg = /\[ID:(\d+)\]/g;
|
||||||
|
|
||||||
|
function transformReg(substring: string) {
|
||||||
|
return `~~${substring.slice(4, -1)}==`;
|
||||||
|
}
|
||||||
|
|
||||||
// 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 text?.replace(oldReg, function (substring) {
|
return text
|
||||||
return `~~${substring.slice(2, -2)}==`;
|
?.replace(currentReg, transformReg)
|
||||||
});
|
.replace(oldReg, (substring: string) => {
|
||||||
|
return `~~${substring.slice(2, -2)}==`;
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user