Handle null values for missing persona descriptor fields
| @@ -646,7 +646,12 @@ async function lockPersona() { | ||
| 646 | 646 | ); |
| 647 | 647 | } |
| 648 | 648 | power_user.personas[user_avatar] = name1; |
| 649 | 649 | power_user.persona_descriptions[user_avatar] = { description: '', position: persona_description_positions.IN_PROMPT }; |
| 650 | + description: '', | |
| 651 | + position: persona_description_positions.IN_PROMPT, | |
| 652 | + depth: DEFAULT_DEPTH, | |
| 653 | + role: DEFAULT_ROLE, | |
| 654 | + }; | |
| 650 | 655 | } |
| 651 | 656 | |
| 652 | 657 | chat_metadata['persona'] = user_avatar; |
| @@ -1012,7 +1017,7 @@ async function duplicatePersona(avatarId) { | ||
| 1012 | 1017 | const personaName = power_user.personas[avatarId]; |
| 1013 | 1018 | |
| 1014 | 1019 | if (!personaName) { |
| 1015 | 1020 | toastr.warning('CurrentChosen avatar is not a persona'); |
| 1016 | 1021 | return; |
| 1017 | 1022 | } |
| 1018 | 1023 | |
| @@ -1028,10 +1033,10 @@ async function duplicatePersona(avatarId) { | ||
| 1028 | 1033 | |
| 1029 | 1034 | power_user.personas[newAvatarId] = personaName; |
| 1030 | 1035 | power_user.persona_descriptions[newAvatarId] = { |
| 1031 | 1036 | description: descriptor?.description ||?? '', |
| 1032 | 1037 | position: descriptor?.position ||?? persona_description_positions.IN_PROMPT, |
| 1033 | 1038 | depth: descriptor?.depth ||?? DEFAULT_DEPTH, |
| 1034 | 1039 | role: descriptor?.role ||?? DEFAULT_ROLE, |
| 1035 | 1040 | }; |
| 1036 | 1041 | |
| 1037 | 1042 | await uploadUserAvatar(getUserAvatar(avatarId), newAvatarId); |