Skip to content

Commit 939ebb7

Browse files
committed
fix(streaming): suppress notification during streaming, notify only on final message
1 parent 239e512 commit 939ebb7

3 files changed

Lines changed: 4 additions & 4 deletions

File tree

src/bot/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -369,7 +369,7 @@ async function ensureEventSubscription(directory: string): Promise<void> {
369369
return;
370370
}
371371

372-
preparedStreamPayload.sendOptions = undefined;
372+
preparedStreamPayload.sendOptions = { disable_notification: true };
373373
preparedStreamPayload.editOptions = undefined;
374374

375375
responseStreamer.enqueue(sessionId, messageId, preparedStreamPayload);

src/bot/utils/finalize-assistant-response.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ export async function finalizeAssistantResponse({
3737

3838
const preparedStreamPayload = prepareStreamingPayload(messageText);
3939
if (preparedStreamPayload) {
40-
preparedStreamPayload.sendOptions = undefined;
40+
preparedStreamPayload.sendOptions = { disable_notification: true };
4141
preparedStreamPayload.editOptions = undefined;
4242
}
4343

tests/bot/utils/finalize-assistant-response.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ describe("bot/utils/finalize-assistant-response", () => {
2727
expect(responseStreamer.complete).toHaveBeenCalledWith("s1", "m1", {
2828
parts: ["final reply"],
2929
format: "raw",
30-
sendOptions: undefined,
30+
sendOptions: { disable_notification: true },
3131
editOptions: undefined,
3232
});
3333
expect(flushPendingServiceMessages).toHaveBeenCalledTimes(1);
@@ -74,7 +74,7 @@ describe("bot/utils/finalize-assistant-response", () => {
7474
expect(responseStreamer.complete).toHaveBeenCalledWith("s1", "m1", {
7575
parts: ["reply"],
7676
format: "raw",
77-
sendOptions: undefined,
77+
sendOptions: { disable_notification: true },
7878
editOptions: undefined,
7979
});
8080
expect(flushPendingServiceMessages).toHaveBeenCalledTimes(1);

0 commit comments

Comments
 (0)