Add PERSONA_CHANGED event (#5218) * Initial plan * Add PERSONA_CHANGED event emission when active user avatar changes Co-authored-by: Cohee1207 <18619528+Cohee1207@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: Cohee1207 <18619528+Cohee1207@users.noreply.github.com>

ccf8ce7a06b507124b96d53d4c5e7250a3db0ebd

Copilot <198982749+Copilot@users.noreply.github.com>

Signed
2 files changed, +2 -0Ignore whitespace
public/scripts/events.js+1 -0
@@ -96,6 +96,7 @@ export const event_types = {
96 WORLDINFO_ENTRIES_LOADED: 'worldinfo_entries_loaded',96 WORLDINFO_ENTRIES_LOADED: 'worldinfo_entries_loaded',
97 WORLDINFO_SCAN_DONE: 'worldinfo_scan_done',97 WORLDINFO_SCAN_DONE: 'worldinfo_scan_done',
98 MEDIA_ATTACHMENT_DELETED: 'media_attachment_deleted',98 MEDIA_ATTACHMENT_DELETED: 'media_attachment_deleted',
99 PERSONA_CHANGED: 'persona_changed',
99};100};
100101
101export const eventSource = new EventEmitter([event_types.APP_READY, event_types.APP_INITIALIZED]);102export const eventSource = new EventEmitter([event_types.APP_READY, event_types.APP_INITIALIZED]);
public/scripts/personas.js+1 -0
@@ -124,6 +124,7 @@ export async function setUserAvatar(imgfile, { toastPersonaNameChange = true, na
124 await retriggerFirstMessageOnEmptyChat();124 await retriggerFirstMessageOnEmptyChat();
125 saveSettingsDebounced();125 saveSettingsDebounced();
126 $('.zoomed_avatar[forchar]').remove();126 $('.zoomed_avatar[forchar]').remove();
127 await eventSource.emit(event_types.PERSONA_CHANGED, user_avatar);
127}128}
128129
129function reloadUserAvatar(force = false) {130function reloadUserAvatar(force = false) {