Fix character deleted emission

This commit is contained in:
Cohee 2024-03-17 20:35:49 +02:00
parent 3b188c37dd
commit afec103eb2
2 changed files with 2 additions and 2 deletions

View File

@ -8493,8 +8493,8 @@ jQuery(async function () {
} }
if (popup_type == 'del_ch') { if (popup_type == 'del_ch') {
const deleteChats = !!$('#del_char_checkbox').prop('checked'); const deleteChats = !!$('#del_char_checkbox').prop('checked');
await handleDeleteCharacter(popup_type, this_chid, deleteChats);
eventSource.emit(event_types.CHARACTER_DELETED, { id: this_chid, character: characters[this_chid] }); eventSource.emit(event_types.CHARACTER_DELETED, { id: this_chid, character: characters[this_chid] });
await handleDeleteCharacter(popup_type, this_chid, deleteChats);
} }
if (popup_type == 'alternate_greeting' && menu_type !== 'create') { if (popup_type == 'alternate_greeting' && menu_type !== 'create') {
createOrEditCharacter(); createOrEditCharacter();

View File

@ -123,8 +123,8 @@ class CharacterContextMenu {
cache: 'no-cache', cache: 'no-cache',
}).then(response => { }).then(response => {
if (response.ok) { if (response.ok) {
eventSource.emit(event_types.CHARACTER_DELETED, { id: characterId, character: character });
return deleteCharacter(character.name, character.avatar, false).then(() => { return deleteCharacter(character.name, character.avatar, false).then(() => {
eventSource.emit(event_types.CHARACTER_DELETED, { id: characterId, character: characters[characterId] });
if (deleteChats) getPastCharacterChats(characterId).then(pastChats => { if (deleteChats) getPastCharacterChats(characterId).then(pastChats => {
for (const chat of pastChats) { for (const chat of pastChats) {
const name = chat.file_name.replace('.jsonl', ''); const name = chat.file_name.replace('.jsonl', '');