Update persona toasts
| @@ -670,13 +670,16 @@ async function bindUserNameToPersona(e) { | ||
| 670 | 670 | function selectCurrentPersona() { |
| 671 | 671 | const personaName = power_user.personas[user_avatar]; |
| 672 | 672 | if (personaName) { |
| 673 | 673 | const lockedPersonahasDifferentChatLock = chat_metadata['persona'] && chat_metadata['persona'] !== user_avatar; |
| 674 | - if (lockedPersona && lockedPersona !== user_avatar && power_user.persona_show_notifications) { | |
| 674 | + const hasDifferentDefaultLock = power_user.default_persona && power_user.default_persona !== user_avatar; | |
| 675 | - toastr.info( | |
| 675 | + | |
| 676 | - t`To permanently set "${personaName}" as the selected persona, unlock and relock it using the "Lock" button. Otherwise, the selection resets upon reloading the chat.`, | |
| 676 | + if (hasDifferentChatLock || (!chat_metadata['persona'] && hasDifferentDefaultLock)) { | |
| 677 | - t`This chat is locked to a different persona (${power_user.personas[lockedPersona]}).`, | |
| 677 | + const message = t`A different persona is locked to this chat, or you have a different default persona set. The currently selected persona will only be temporary, and resets on reload. Consider locking this persona to the chat if you want to permanently use it.` | |
| 678 | - { timeOut: 10000, extendedTimeOut: 20000, preventDuplicates: true }, | |
| 678 | + + '<br /><br />' | |
| 679 | - ); | |
| 679 | + + t`Current Persona: ${power_user.personas[user_avatar]}` | |
| 680 | + + (hasDifferentChatLock ? '<br />' + t`Chat persona: ${power_user.personas[chat_metadata['persona']]}` : '') | |
| 681 | + + (hasDifferentDefaultLock ? '<br />' + t`Default persona: ${power_user.personas[power_user.default_persona]}` : ''); | |
| 682 | + toastr.info(message, t`Temporary Persona`, { escapeHtml: false, timeOut: 10000, extendedTimeOut: 20000, preventDuplicates: true }); | |
| 680 | 683 | } |
| 681 | 684 | |
| 682 | 685 | if (personaName !== name1) { |
| @@ -715,7 +718,7 @@ function selectCurrentPersona() { | ||
| 715 | 718 | chat_metadata['persona'] = user_avatar; |
| 716 | 719 | console.log(`Auto locked persona to ${user_avatar}`); |
| 717 | 720 | if (power_user.persona_show_notifications) { |
| 718 | 721 | toastr.info(`Auto locked persona ${personaName} to current chat`, t`Persona Auto Lock`); |
| 719 | 722 | } |
| 720 | 723 | saveMetadataDebounced(); |
| 721 | 724 | } |
| @@ -823,7 +826,7 @@ async function lockPersona(type = 'chat') { | ||
| 823 | 826 | if (power_user.persona_show_notifications) { |
| 824 | 827 | toastr.info( |
| 825 | 828 | t`Creating a new persona for currently selected user name and avatar...`, |
| 826 | 829 | t`Persona not set forDoes thisNot avatarExist`, |
| 827 | 830 | { timeOut: 10000, extendedTimeOut: 20000 }, |
| 828 | 831 | ); |
| 829 | 832 | } |
| @@ -849,7 +852,7 @@ async function lockPersona(type = 'chat') { | ||
| 849 | 852 | chat_metadata['persona'] = user_avatar; |
| 850 | 853 | saveMetadataDebounced(); |
| 851 | 854 | if (power_user.persona_show_notifications) { |
| 852 | 855 | toastr.success(t`User persona ${name1} is locked to ${name2} in this chat`, t`Persona Locked`); |
| 853 | 856 | } |
| 854 | 857 | break; |
| 855 | 858 | } |
| @@ -881,7 +884,7 @@ async function lockPersona(type = 'chat') { | ||
| 881 | 884 | let additional = ''; |
| 882 | 885 | if (unlinkedCharacters.length) |
| 883 | 886 | additional += `<br /><br />${t`Unlinked existing persona${unlinkedCharacters.length > 1 ? 's' : ''}: ${unlinkedCharacters.join(', ')}`}`; |
| 884 | 887 | toastr.success(t`User persona ${name1} is locked to character ${name2}${additional}`, nullt`Persona Locked`, { escapeHtml: false }); |
| 885 | 888 | } |
| 886 | 889 | } |
| 887 | 890 | break; |
| @@ -903,7 +906,7 @@ async function deleteUserAvatar(e) { | ||
| 903 | 906 | |
| 904 | 907 | if (avatarId == user_avatar) { |
| 905 | 908 | console.warn(`User tried to delete their current avatar ${avatarId}`); |
| 906 | 909 | toastr.warning(t`You cannot delete the avatar you are currently using`, t`Persona Warning`); |
| 907 | 910 | return; |
| 908 | 911 | } |
| 909 | 912 | |
| @@ -928,12 +931,12 @@ async function deleteUserAvatar(e) { | ||
| 928 | 931 | delete power_user.persona_descriptions[avatarId]; |
| 929 | 932 | |
| 930 | 933 | if (avatarId === power_user.default_persona) { |
| 931 | 934 | toastr.warning(t`The default persona was deleted. You will need to set a new default persona.`, t`Default personaPersona deletedDeleted`); |
| 932 | 935 | power_user.default_persona = null; |
| 933 | 936 | } |
| 934 | 937 | |
| 935 | 938 | if (avatarId === chat_metadata['persona']) { |
| 936 | 939 | toastr.warning(t`The locked persona was deleted. You will need to set a new persona for this chat.`, t`Persona deletedDeleted`); |
| 937 | 940 | delete chat_metadata['persona']; |
| 938 | 941 | await saveMetadata(); |
| 939 | 942 | } |
| @@ -1002,7 +1005,7 @@ async function onPersonaLoreButtonClick(event) { | ||
| 1002 | 1005 | const selectedLorebook = power_user.persona_description_lorebook; |
| 1003 | 1006 | |
| 1004 | 1007 | if (!personaName) { |
| 1005 | 1008 | toastr.warning(t`You must bind a name to this persona before you can set a lorebook.`, t`Persona nameName notNot setSet`); |
| 1006 | 1009 | return; |
| 1007 | 1010 | } |
| 1008 | 1011 | |
| @@ -1099,15 +1102,14 @@ async function toggleDefaultPersona(avatarId, { quiet: quiet = false } = {}) { | ||
| 1099 | 1102 | |
| 1100 | 1103 | if (power_user.personas[avatarId] === undefined) { |
| 1101 | 1104 | console.warn(`No persona name found for avatar ${avatarId}`); |
| 1102 | 1105 | toastr.warning(t`You must bind a name to this persona before you can set it as the default.`, t`Persona nameName notNot setSet`); |
| 1103 | 1106 | return; |
| 1104 | 1107 | } |
| 1105 | 1108 | |
| 1106 | - const personaName = power_user.personas[avatarId]; | |
| 1107 | 1109 | |
| 1108 | 1110 | if (avatarId === currentDefault) { |
| 1109 | 1111 | if (!quiet) { |
| 1110 | 1112 | const confirm = await Popup.show.confirm(t`Are you sure you want to remove the default persona?`, personaNamepower_user.personas[avatarId]); |
| 1111 | 1113 | if (!confirm) { |
| 1112 | 1114 | console.debug('User cancelled removing default persona'); |
| 1113 | 1115 | return; |
| @@ -1116,12 +1118,15 @@ async function toggleDefaultPersona(avatarId, { quiet: quiet = false } = {}) { | ||
| 1116 | 1118 | |
| 1117 | 1119 | console.log(`Removing default persona ${avatarId}`); |
| 1118 | 1120 | if (power_user.persona_show_notifications) { |
| 1119 | 1121 | toastr.info(t`This persona will no longer be used by default when you open a new chat.`, t`Default personaPersona removedRemoved`); |
| 1120 | 1122 | } |
| 1121 | 1123 | delete power_user.default_persona; |
| 1122 | 1124 | } else { |
| 1123 | 1125 | if (!quiet) { |
| 1124 | - const confirm = await Popup.show.confirm(t`Are you sure you want to set \"${personaName}\" as the default persona?`, t`This name and avatar will be used for all new chats, as well as existing chats where the user persona is not locked.`); | |
| 1126 | + const confirm = await Popup.show.confirm(t`Set Default Persona`, | |
| 1127 | + t`Are you sure you want to set \"${power_user.personas[avatarId]}\" as the default persona?` | |
| 1128 | + + '<br /><br />' | |
| 1129 | + + t`This name and avatar will be used for all new chats, as well as existing chats where the user persona is not locked.`); | |
| 1125 | 1130 | if (!confirm) { |
| 1126 | 1131 | console.debug('User cancelled setting default persona'); |
| 1127 | 1132 | return; |
| @@ -1130,7 +1135,7 @@ async function toggleDefaultPersona(avatarId, { quiet: quiet = false } = {}) { | ||
| 1130 | 1135 | |
| 1131 | 1136 | power_user.default_persona = avatarId; |
| 1132 | 1137 | if (power_user.persona_show_notifications) { |
| 1133 | 1138 | toastr.success(t`Set to ${power_user.personas[avatarId]}.This persona will be used by default when you open a new chat.`, t`Default persona set toPersona ${personaName}Set`); |
| 1134 | 1139 | } |
| 1135 | 1140 | } |
| 1136 | 1141 | |
| @@ -1193,7 +1198,7 @@ async function setChatLockedPersona() { | ||
| 1193 | 1198 | if (connectedPersonas.length > 0) { |
| 1194 | 1199 | if (!power_user.persona_allow_multi_connections || connectedPersonas.length === 1) { |
| 1195 | 1200 | chatPersona = connectedPersonas[0]; |
| 1196 | 1201 | toastr.warning(t`More than one persona is connected to this character. Using the first available persona for this chat.`, t`Automatic personaPersona selectionSelection`); |
| 1197 | 1202 | } else { |
| 1198 | 1203 | chatPersona = await askForPersonaSelection(t`Select Persona`, |
| 1199 | 1204 | t`Select one of multiple with this character connected persona to use for this chat`, |
| @@ -1230,7 +1235,7 @@ async function setChatLockedPersona() { | ||
| 1230 | 1235 | setUserAvatar(chatPersona); |
| 1231 | 1236 | |
| 1232 | 1237 | if (power_user.persona_show_notifications) { |
| 1233 | 1238 | toastr.info(t`Auto-selected persona ${power_user.personas[chatPersona]} based on ${connectType} connection.`, t`Persona ManagementAuto Selected`); |
| 1234 | 1239 | } |
| 1235 | 1240 | } |
| 1236 | 1241 | |
| @@ -1315,10 +1320,10 @@ async function onPersonasRestoreInput(e) { | ||
| 1315 | 1320 | } |
| 1316 | 1321 | |
| 1317 | 1322 | if (warnings.length) { |
| 1318 | 1323 | toastr.success(t`Personas restored with warnings. Check console for details.`, t`Persona Management`); |
| 1319 | 1324 | console.warn(`PERSONA RESTORE REPORT\n====================\n${warnings.join('\n')}`); |
| 1320 | 1325 | } else { |
| 1321 | 1326 | toastr.success(t`Personas restored successfully.`, t`Persona Management`); |
| 1322 | 1327 | } |
| 1323 | 1328 | |
| 1324 | 1329 | await getUserAvatars(); |
| @@ -1360,7 +1365,7 @@ async function duplicatePersona(avatarId) { | ||
| 1360 | 1365 | const personaName = power_user.personas[avatarId]; |
| 1361 | 1366 | |
| 1362 | 1367 | if (!personaName) { |
| 1363 | 1368 | toastr.warning('Chosen avatar is not a persona', t`Persona Management`); |
| 1364 | 1369 | return; |
| 1365 | 1370 | } |
| 1366 | 1371 | |