Fix temporary persona toast - Temporary persona toast was appearing when auto-lock was enabled, which didn't make sense
| @@ -684,18 +684,6 @@ async function bindUserNameToPersona(e) { | ||
| 684 | 684 | function selectCurrentPersona() { |
| 685 | 685 | const personaName = power_user.personas[user_avatar]; |
| 686 | 686 | if (personaName) { |
| 687 | - const hasDifferentChatLock = chat_metadata['persona'] && chat_metadata['persona'] !== user_avatar; | |
| 688 | - const hasDifferentDefaultLock = power_user.default_persona && power_user.default_persona !== user_avatar; | |
| 689 | - | |
| 690 | - if (hasDifferentChatLock || (!chat_metadata['persona'] && hasDifferentDefaultLock)) { | |
| 691 | - 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.` | |
| 692 | - + '<br /><br />' | |
| 693 | - + t`Current Persona: ${power_user.personas[user_avatar]}` | |
| 694 | - + (hasDifferentChatLock ? '<br />' + t`Chat persona: ${power_user.personas[chat_metadata['persona']]}` : '') | |
| 695 | - + (hasDifferentDefaultLock ? '<br />' + t`Default persona: ${power_user.personas[power_user.default_persona]}` : ''); | |
| 696 | - toastr.info(message, t`Temporary Persona`, { escapeHtml: false, timeOut: 10000, extendedTimeOut: 20000, preventDuplicates: true }); | |
| 697 | - } | |
| 698 | - | |
| 699 | 687 | if (personaName !== name1) { |
| 700 | 688 | console.log(`Auto-updating user name to ${personaName}`); |
| 701 | 689 | setUserName(personaName); |
| @@ -736,6 +724,19 @@ function selectCurrentPersona() { | ||
| 736 | 724 | } |
| 737 | 725 | saveMetadataDebounced(); |
| 738 | 726 | } |
| 727 | + | |
| 728 | + // As the last step, inform user if the persona is only temporarily chosen | |
| 729 | + const hasDifferentChatLock = !!chat_metadata['persona'] && chat_metadata['persona'] !== user_avatar; | |
| 730 | + const hasDifferentDefaultLock = power_user.default_persona && power_user.default_persona !== user_avatar; | |
| 731 | + | |
| 732 | + if (hasDifferentChatLock || (!chat_metadata['persona'] && hasDifferentDefaultLock)) { | |
| 733 | + 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.` | |
| 734 | + + '<br /><br />' | |
| 735 | + + t`Current Persona: ${power_user.personas[user_avatar]}` | |
| 736 | + + (hasDifferentChatLock ? '<br />' + t`Chat persona: ${power_user.personas[chat_metadata['persona']]}` : '') | |
| 737 | + + (hasDifferentDefaultLock ? '<br />' + t`Default persona: ${power_user.personas[power_user.default_persona]}` : ''); | |
| 738 | + toastr.info(message, t`Temporary Persona`, { escapeHtml: false, timeOut: 10000, extendedTimeOut: 20000, preventDuplicates: true }); | |
| 739 | + } | |
| 739 | 740 | } |
| 740 | 741 | } |
| 741 | 742 | |