### 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:
parent
b95747be4c
commit
7c098f9fd1
1 changed files with 10 additions and 3 deletions
|
|
@ -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)}==`;
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue