Remove unused old username functions

f37541d629a269546d7f868bcfbf8703c6ee8bed

Wolfsblvt <wolfsblvt@gmail.com>

1 files changed, +0 -85Ignore whitespace
public/scripts/personas.js+0 -85
@@ -673,31 +673,6 @@ export function autoSelectPersona(name) {
673673 }
674674}
675675
676-/**
677- * Updates the name of a persona if it exists.
678- * @param {string} avatarId User avatar id
679- * @param {string} newName New name for the persona
680- */
681-async function updatePersonaNameIfExists(avatarId, newName) {
682- if (avatarId in power_user.personas) {
683- power_user.personas[avatarId] = newName;
684- console.log(`Updated persona name for ${avatarId} to ${newName}`);
685- } else {
686- power_user.personas[avatarId] = newName;
687- power_user.persona_descriptions[avatarId] = {
688- description: '',
689- position: persona_description_positions.IN_PROMPT,
690- depth: DEFAULT_DEPTH,
691- role: DEFAULT_ROLE,
692- lorebook: '',
693- };
694- console.log(`Created persona name for ${avatarId} as ${newName}`);
695- }
696-
697- await getUserAvatars(true, avatarId);
698- saveSettingsDebounced();
699-}
700-
701676async function renamePersona(avatarId) {
702677 const currentName = power_user.personas[avatarId];
703678 const newName = await Popup.show.input(t`Rename Persona`, t`Enter a new name for this persona:`, currentName);
@@ -719,66 +694,6 @@ async function renamePersona(avatarId) {
719694 setPersonaDescription();
720695}
721696
722-async function bindUserNameToPersona() {
723- const avatarId = user_avatar;
724-
725- if (!avatarId) {
726- console.warn('No avatar id found');
727- return;
728- }
729-
730- let personaUnbind = false;
731- const existingPersona = power_user.personas[avatarId];
732- const personaName = await Popup.show.input(
733- t`Enter a name for this persona:`,
734- t`(If empty name is provided, this will unbind the name from this avatar)`,
735- existingPersona || '',
736- { onClose: (p) => { personaUnbind = p.value === '' && p.result === POPUP_RESULT.AFFIRMATIVE; } });
737-
738- // If the user clicked cancel, don't do anything
739- if (personaName === null && !personaUnbind) {
740- return;
741- }
742-
743- if (personaName && personaName.length > 0) {
744- // If the user clicked ok and entered a name, bind the name to the persona
745- console.log(`Binding persona ${avatarId} to name ${personaName}`);
746- power_user.personas[avatarId] = personaName;
747- const descriptor = power_user.persona_descriptions[avatarId];
748- const isCurrentPersona = avatarId === user_avatar;
749-
750- // Create a description object if it doesn't exist
751- if (!descriptor) {
752- // If the user is currently using this persona, set the description to the current description
753- power_user.persona_descriptions[avatarId] = {
754- description: isCurrentPersona ? power_user.persona_description : '',
755- position: isCurrentPersona ? power_user.persona_description_position : persona_description_positions.IN_PROMPT,
756- depth: isCurrentPersona ? power_user.persona_description_depth : DEFAULT_DEPTH,
757- role: isCurrentPersona ? power_user.persona_description_role : DEFAULT_ROLE,
758- lorebook: isCurrentPersona ? power_user.persona_description_lorebook : '',
759- };
760- }
761-
762- // If the user is currently using this persona, update the name
763- if (isCurrentPersona) {
764- console.log(`Auto-updating user name to ${personaName}`);
765- setUserName(personaName);
766- await updatePersonaNameIfExists(user_avatar, personaName);
767- }
768- } else {
769- // If the user clicked ok, but didn't enter a name, delete the persona
770- console.log(`Unbinding persona ${avatarId}`);
771- delete power_user.personas[avatarId];
772- delete power_user.persona_descriptions[avatarId];
773- }
774-
775- saveSettingsDebounced();
776- await getUserAvatars(true, avatarId);
777- setPersonaDescription();
778-
779- retriggerFirstMessageOnEmptyChat();
780-}
781-
782697function selectCurrentPersona({ toastPersonaNameChange = true } = {}) {
783698 const personaName = power_user.personas[user_avatar];
784699 if (personaName) {