Wait for chat save before close or create new chat
| @@ -9909,6 +9909,7 @@ export async function doNewChat({ deleteCurrentChat = false } = {}) { | |||
| 9909 | } | 9909 | } |
| 9910 | 9910 | ||
| 9911 | //Fix it; New chat doesn't create while open create character menu | 9911 | //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; |
| 9914 | 9915 | ||
| @@ -11205,6 +11206,7 @@ jQuery(async function () { | |||
| 11205 | 11206 | ||
| 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 | } |
| 11225 | 11227 | ||