From b571723f94c7c1e1bdcb823ab53c1a0d4bec0284 Mon Sep 17 00:00:00 2001 From: Cohee <18619528+Cohee1207@users.noreply.github.com> Date: Sat, 17 May 2025 09:17:32 +0300 Subject: [PATCH] Wait for chat save before close or create new chat --- public/script.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/public/script.js b/public/script.js index 360e5ae92..3f97bcb5f 100644 --- a/public/script.js +++ b/public/script.js @@ -9909,6 +9909,7 @@ export async function doNewChat({ deleteCurrentChat = false } = {}) { } //Fix it; New chat doesn't create while open create character menu + await waitUntilCondition(() => !isChatSaving, debounce_timeout.extended, 10); await clearChat(); chat.length = 0; @@ -11205,6 +11206,7 @@ jQuery(async function () { else if (id == 'option_close_chat') { if (is_send_press == false) { + await waitUntilCondition(() => !isChatSaving, debounce_timeout.extended, 10); await clearChat(); chat.length = 0; resetSelectedGroup(); @@ -11219,7 +11221,7 @@ jQuery(async function () { select_rm_characters(); await eventSource.emit(event_types.CHAT_CHANGED, getCurrentChatId()); } else { - toastr.info('Please stop the message generation first.'); + toastr.info(t`Please stop the message generation first.`); } }