fix: ensure newlines around think tags for proper markdown rendering (#20594)

pull/20597/head
sayThQ199 8 months ago committed by GitHub
parent ca0b268ae5
commit 077d627953
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -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…
Cancel
Save