back to parent chat speed up by not checking for file and if there is an error or no file then send a warning.

fa38543b1a0b64350d52a985d76fe021a551d4a6

I <16441743+imesha10@users.noreply.github.com>

Signed
3 files changed, +18 -11Ignore whitespace
public/script.js+10 -1
@@ -7417,7 +7417,16 @@ export async function openCharacterChat(file_name) {
74177417 characters[this_chid]['chat'] = file_name;
74187418 chat.length = 0;
74197419 chat_metadata = {};
7420- await getChat();
7420+ try {
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+ }
74217430 $('#selected_chat_pole').val(file_name);
74227431 await createOrEditCharacter(new CustomEvent('newChat'));
74237432}
public/scripts/bookmarks.js+4 -10
@@ -238,17 +238,11 @@ export function updateBookmarkDisplay(mes, newBookmarkLink = null) {
238238
239239async function backToMainChat() {
240240 const mainChatName = getMainChatName();
241- const allChats = await getExistingChatNames();
241+ if (selected_group) {
242-
242+ await openGroupChat(selected_group, mainChatName);
243- if (allChats.includes(mainChatName)) {
243+ } else {
244244 ifawait openCharacterChat(selected_groupmainChatName) {;
245- await openGroupChat(selected_group, mainChatName);
246- } else {
247- await openCharacterChat(mainChatName);
248- }
249- return mainChatName;
250245 }
251-
252246 return null;
253247}
254248
public/scripts/group-chats.js+4 -0
@@ -266,6 +266,10 @@ export async function getGroupChat(groupId, reload = false) {
266266 await eventSource.emit(event_types.CHARACTER_MESSAGE_RENDERED, (chat.length - 1), 'first_message');
267267 }
268268 await saveGroupChat(groupId, false);
269+ await printMessages();
270+ } else {
271+ toastr.warning('Group chat file not found: ' + chat_id);
272+ return;
269273 }
270274 }
271275