mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-06-05 21:59:27 +02:00
mark favorite and filter by favorite
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@ -14,3 +14,4 @@ config.conf
|
||||
public/settings.json
|
||||
/thumbnails
|
||||
whitelist.txt
|
||||
.vscode
|
||||
|
@ -1414,13 +1414,25 @@
|
||||
<div title="Token counts may be inaccurate and provided just for reference." id="result_info"></div>
|
||||
</div>
|
||||
<hr>
|
||||
<div id="description_div" class="margin-bot-10px">
|
||||
Description
|
||||
<a href="/notes/1" class="notes-link" target="_blank">
|
||||
<span class="note-link-span">?</span>
|
||||
</a>
|
||||
<div id="fav_chara_wrap">
|
||||
<div id="fav_chara_label" class="margin-bot-10px">
|
||||
Favorite
|
||||
<a href="/notes/15" class="notes-link" target="_blank">
|
||||
<span class="note-link-span">?</span>
|
||||
</a>
|
||||
</div>
|
||||
<div>
|
||||
<input type="checkbox" id="fav_checkbox" name="fav" value="1"/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div id="description_div" class="margin-bot-10px">
|
||||
Description
|
||||
<a href="/notes/1" class="notes-link" target="_blank">
|
||||
<span class="note-link-span">?</span>
|
||||
</a>
|
||||
|
||||
</div>
|
||||
<textarea id="description_textarea" placeholder="Describe your character's physical and mental traits here." class="margin-bot-10px" name="description" placeholder=""></textarea>
|
||||
|
||||
<div id="first_message_div" class="margin-bot-10px">
|
||||
@ -1531,6 +1543,7 @@
|
||||
<div id="rm_button_create" title="Create New Character" class="menu_button fa-solid fa-user-plus "></div>
|
||||
<div id="character_import_button" title="Import Character from File" class="menu_button fa-solid fa-file-arrow-up "></div>
|
||||
<div id="rm_button_group_chats" title="Create New Chat Group" class="menu_button fa-solid fa-users-gear "></div>
|
||||
<div id="filter_by_fav" title="Filter By Favorite" class="menu_button fa-solid fa-star "></div>
|
||||
</div>
|
||||
<form id="form_character_search_form" action="javascript:void(null);">
|
||||
<input id="character_search_bar" class="text_pole" type="search" placeholder="Character search..." maxlength="50" />
|
||||
|
21
public/notes/15.html
Normal file
21
public/notes/15.html
Normal file
@ -0,0 +1,21 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>TavernAI - Note - Favorite Character</title>
|
||||
<link rel="stylesheet" href="/css/notes.css">
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<link rel="preconnect" href="https://fonts.googleapis.com">
|
||||
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin="">
|
||||
<link href="https://fonts.googleapis.com/css2?family=Noto+Sans:ital,wght@0,100;0,200;0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,100;1,200;1,300;1,400;1,500;1,600;1,700;1,800;1,900&display=swap" rel="stylesheet">
|
||||
</head>
|
||||
<body>
|
||||
<div id="main">
|
||||
<div id="content">
|
||||
<h2>Favorite Character</h2>
|
||||
<p>
|
||||
Mark character as favorite to quickly filter on the side menu bar by pressing on the star button.
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
@ -203,6 +203,7 @@ let dialogueResolve = null;
|
||||
let chat_metadata = {};
|
||||
let streamingProcessor = null;
|
||||
|
||||
let filterByFav = false;
|
||||
|
||||
const durationSaveEdit = 200;
|
||||
const saveSettingsDebounced = debounce(() => saveSettings(), durationSaveEdit);
|
||||
@ -329,6 +330,7 @@ var menu_type = ""; //what is selected in the menu
|
||||
var selected_button = ""; //which button pressed
|
||||
//create pole save
|
||||
var create_save_name = "";
|
||||
var create_fav_chara = "0";
|
||||
var create_save_description = "";
|
||||
var create_save_personality = "";
|
||||
var create_save_first_message = "";
|
||||
@ -648,6 +650,7 @@ function printCharacters() {
|
||||
`<div class=character_select chid=${i} id="CharID${i}">
|
||||
<div class=avatar><img src="${this_avatar}"></div>
|
||||
<div class=ch_name>${item.name}</div>
|
||||
<input class="ch_fav" value=${item.fav} hidden />
|
||||
</div>`
|
||||
);
|
||||
//console.log('printcharacters() -- printing -- ChID '+i+' ('+item.name+')');
|
||||
@ -3167,6 +3170,9 @@ function select_selected_character(chid) {
|
||||
if (characters[chid].avatar != "none") {
|
||||
this_avatar = getThumbnailUrl('avatar', characters[chid].avatar);
|
||||
}
|
||||
|
||||
characters[chid].fav === "1" ? $("#fav_checkbox").prop("checked", true) : $("#fav_checkbox").prop("checked", false);
|
||||
|
||||
$("#avatar_load_preview").attr("src", this_avatar);
|
||||
$("#name_div").css("display", "none");
|
||||
|
||||
@ -3763,6 +3769,21 @@ $(document).ready(function () {
|
||||
}
|
||||
});
|
||||
|
||||
$("#filter_by_fav").click(function() {
|
||||
filterByFav === true ? filterByFav = false : filterByFav = true;
|
||||
|
||||
const selector = ['#rm_print_characters_block .character_select', '#rm_print_characters_block .group_select'].join(',');
|
||||
if(filterByFav === true){
|
||||
$(selector).each(function () {
|
||||
$(this).children(".ch_fav").val().toLowerCase().includes(1)
|
||||
? $(this).show()
|
||||
: $(this).hide();
|
||||
});
|
||||
}else{
|
||||
$(selector).show();
|
||||
}
|
||||
});
|
||||
|
||||
$("#send_but").click(function () {
|
||||
if (is_send_press == false) {
|
||||
is_send_press = true;
|
||||
@ -4265,11 +4286,15 @@ $(document).ready(function () {
|
||||
create_save_scenario = $("#scenario_pole").val();
|
||||
create_save_mes_example = $("#mes_example_textarea").val();
|
||||
create_save_first_message = $("#firstmessage_textarea").val();
|
||||
create_fav_chara = $("#fav_checkbox").val();
|
||||
} else {
|
||||
saveCharacterDebounced();
|
||||
}
|
||||
});
|
||||
|
||||
$("#fav_checkbox").change(function(){
|
||||
saveCharacterDebounced();
|
||||
});
|
||||
|
||||
$("#talkativeness_slider").on("input", function () {
|
||||
if (menu_type == "create") {
|
||||
|
File diff suppressed because one or more lines are too long
@ -1138,6 +1138,17 @@ input[type=search]:focus::-webkit-search-cancel-button {
|
||||
margin-bottom: 4px;
|
||||
}
|
||||
|
||||
#fav_chara_wrap{
|
||||
display: flex;
|
||||
margin: 5px 0px;
|
||||
}
|
||||
|
||||
#fav_chara {
|
||||
border: none;
|
||||
font-size: 14px;
|
||||
display: flex;
|
||||
}
|
||||
|
||||
#description_div {
|
||||
position: relative;
|
||||
}
|
||||
|
@ -665,7 +665,7 @@ function checkServer() {
|
||||
|
||||
//***************** Main functions
|
||||
function charaFormatData(data) {
|
||||
var char = { "name": data.ch_name, "description": data.description, "personality": data.personality, "first_mes": data.first_mes, "avatar": 'none', "chat": data.ch_name + ' - ' + humanizedISO8601DateTime(), "mes_example": data.mes_example, "scenario": data.scenario, "create_date": humanizedISO8601DateTime(), "talkativeness": data.talkativeness };
|
||||
var char = { "name": data.ch_name, "description": data.description, "personality": data.personality, "first_mes": data.first_mes, "avatar": 'none', "chat": data.ch_name + ' - ' + humanizedISO8601DateTime(), "mes_example": data.mes_example, "scenario": data.scenario, "create_date": humanizedISO8601DateTime(), "talkativeness": data.talkativeness, "fav": data.fav ? data.fav : "0" };
|
||||
return char;
|
||||
}
|
||||
app.post("/createcharacter", urlencodedParser, function (request, response) {
|
||||
@ -719,10 +719,9 @@ app.post("/editcharacter", urlencodedParser, async function (request, response)
|
||||
var char = charaFormatData(request.body);//{"name": request.body.ch_name, "description": request.body.description, "personality": request.body.personality, "first_mes": request.body.first_mes, "avatar": request.body.avatar_url, "chat": request.body.chat, "last_mes": request.body.last_mes, "mes_example": ''};
|
||||
char.chat = request.body.chat;
|
||||
char.create_date = request.body.create_date;
|
||||
|
||||
char = JSON.stringify(char);
|
||||
let target_img = (request.body.avatar_url).replace('.png', '');
|
||||
|
||||
console.log(char);
|
||||
try {
|
||||
if (!filedata) {
|
||||
|
||||
|
Reference in New Issue
Block a user