Deprecate "After Char" position for persona description

This commit is contained in:
Cohee
2023-08-29 00:09:41 +03:00
parent f1b91620b6
commit 9ce8aa661f
3 changed files with 15 additions and 9 deletions

View File

@ -3065,8 +3065,7 @@
</div> </div>
<label for="persona_description_position" data-i18n="Position:">Position:</label> <label for="persona_description_position" data-i18n="Position:">Position:</label>
<select id="persona_description_position"> <select id="persona_description_position">
<option value="0" data-i18n="In Story String / Chat Completion: Before Character Card">In Story String / Chat Completion: Before Character Card</option> <option value="0" data-i18n="In Story String / Prompt Manager">In Story String / Prompt Manager</option>
<option value="1" data-i18n="In Story String / Chat Completion: After Character Card">In Story String / Chat Completion: After Character Card</option>
<option value="2" data-i18n="Top of Author's Note">Top of Author's Note</option> <option value="2" data-i18n="Top of Author's Note">Top of Author's Note</option>
<option value="3" data-i18n="Bottom of Author's Note">Bottom of Author's Note</option> <option value="3" data-i18n="Bottom of Author's Note">Bottom of Author's Note</option>
</select> </select>

View File

@ -4603,6 +4603,10 @@ async function getUserAvatars() {
} }
function setPersonaDescription() { function setPersonaDescription() {
if (power_user.persona_description_position === persona_description_positions.AFTER_CHAR) {
power_user.persona_description_position = persona_description_positions.IN_PROMPT;
}
$("#persona_description").val(power_user.persona_description); $("#persona_description").val(power_user.persona_description);
$("#persona_description_position") $("#persona_description_position")
.val(power_user.persona_description_position) .val(power_user.persona_description_position)
@ -4748,7 +4752,7 @@ async function bindUserNameToPersona() {
// If the user is currently using this persona, set the description to the current description // If the user is currently using this persona, set the description to the current description
power_user.persona_descriptions[avatarId] = { power_user.persona_descriptions[avatarId] = {
description: isCurrentPersona ? power_user.persona_description : '', description: isCurrentPersona ? power_user.persona_description : '',
position: isCurrentPersona ? power_user.persona_description_position : persona_description_positions.BEFORE_CHAR, position: isCurrentPersona ? power_user.persona_description_position : persona_description_positions.IN_PROMPT,
}; };
} }
@ -4822,8 +4826,8 @@ function setUserAvatar() {
power_user.persona_description_position = descriptor.position; power_user.persona_description_position = descriptor.position;
} else { } else {
power_user.persona_description = ''; power_user.persona_description = '';
power_user.persona_description_position = persona_description_positions.BEFORE_CHAR; power_user.persona_description_position = persona_description_positions.IN_PROMPT;
power_user.persona_descriptions[user_avatar] = { description: '', position: persona_description_positions.BEFORE_CHAR }; power_user.persona_descriptions[user_avatar] = { description: '', position: persona_description_positions.IN_PROMPT };
} }
setPersonaDescription(); setPersonaDescription();
@ -5008,7 +5012,7 @@ async function lockUserNameToChat() {
); );
} }
power_user.personas[user_avatar] = name1; power_user.personas[user_avatar] = name1;
power_user.persona_descriptions[user_avatar] = { description: '', position: persona_description_positions.BEFORE_CHAR }; power_user.persona_descriptions[user_avatar] = { description: '', position: persona_description_positions.IN_PROMPT };
} }
chat_metadata['persona'] = user_avatar; chat_metadata['persona'] = user_avatar;
@ -5075,7 +5079,7 @@ async function doOnboarding(avatarId) {
power_user.personas[avatarId] = userName; power_user.personas[avatarId] = userName;
power_user.persona_descriptions[avatarId] = { power_user.persona_descriptions[avatarId] = {
description: '', description: '',
position: persona_description_positions.BEFORE_CHAR, position: persona_description_positions.IN_PROMPT,
}; };
} }
} }

View File

@ -75,7 +75,10 @@ const send_on_enter_options = {
} }
export const persona_description_positions = { export const persona_description_positions = {
BEFORE_CHAR: 0, IN_PROMPT: 0,
/**
* @deprecated Use persona_description_positions.IN_PROMPT instead.
*/
AFTER_CHAR: 1, AFTER_CHAR: 1,
TOP_AN: 2, TOP_AN: 2,
BOTTOM_AN: 3, BOTTOM_AN: 3,
@ -190,7 +193,7 @@ let power_user = {
persona_descriptions: {}, persona_descriptions: {},
persona_description: '', persona_description: '',
persona_description_position: persona_description_positions.BEFORE_CHAR, persona_description_position: persona_description_positions.IN_PROMPT,
persona_show_notifications: true, persona_show_notifications: true,
custom_stopping_strings: '', custom_stopping_strings: '',