back to parent chat speed up by not checking for file and if there is an error or no file then send a warning.
Signed| @@ -7417,7 +7417,16 @@ export async function openCharacterChat(file_name) { | ||
| 7417 | 7417 | characters[this_chid]['chat'] = file_name; |
| 7418 | 7418 | chat.length = 0; |
| 7419 | 7419 | chat_metadata = {}; |
| 7420 | + try { | |
| 7420 | 7421 | await getChat(); |
| 7422 | + if (chat.length === 0) { | |
| 7423 | + toastr.warning('Chat file not found: ' + file_name); | |
| 7424 | + return; | |
| 7425 | + } | |
| 7426 | + } catch (e) { | |
| 7427 | + toastr.warning('Chat file not found: ' + file_name); | |
| 7428 | + return; | |
| 7429 | + } | |
| 7421 | 7430 | $('#selected_chat_pole').val(file_name); |
| 7422 | 7431 | await createOrEditCharacter(new CustomEvent('newChat')); |
| 7423 | 7432 | } |
| @@ -238,17 +238,11 @@ export function updateBookmarkDisplay(mes, newBookmarkLink = null) { | ||
| 238 | 238 | |
| 239 | 239 | async function backToMainChat() { |
| 240 | 240 | const mainChatName = getMainChatName(); |
| 241 | - const allChats = await getExistingChatNames(); | |
| 242 | - | |
| 243 | - if (allChats.includes(mainChatName)) { | |
| 244 | 241 | if (selected_group) { |
| 245 | 242 | await openGroupChat(selected_group, mainChatName); |
| 246 | 243 | } else { |
| 247 | 244 | await openCharacterChat(mainChatName); |
| 248 | 245 | } |
| 249 | - return mainChatName; | |
| 250 | - } | |
| 251 | - | |
| 252 | 246 | return null; |
| 253 | 247 | } |
| 254 | 248 | |
| @@ -266,6 +266,10 @@ export async function getGroupChat(groupId, reload = false) { | ||
| 266 | 266 | await eventSource.emit(event_types.CHARACTER_MESSAGE_RENDERED, (chat.length - 1), 'first_message'); |
| 267 | 267 | } |
| 268 | 268 | await saveGroupChat(groupId, false); |
| 269 | + await printMessages(); | |
| 270 | + } else { | |
| 271 | + toastr.warning('Group chat file not found: ' + chat_id); | |
| 272 | + return; | |
| 269 | 273 | } |
| 270 | 274 | } |
| 271 | 275 | |