diff --git a/web/app/components/base/markdown/markdown-utils.ts b/web/app/components/base/markdown/markdown-utils.ts index 0089bef0ac..d02f98b51b 100644 --- a/web/app/components/base/markdown/markdown-utils.ts +++ b/web/app/components/base/markdown/markdown-utils.ts @@ -32,8 +32,8 @@ export const preprocessLaTeX = (content: string) => { } export const preprocessThinkTag = (content: string) => { - const thinkOpenTagRegex = /(\n)+/g - const thinkCloseTagRegex = /\n<\/think>/g + const thinkOpenTagRegex = /(\s*)+/g + const thinkCloseTagRegex = /(\s*<\/think>)+/g return flow([ (str: string) => str.replace(thinkOpenTagRegex, '
\n'), (str: string) => str.replace(thinkCloseTagRegex, '\n[ENDTHINKFLAG]
'),