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, +13 -6Showing whitespace changes
public/script.js+9 -0
@@ -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+ try {
74207421 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+0 -6
@@ -238,17 +238,11 @@ export function updateBookmarkDisplay(mes, newBookmarkLink = null) {
238238
239239async function backToMainChat() {
240240 const mainChatName = getMainChatName();
241- const allChats = await getExistingChatNames();
242-
243- if (allChats.includes(mainChatName)) {
244241 if (selected_group) {
245242 await openGroupChat(selected_group, mainChatName);
246243 } else {
247244 await openCharacterChat(mainChatName);
248245 }
249- return mainChatName;
250- }
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