mirror of
https://git.mirrors.martin98.com/https://github.com/langgenius/dify.git
synced 2025-08-15 12:35:57 +08:00
fix: ensure newlines around think tags for proper markdown rendering (#20594)
This commit is contained in:
parent
ca0b268ae5
commit
077d627953
@ -33,5 +33,6 @@ export const preprocessThinkTag = (content: string) => {
|
||||
return flow([
|
||||
(str: string) => str.replace(thinkOpenTagRegex, '<details data-think=true>\n'),
|
||||
(str: string) => str.replace(thinkCloseTagRegex, '\n[ENDTHINKFLAG]</details>'),
|
||||
(str: string) => str.replace(/(<\/details>)(?![^\S\r\n]*[\r\n])(?![^\S\r\n]*$)/g, '$1\n'),
|
||||
])(content)
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user