fix(auto-reply): tighten block streaming defaults
This commit is contained in:
@@ -53,6 +53,14 @@ export class EmbeddedBlockChunker {
|
||||
const maxChars = Math.max(minChars, Math.floor(this.#chunking.maxChars));
|
||||
if (this.#buffer.length < minChars && !force) return;
|
||||
|
||||
if (force && this.#buffer.length <= maxChars) {
|
||||
if (this.#buffer.trim().length > 0) {
|
||||
emit(this.#buffer);
|
||||
}
|
||||
this.#buffer = "";
|
||||
return;
|
||||
}
|
||||
|
||||
while (
|
||||
this.#buffer.length >= minChars ||
|
||||
(force && this.#buffer.length > 0)
|
||||
|
||||
@@ -784,7 +784,7 @@ describe("subscribeEmbeddedPiSession", () => {
|
||||
blockReplyBreak: "message_end",
|
||||
blockReplyChunking: {
|
||||
minChars: 5,
|
||||
maxChars: 40,
|
||||
maxChars: 25,
|
||||
breakPreference: "paragraph",
|
||||
},
|
||||
});
|
||||
@@ -836,7 +836,7 @@ describe("subscribeEmbeddedPiSession", () => {
|
||||
blockReplyBreak: "message_end",
|
||||
blockReplyChunking: {
|
||||
minChars: 5,
|
||||
maxChars: 50,
|
||||
maxChars: 25,
|
||||
breakPreference: "paragraph",
|
||||
},
|
||||
});
|
||||
@@ -939,7 +939,7 @@ describe("subscribeEmbeddedPiSession", () => {
|
||||
blockReplyBreak: "message_end",
|
||||
blockReplyChunking: {
|
||||
minChars: 5,
|
||||
maxChars: 40,
|
||||
maxChars: 25,
|
||||
breakPreference: "paragraph",
|
||||
},
|
||||
});
|
||||
@@ -986,7 +986,7 @@ describe("subscribeEmbeddedPiSession", () => {
|
||||
blockReplyBreak: "message_end",
|
||||
blockReplyChunking: {
|
||||
minChars: 5,
|
||||
maxChars: 45,
|
||||
maxChars: 30,
|
||||
breakPreference: "paragraph",
|
||||
},
|
||||
});
|
||||
@@ -1035,7 +1035,7 @@ describe("subscribeEmbeddedPiSession", () => {
|
||||
blockReplyBreak: "message_end",
|
||||
blockReplyChunking: {
|
||||
minChars: 10,
|
||||
maxChars: 50,
|
||||
maxChars: 30,
|
||||
breakPreference: "paragraph",
|
||||
},
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user