修复段落分割逻辑,支持单双换行

This commit is contained in:
openclaw 2026-03-25 09:59:53 +08:00
parent 49a4bcea3d
commit d1c64f7327

View File

@ -347,8 +347,9 @@
const chapter = await response.json(); const chapter = await response.json();
// 将纯文本转换为HTML每段包裹<p>标签) // 将纯文本转换为HTML每段包裹<p>标签)
// 支持单换行或双换行作为段落分隔
const htmlContent = chapter.content const htmlContent = chapter.content
.split('\n\n') .split(/\n\n|\n/)
.filter(p => p.trim()) .filter(p => p.trim())
.map(p => `<p>${p.trim()}</p>`) .map(p => `<p>${p.trim()}</p>`)
.join(''); .join('');