Wait for chat save before close or create new chat

b571723f94c7c1e1bdcb823ab53c1a0d4bec0284

Cohee <18619528+Cohee1207@users.noreply.github.com>

1 files changed, +3 -1Ignore whitespace
public/script.js+3 -1
@@ -9909,6 +9909,7 @@ export async function doNewChat({ deleteCurrentChat = false } = {}) {
99099909 }
99109910
99119911 //Fix it; New chat doesn't create while open create character menu
9912+ await waitUntilCondition(() => !isChatSaving, debounce_timeout.extended, 10);
99129913 await clearChat();
99139914 chat.length = 0;
99149915
@@ -11205,6 +11206,7 @@ jQuery(async function () {
1120511206
1120611207 else if (id == 'option_close_chat') {
1120711208 if (is_send_press == false) {
11209+ await waitUntilCondition(() => !isChatSaving, debounce_timeout.extended, 10);
1120811210 await clearChat();
1120911211 chat.length = 0;
1121011212 resetSelectedGroup();
@@ -11219,7 +11221,7 @@ jQuery(async function () {
1121911221 select_rm_characters();
1122011222 await eventSource.emit(event_types.CHAT_CHANGED, getCurrentChatId());
1122111223 } else {
1122211224 toastr.info('t`Please stop the message generation first.'`);
1122311225 }
1122411226 }
1122511227