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>
Signed| @@ -96,6 +96,7 @@ export const event_types = { | ||
| 96 | 96 | WORLDINFO_ENTRIES_LOADED: 'worldinfo_entries_loaded', |
| 97 | 97 | WORLDINFO_SCAN_DONE: 'worldinfo_scan_done', |
| 98 | 98 | MEDIA_ATTACHMENT_DELETED: 'media_attachment_deleted', |
| 99 | + PERSONA_CHANGED: 'persona_changed', | |
| 99 | 100 | }; |
| 100 | 101 | |
| 101 | 102 | export const eventSource = new EventEmitter([event_types.APP_READY, event_types.APP_INITIALIZED]); |
| @@ -124,6 +124,7 @@ export async function setUserAvatar(imgfile, { toastPersonaNameChange = true, na | ||
| 124 | 124 | await retriggerFirstMessageOnEmptyChat(); |
| 125 | 125 | saveSettingsDebounced(); |
| 126 | 126 | $('.zoomed_avatar[forchar]').remove(); |
| 127 | + await eventSource.emit(event_types.PERSONA_CHANGED, user_avatar); | |
| 127 | 128 | } |
| 128 | 129 | |
| 129 | 130 | function reloadUserAvatar(force = false) { |