Fix saving of groups after edits

This commit is contained in:
SillyLossy
2023-04-06 12:43:02 +03:00
parent 7b10aa63a8
commit a1770b8c6b
4 changed files with 48 additions and 47 deletions

View File

@@ -19,7 +19,7 @@
<p>
<u>Character Anchor</u> - affects the character played by the AI by motivating him to write longer messages.<br><br>
Looks like:
<code>[(Bot's name) talks a lot with descriptions]</code>
<code>[Elaborate speaker]</code>
</p>
<p>
<u>Style Anchor</u> - affects the entire AI model, motivating the AI to write longer messages even when it is not acting as the character.<Br><br>

View File

@@ -35,10 +35,9 @@
</p>
<h4>2. Characters are activated by the "Talkativeness" factor.</h4>
<p>
Talkativeness defines how often the character speaks if it was not mentioned. Adjust this value on
"Advanced definitions" screen in character editor.
Slider values are on a linear scale from <b>0% / Shy</b> (character never talks unless mentioned) to
<b>100% / Chatty</b> (character always replies).
Talkativeness defines how often the character speaks if they were not mentioned. Adjust this value on
"Advanced definitions" screen in character editor. Slider values are on a linear scale from
<b>0% / Shy</b> (character never talks unless mentioned) to <b>100% / Chatty</b> (character always replies).
Default value for new characters is 50% chance.
</p>
<h4>3. Random character is selected.</h4>

View File

@@ -215,7 +215,6 @@ const system_messages = {
'<li><tt>{{text}}</tt> set the behavioral bias for the AI character</li>',
'<li><tt>{{}}</tt> cancel a previously set bias</li>',
'</ol>',
'Need more help? Visit our wiki <a href=\"https://github.com/TavernAI/TavernAI/wiki\">TavernAI Wiki</a>!'
].join('')
},
welcome:
@@ -231,8 +230,7 @@ const system_messages = {
'<li>Create or pick a character from the list</li>',
'</ul>',
'Still have questions left?\n',
'Check out built-in help by typing <tt>/?</tt> in any chat or visit our ',
'<a target="_blank" href="https://github.com/TavernAI/TavernAI/wiki">TavernAI Wiki</a>!'
'Check out built-in help or type <tt>/?</tt> in any chat.'
].join('')
},
group: {

View File

@@ -529,6 +529,44 @@ async function groupChatAutoModeWorker() {
await generateGroupWrapper(true);
}
async function memberClickHandler(event) {
event.stopPropagation();
const id = $(this).data("id");
const isDelete = !!$(this).closest("#rm_group_members").length;
const template = $(this).clone();
let _thisGroup = groups.find((x) => x.id == selected_group);
template.data("id", id);
template.click(memberClickHandler);
if (isDelete) {
template.find(".plus").show();
template.find(".minus").hide();
$("#rm_group_add_members").prepend(template);
} else {
template.find(".plus").hide();
template.find(".minus").show();
$("#rm_group_members").prepend(template);
}
if (_thisGroup) {
if (isDelete) {
const index = _thisGroup.members.findIndex((x) => x === id);
if (index !== -1) {
_thisGroup.members.splice(index, 1);
}
} else {
_thisGroup.members.push(id);
template.css({ 'order': _thisGroup.members.length });
}
await editGroup(selected_group);
updateGroupAvatar(_thisGroup);
}
$(this).remove();
const groupHasMembers = !!$("#rm_group_members").children().length;
$("#rm_group_submit").prop("disabled", !groupHasMembers);
}
function select_group_chats(chat_id) {
const group = chat_id && groups.find((x) => x.id == chat_id);
const groupName = group?.name ?? "";
@@ -537,8 +575,9 @@ function select_group_chats(chat_id) {
$("#rm_group_chat_name").off();
$("#rm_group_chat_name").on("input", async function () {
if (chat_id) {
group.name = $(this).val();
$("#rm_button_selected_ch").children("h2").text(group.name);
let _thisGroup = groups.find((x) => x.id == chat_id);
_thisGroup.name = $(this).val();
$("#rm_button_selected_ch").children("h2").text(_thisGroup.name);
await editGroup(chat_id);
}
});
@@ -547,7 +586,8 @@ function select_group_chats(chat_id) {
$('input[name="rm_group_activation_strategy"]').off();
$('input[name="rm_group_activation_strategy"]').on("input", async function(e) {
if (chat_id) {
group.activation_strategy = Number(e.target.value);
let _thisGroup = groups.find((x) => x.id == chat_id);
_thisGroup.activation_strategy = Number(e.target.value);
await editGroup(chat_id);
}
});
@@ -555,42 +595,6 @@ function select_group_chats(chat_id) {
selectRightMenuWithAnimation('rm_group_chats_block');
async function memberClickHandler(event) {
event.stopPropagation();
const id = $(this).data("id");
const isDelete = !!$(this).closest("#rm_group_members").length;
const template = $(this).clone();
template.data("id", id);
template.click(memberClickHandler);
if (isDelete) {
template.find(".plus").show();
template.find(".minus").hide();
$("#rm_group_add_members").prepend(template);
} else {
template.find(".plus").hide();
template.find(".minus").show();
$("#rm_group_members").prepend(template);
}
if (group) {
if (isDelete) {
const index = group.members.findIndex((x) => x === id);
if (index !== -1) {
group.members.splice(index, 1);
}
} else {
group.members.push(id);
}
await editGroup(chat_id);
updateGroupAvatar(group);
}
$(this).remove();
const groupHasMembers = !!$("#rm_group_members").children().length;
$("#rm_group_submit").prop("disabled", !groupHasMembers);
}
// render characters list
$("#rm_group_add_members").empty();
$("#rm_group_members").empty();