Emit PERSONA_CREATED event on persona duplication (#5448)
* feat: emit PERSONA_CREATED event when duplicating a persona Adds PERSONA_CREATED event emission in duplicatePersona() to notify listeners when a persona is duplicated. Includes the new avatarId, name, and duplicatedFromAvatarId in the event payload. * fix: event data and execution order --------- Co-authored-by: Cohee <18619528+Cohee1207@users.noreply.github.com>
This commit is contained in:
@@ -1827,6 +1827,16 @@ async function duplicatePersona(avatarId) {
|
||||
};
|
||||
|
||||
await uploadUserAvatar(getUserAvatar(avatarId), newAvatarId);
|
||||
|
||||
const eventData = {
|
||||
avatarId: newAvatarId,
|
||||
name: personaName,
|
||||
description: descriptor?.description ?? '',
|
||||
title: descriptor?.title ?? '',
|
||||
duplicatedFromAvatarId: avatarId,
|
||||
};
|
||||
await eventSource.emit(event_types.PERSONA_CREATED, eventData);
|
||||
|
||||
await getUserAvatars(true, newAvatarId);
|
||||
saveSettingsDebounced();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user