We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 05d679e commit da6d60cCopy full SHA for da6d60c
packages/core/src/generation.ts
@@ -1493,19 +1493,13 @@ export function splitText(
1493
1494
while (start < content.length) {
1495
const end = Math.min(start + chunkSize, content.length);
1496
-
1497
// Ensure we're not creating empty or invalid chunks
1498
if (end > start) {
1499
chunks.push(content.substring(start, end));
1500
}
1501
1502
- // Ensure forward progress and prevent infinite loops
1503
- const nextStart = end - bleed;
1504
- if (nextStart <= start) {
1505
- start = end; // If no progress would be made, skip the bleed
1506
- } else {
1507
- start = nextStart;
1508
- }
+ // Ensure forward progress while preventing infinite loops
+ start = Math.max(end - bleed, start + 1);
1509
1510
1511
return chunks;
0 commit comments