pi-provider-kimi-code 0.1.6 → 0.1.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.ts +4 -5
- package/package.json +1 -1
package/index.ts
CHANGED
|
@@ -308,12 +308,11 @@ function streamSimpleKimi(
|
|
|
308
308
|
}
|
|
309
309
|
if (event.type === "text_end") {
|
|
310
310
|
if (event.content.startsWith(EMPTY_RESPONSE_PREFIX)) {
|
|
311
|
-
// Suppress entire text block — discard buffered events
|
|
311
|
+
// Suppress entire text block — discard buffered events.
|
|
312
|
+
// Do NOT splice content array: it is a shared reference
|
|
313
|
+
// into session state, and mutating it shifts subsequent
|
|
314
|
+
// contentIndex values, corrupting the stream.
|
|
312
315
|
suppressedIndices.add(bufferingIndex);
|
|
313
|
-
const content = event.partial.content;
|
|
314
|
-
if (content[bufferingIndex]?.type === "text") {
|
|
315
|
-
content.splice(bufferingIndex, 1);
|
|
316
|
-
}
|
|
317
316
|
} else {
|
|
318
317
|
// Legitimate text block — flush buffer + end event
|
|
319
318
|
for (const buffered of textBuffer) filtered.push(buffered);
|