Преглед изворни кода

fix: Correctly render multiple think blocks in Markdown (#18310)

Co-authored-by: xzj16125 <xuzijie@noahgroup.com>
Co-authored-by: crazywoola <427733928@qq.com>
tags/1.3.0
sayThQ199 пре 6 месеци
родитељ
комит
b287aaccec
No account linked to committer's email address
1 измењених фајлова са 4 додато и 2 уклоњено
  1. 4
    2
      web/app/components/base/markdown.tsx

+ 4
- 2
web/app/components/base/markdown.tsx Прегледај датотеку

@@ -85,9 +85,11 @@ const preprocessLaTeX = (content: string) => {
}

const preprocessThinkTag = (content: string) => {
const thinkOpenTagRegex = /<think>\n/g
const thinkCloseTagRegex = /\n<\/think>/g
return flow([
(str: string) => str.replace('<think>\n', '<details data-think=true>\n'),
(str: string) => str.replace('\n</think>', '\n[ENDTHINKFLAG]</details>'),
(str: string) => str.replace(thinkOpenTagRegex, '<details data-think=true>\n'),
(str: string) => str.replace(thinkCloseTagRegex, '\n[ENDTHINKFLAG]</details>'),
])(content)
}


Loading…
Откажи
Сачувај