Skip to content

RAGFlow is an agent-native database: a Retrieval-Augmented Generation (RAG) engine that grew into context infrastructure.

Fix: Display bug in the early stage of conversation chat #7904 (#7922)

balibabu7c098f9fd1de
diff --git a/web/src/pages/chat/utils.ts b/web/src/pages/chat/utils.ts
index 1a404eadb2..2a21e69374 100644
--- a/web/src/pages/chat/utils.ts
+++ b/web/src/pages/chat/utils.ts
@@ -43,10 +43,17 @@ export const buildMessageItemReference = (
};
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
export const replaceTextByOldReg = (text: string) => {
- return text?.replace(oldReg, function (substring) {
- return `~~${substring.slice(2, -2)}==`;
- });
+ return text
+ ?.replace(currentReg, transformReg)
+ .replace(oldReg, (substring: string) => {
+ return `~~${substring.slice(2, -2)}==`;
+ });
};