Merge branch 'staging' into parser-v2

This commit is contained in:
LenAnderson 2024-03-27 14:51:22 -04:00
commit d8200666ce
2 changed files with 14 additions and 7 deletions

View File

@ -8603,11 +8603,15 @@ jQuery(async function () {
await clearChat();
chat.length = 0;
chat_file_for_del = getCurrentChatDetails().sessionName;
const isDelChatCheckbox = document.getElementById('del_chat_checkbox').checked;
chat_file_for_del = getCurrentChatDetails()?.sessionName;
const isDelChatCheckbox = document.getElementById('del_chat_checkbox')?.checked;
// Make it easier to find in backups
if (isDelChatCheckbox) {
await saveChatConditional();
}
if (selected_group) {
//Fix it; When you're creating a new group chat (but not when initially converting from the existing regular chat), the first greeting message doesn't automatically get translated.
await createNewGroupChat(selected_group);
if (isDelChatCheckbox) await deleteGroupChat(selected_group, chat_file_for_del);
}
@ -8670,14 +8674,13 @@ jQuery(async function () {
$('#form_create').submit(createOrEditCharacter);
$('#delete_button').on('click', function () {
popup_type = 'del_ch';
callPopup(`
<h3>Delete the character?</h3>
<b>THIS IS PERMANENT!<br><br>
<label for="del_char_checkbox" class="checkbox_label justifyCenter">
<input type="checkbox" id="del_char_checkbox" />
<span>Also delete the chat files</span>
</label><br></b>`,
<small>Also delete the chat files</small>
</label><br></b>`, 'del_ch', '',
);
});
@ -8985,7 +8988,7 @@ jQuery(async function () {
<label for="del_chat_checkbox" class="checkbox_label justifyCenter"
title="If necessary, you can later restore this chat file from the /backups folder">
<input type="checkbox" id="del_chat_checkbox" />
<span>Also delete the current chat file</span>
<small>Also delete the current chat file</small>
</label><br>
`, 'new_chat', '');
}

View File

@ -189,6 +189,8 @@ export async function getGroupChat(groupId) {
await printMessages();
} else {
sendSystemMessage(system_message_types.GROUP, '', { isSmallSys: true });
await eventSource.emit(event_types.MESSAGE_RECEIVED, (chat.length - 1));
await eventSource.emit(event_types.CHARACTER_MESSAGE_RENDERED, (chat.length - 1));
if (group && Array.isArray(group.members)) {
for (let member of group.members) {
const character = characters.find(x => x.avatar === member || x.name === member);
@ -199,7 +201,9 @@ export async function getGroupChat(groupId) {
const mes = await getFirstCharacterMessage(character);
chat.push(mes);
await eventSource.emit(event_types.MESSAGE_RECEIVED, (chat.length - 1));
addOneMessage(mes);
await eventSource.emit(event_types.CHARACTER_MESSAGE_RENDERED, (chat.length - 1));
}
}
await saveGroupChat(groupId, false);