Handle null values for missing persona descriptor fields
This commit is contained in:
parent
63512c208f
commit
9cf53c6a55
|
@ -646,7 +646,12 @@ async function lockPersona() {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
power_user.personas[user_avatar] = name1;
|
power_user.personas[user_avatar] = name1;
|
||||||
power_user.persona_descriptions[user_avatar] = { description: '', position: persona_description_positions.IN_PROMPT };
|
power_user.persona_descriptions[user_avatar] = {
|
||||||
|
description: '',
|
||||||
|
position: persona_description_positions.IN_PROMPT,
|
||||||
|
depth: DEFAULT_DEPTH,
|
||||||
|
role: DEFAULT_ROLE,
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
chat_metadata['persona'] = user_avatar;
|
chat_metadata['persona'] = user_avatar;
|
||||||
|
@ -1012,7 +1017,7 @@ async function duplicatePersona(avatarId) {
|
||||||
const personaName = power_user.personas[avatarId];
|
const personaName = power_user.personas[avatarId];
|
||||||
|
|
||||||
if (!personaName) {
|
if (!personaName) {
|
||||||
toastr.warning('Current avatar is not a persona');
|
toastr.warning('Chosen avatar is not a persona');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1028,10 +1033,10 @@ async function duplicatePersona(avatarId) {
|
||||||
|
|
||||||
power_user.personas[newAvatarId] = personaName;
|
power_user.personas[newAvatarId] = personaName;
|
||||||
power_user.persona_descriptions[newAvatarId] = {
|
power_user.persona_descriptions[newAvatarId] = {
|
||||||
description: descriptor?.description || '',
|
description: descriptor?.description ?? '',
|
||||||
position: descriptor?.position || persona_description_positions.IN_PROMPT,
|
position: descriptor?.position ?? persona_description_positions.IN_PROMPT,
|
||||||
depth: descriptor?.depth || DEFAULT_DEPTH,
|
depth: descriptor?.depth ?? DEFAULT_DEPTH,
|
||||||
role: descriptor?.role || DEFAULT_ROLE,
|
role: descriptor?.role ?? DEFAULT_ROLE,
|
||||||
};
|
};
|
||||||
|
|
||||||
await uploadUserAvatar(getUserAvatar(avatarId), newAvatarId);
|
await uploadUserAvatar(getUserAvatar(avatarId), newAvatarId);
|
||||||
|
|
Loading…
Reference in New Issue