mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-06-05 21:59:27 +02:00
group chat fav mark, fav filter
This commit is contained in:
@ -1470,6 +1470,10 @@
|
||||
</div>
|
||||
<div id="rm_group_buttons">
|
||||
<div class="rm_group_settings">
|
||||
<label class="checkbox_label">
|
||||
<input id="rm_group_fav" type="checkbox" />
|
||||
Favorite
|
||||
</label>
|
||||
<label class="checkbox_label">
|
||||
<input id="rm_group_allow_self_responses" type="checkbox" />
|
||||
Allow bot responses to self
|
||||
@ -1529,6 +1533,7 @@
|
||||
<div class="fa-solid fa-user-group"></div>
|
||||
</div>
|
||||
<div class="ch_name"></div>
|
||||
<input class="ch_fav" value="" hidden />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -203,7 +203,7 @@ let dialogueResolve = null;
|
||||
let chat_metadata = {};
|
||||
let streamingProcessor = null;
|
||||
|
||||
let filterByFav = false;
|
||||
window.filterByFav = false;
|
||||
|
||||
const durationSaveEdit = 200;
|
||||
const saveSettingsDebounced = debounce(() => saveSettings(), durationSaveEdit);
|
||||
@ -636,7 +636,6 @@ function updateSoftPromptsList(soft_prompts) {
|
||||
}
|
||||
|
||||
function printCharacters() {
|
||||
//console.log('printCharacters() entered');
|
||||
$("#rm_print_characters_block").empty();
|
||||
//console.log('printCharacters() -- sees '+characters.length+' characters.');
|
||||
characters.forEach(function (item, i, arr) {
|
||||
@ -1307,7 +1306,7 @@ class StreamingProcessor {
|
||||
}
|
||||
|
||||
async function Generate(type, automatic_trigger, force_name2) {
|
||||
console.log('Generate entered');
|
||||
//console.log('Generate entered');
|
||||
setGenerationProgress(0);
|
||||
tokens_already_generated = 0;
|
||||
const isImpersonate = type == "impersonate";
|
||||
|
@ -211,10 +211,12 @@ async function getGroups() {
|
||||
|
||||
function printGroups() {
|
||||
for (let group of groups) {
|
||||
const renderStar = group.fav === "1" ? "<i class='fa-solid fa-star fa-2xs'></i>" : ""
|
||||
const template = $("#group_list_template .group_select").clone();
|
||||
template.data("id", group.id);
|
||||
template.attr("grid", group.id);
|
||||
template.find(".ch_name").text(group.name);
|
||||
template.find(".ch_name").html(group.name + " " + renderStar);
|
||||
template.find(".ch_fav").val(group.fav);
|
||||
$("#rm_print_characters_block").prepend(template);
|
||||
updateGroupAvatar(group);
|
||||
}
|
||||
@ -695,7 +697,6 @@ async function reorderGroupMember(chat_id, groupMember, direction) {
|
||||
function select_group_chats(chat_id, skipAnimation) {
|
||||
const group = chat_id && groups.find((x) => x.id == chat_id);
|
||||
const groupName = group?.name ?? "";
|
||||
|
||||
$("#rm_group_chat_name").val(groupName);
|
||||
$("#rm_group_chat_name").off();
|
||||
$("#rm_group_chat_name").on("input", async function () {
|
||||
@ -753,6 +754,7 @@ function select_group_chats(chat_id, skipAnimation) {
|
||||
const groupHasMembers = !!$("#rm_group_members").children().length;
|
||||
$("#rm_group_submit").prop("disabled", !groupHasMembers);
|
||||
$("#rm_group_allow_self_responses").prop("checked", group && group.allow_self_responses);
|
||||
$("#rm_group_fav").prop("checked", group && group.fav === "1");
|
||||
|
||||
// bottom buttons
|
||||
if (chat_id) {
|
||||
@ -774,6 +776,19 @@ function select_group_chats(chat_id, skipAnimation) {
|
||||
callPopup("<h3>Delete the group?</h3>", "del_group");
|
||||
});
|
||||
|
||||
$("#rm_group_fav").off();
|
||||
$("#rm_group_fav").on("input", async function(){
|
||||
if (group) {
|
||||
const value = $(this).prop("checked");
|
||||
if(value === true){
|
||||
group.fav = "1";
|
||||
}else{
|
||||
group.fav = "0";
|
||||
}
|
||||
await editGroup(chat_id);
|
||||
}
|
||||
});
|
||||
|
||||
$("#rm_group_allow_self_responses").off();
|
||||
$("#rm_group_allow_self_responses").on("input", async function () {
|
||||
if (group) {
|
||||
@ -829,6 +844,9 @@ $(document).ready(() => {
|
||||
updateChatMetadata({}, true);
|
||||
chat.length = 0;
|
||||
await getGroupChat(id);
|
||||
//to avoid the filter being lit up yellow and left at true while the list of character and group reseted.
|
||||
$("#filter_by_fav").css("color","#ffffff");
|
||||
filterByFav = false;
|
||||
}
|
||||
|
||||
select_group_chats(id);
|
||||
@ -852,6 +870,8 @@ $(document).ready(() => {
|
||||
$("#rm_group_submit").click(async function () {
|
||||
let name = $("#rm_group_chat_name").val();
|
||||
let allow_self_responses = !!$("#rm_group_allow_self_responses").prop("checked");
|
||||
let fav = !!$("#rm_group_fav").prop("checked");
|
||||
fav === true ? fav ="1" : fav = "0"
|
||||
let activation_strategy = $('input[name="rm_group_activation_strategy"]:checked').val() ?? group_activation_strategy.NATURAL;
|
||||
const members = $("#rm_group_members .group_member")
|
||||
.map((_, x) => $(x).data("id"))
|
||||
@ -877,6 +897,7 @@ $(document).ready(() => {
|
||||
allow_self_responses: allow_self_responses,
|
||||
activation_strategy: activation_strategy,
|
||||
chat_metadata: {},
|
||||
fav: fav,
|
||||
}),
|
||||
});
|
||||
|
||||
|
File diff suppressed because one or more lines are too long
@ -1743,6 +1743,7 @@ app.post('/creategroup', jsonParser, (request, response) => {
|
||||
allow_self_responses: !!request.body.allow_self_responses,
|
||||
activation_strategy: request.body.activation_strategy ?? 0,
|
||||
chat_metadata: request.body.chat_metadata ?? {},
|
||||
fav: request.body.fav,
|
||||
};
|
||||
const pathToFile = path.join(directories.groups, `${id}.json`);
|
||||
const fileData = JSON.stringify(chatMetadata);
|
||||
@ -1759,7 +1760,6 @@ app.post('/editgroup', jsonParser, (request, response) => {
|
||||
if (!request.body || !request.body.id) {
|
||||
return response.sendStatus(400);
|
||||
}
|
||||
|
||||
const id = request.body.id;
|
||||
const pathToFile = path.join(directories.groups, `${id}.json`);
|
||||
const fileData = JSON.stringify(request.body);
|
||||
|
Reference in New Issue
Block a user