From 70450d786765a4746eb1d5c3fbf262c95f3e0c87 Mon Sep 17 00:00:00 2001 From: Cohee <18619528+Cohee1207@users.noreply.github.com> Date: Mon, 9 Sep 2024 20:39:30 +0300 Subject: [PATCH 1/2] Emit message events on stream abortion --- public/script.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/public/script.js b/public/script.js index 5800d24d1..2dbd82d00 100644 --- a/public/script.js +++ b/public/script.js @@ -3102,6 +3102,11 @@ class StreamingProcessor { this.hideMessageButtons(this.messageId); generatedPromptCache = ''; unblockGeneration(); + + if (this.type !== 'swipe' && this.type !== 'impersonate') { + eventSource.emit(event_types.MESSAGE_RECEIVED, this.messageId); + eventSource.emit(event_types.CHARACTER_MESSAGE_RENDERED, this.messageId); + } } setFirstSwipe(messageId) { From 075391e72027146195c3bfa0707ec7ece803254c Mon Sep 17 00:00:00 2001 From: Cohee <18619528+Cohee1207@users.noreply.github.com> Date: Mon, 9 Sep 2024 20:46:29 +0300 Subject: [PATCH 2/2] Add continue type to not-emit list --- public/script.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/public/script.js b/public/script.js index 2dbd82d00..060a10ec7 100644 --- a/public/script.js +++ b/public/script.js @@ -3103,7 +3103,8 @@ class StreamingProcessor { generatedPromptCache = ''; unblockGeneration(); - if (this.type !== 'swipe' && this.type !== 'impersonate') { + const noEmitTypes = ['swipe', 'impersonate', 'continue']; + if (!noEmitTypes.includes(this.type)) { eventSource.emit(event_types.MESSAGE_RECEIVED, this.messageId); eventSource.emit(event_types.CHARACTER_MESSAGE_RENDERED, this.messageId); }