diff --git a/src/lib/utils/index.ts b/src/lib/utils/index.ts index a7a0fca32..265c47cec 100644 --- a/src/lib/utils/index.ts +++ b/src/lib/utils/index.ts @@ -894,8 +894,8 @@ export const extractSentences = (text: string) => { return placeholder; }); - // Split the modified text into sentences based on common punctuation marks, avoiding these blocks - let sentences = text.split(/(?<=[.!?])\s+/); + // Split the modified text into sentences based on common punctuation marks or newlines, avoiding these blocks + let sentences = text.split(/(?<=[.!?])\s+|\n+/); // Restore code blocks and process sentences sentences = sentences.map((sentence) => {