Merge pull request #619 from rubyrunsstuff/fix/telegram-block-streaming

fix: enable block streaming for Telegram when streamMode is 'block'
This commit is contained in:
Peter Steinberger
2026-01-10 00:16:04 +00:00
committed by GitHub
5 changed files with 56 additions and 7 deletions

View File

@@ -221,6 +221,10 @@ export class EmbeddedBlockChunker {
if (sentenceIdx >= minChars) return { index: sentenceIdx };
}
if (preference === "newline" && buffer.length < maxChars) {
return { index: -1 };
}
for (let i = window.length - 1; i >= minChars; i--) {
if (/\s/.test(window[i]) && isSafeFenceBreak(fenceSpans, i)) {
return { index: i };