Require a name for dummy personas
This commit is contained in:
parent
8a8880fca1
commit
f1d0e39d39
|
@ -3088,7 +3088,7 @@
|
|||
</div>
|
||||
<div id="create_dummy_persona" class="menu_button menu_button_icon" title="Create a dummy persona" data-i18n="[title]Create a dummy persona">
|
||||
<i class="fa-solid fa-person-circle-question fa-fw"></i>
|
||||
<span data-i18n="Blank">Blank</span>
|
||||
<span data-i18n="Create">Create</span>
|
||||
</div>
|
||||
</h4>
|
||||
<div id="user_avatar_block">
|
||||
|
|
|
@ -39,7 +39,23 @@ async function uploadUserAvatar(url, name) {
|
|||
}
|
||||
|
||||
async function createDummyPersona() {
|
||||
await uploadUserAvatar(default_avatar);
|
||||
const personaName = await callPopup('<h3>Enter a name for this persona:</h3>', 'input', '');
|
||||
|
||||
if (!personaName) {
|
||||
console.debug('User cancelled creating dummy persona');
|
||||
return;
|
||||
}
|
||||
|
||||
// Date + name (only ASCII) to make it unique
|
||||
const avatarId = `${Date.now()}-${personaName.replace(/[^a-zA-Z0-9]/g, '')}.png`;
|
||||
power_user.personas[avatarId] = personaName;
|
||||
power_user.persona_descriptions[avatarId] = {
|
||||
description: '',
|
||||
position: persona_description_positions.IN_PROMPT,
|
||||
};
|
||||
|
||||
await uploadUserAvatar(default_avatar, avatarId);
|
||||
saveSettingsDebounced();
|
||||
}
|
||||
|
||||
export async function convertCharacterToPersona(characterId = null) {
|
||||
|
|
Loading…
Reference in New Issue