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