修复 Markdown 换行归一化

先统一 CRLF 与 LF,再压缩正文中的多余空行
This commit is contained in:
2026-09-15 23:46:16 +08:00
parent a40b7b31ee
commit 8b5d0e9200
@@ -18,6 +18,7 @@ export type ChatMarkdownMessageProps = {
/** 只压缩普通 Markdown 正文里多余的空行;代码块中的换行必须原样保留。 */
function normalizeMarkdownBlankLines(text: string) {
return text
.replace(/\r\n?/g, '\n')
.split(/(```[\s\S]*?```)/g)
.map((part, index) =>
index % 2 === 1