fix: frontend for <think> tags conflicting with original <details> tags (#14039)

This commit is contained in:
Junjie.M
2025-02-19 22:04:11 +08:00
committed by GitHub
parent 3f34b8b0d1
commit d96c368660
2 changed files with 5 additions and 6 deletions

View File

@@ -68,13 +68,9 @@ const preprocessLaTeX = (content: string) => {
}
const preprocessThinkTag = (content: string) => {
if (!(content.trim().startsWith('<think>\n') || content.trim().startsWith('<details style=')))
return content
return flow([
(str: string) => str.replaceAll('<think>\n', '<details>\n'),
(str: string) => str.replaceAll('\n</think>', '\n[ENDTHINKFLAG]</details>'),
(str: string) => str.replaceAll('\n</details>', '\n[ENDTHINKFLAG]</details>'),
(str: string) => str.replace('<think>\n', '<details data-think=true>\n'),
(str: string) => str.replace('\n</think>', '\n[ENDTHINKFLAG]</details>'),
])(content)
}