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 } = {}) {
9909 }9909 }
99109910
9911 //Fix it; New chat doesn't create while open create character menu9911 //Fix it; New chat doesn't create while open create character menu
9912 await waitUntilCondition(() => !isChatSaving, debounce_timeout.extended, 10);
9912 await clearChat();9913 await clearChat();
9913 chat.length = 0;9914 chat.length = 0;
99149915
@@ -11205,6 +11206,7 @@ jQuery(async function () {
1120511206
11206 else if (id == 'option_close_chat') {11207 else if (id == 'option_close_chat') {
11207 if (is_send_press == false) {11208 if (is_send_press == false) {
11209 await waitUntilCondition(() => !isChatSaving, debounce_timeout.extended, 10);
11208 await clearChat();11210 await clearChat();
11209 chat.length = 0;11211 chat.length = 0;
11210 resetSelectedGroup();11212 resetSelectedGroup();
@@ -11219,7 +11221,7 @@ jQuery(async function () {
11219 select_rm_characters();11221 select_rm_characters();
11220 await eventSource.emit(event_types.CHAT_CHANGED, getCurrentChatId());11222 await eventSource.emit(event_types.CHAT_CHANGED, getCurrentChatId());
11221 } else {11223 } else {
11222 toastr.info('Please stop the message generation first.');11224 toastr.info(t`Please stop the message generation first.`);
11223 }11225 }
11224 }11226 }
1122511227