mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-06-05 21:59:27 +02:00
dynamic char delete + button/create form styling
1. enabled deletion of characters without page reload. now when a user deletes a character, the page will not auto-refresh, but they will be get a message from Chloe instructing them to pick another character to continue. 2. standardized all buttons to use menu_button class instead of individual ID stylings 3. adjusted create_form, making wider range inputs for mobile users. - moved 'back button' to the bottom of the form next to delete/create/export - changed the 'back' button on post-creation rm_info to look like a button 4. condensed redundant CSS where possible; removed unused CSS. 5. Fixed the problem of the nav auto-closing when a character is created or when using advanced editing window. 6. made the token counter load when a character is selected. previously it only showed up after edits were made. 7. found some problems with /createcharacter - if a character/PNG with the same name exists, the server won't make a new character, but it doesn't tell the user about the error. I UI acts as if the character was created. I added some soft console.error messages for this, but couldn't figure out a way to make it give a proper error. probably because fs.existsSync doesn't have a callback.
This commit is contained in:
@@ -43,7 +43,7 @@
|
||||
var name1 = default_user_name;
|
||||
var name2 = "Chloe";
|
||||
var chat = [{name: 'Chloe',is_user: false,is_name: true,create_date: 0,mes: '\n*You went inside. The air smelled of fried meat, tobacco and a hint of wine. A dim light was cast by candles, and a fire crackled in the fireplace. It seems to be a very pleasant place. Behind the wooden bar is an elf waitress, she is smiling. Her ears are very pointy, and there is a twinkle in her eye. She wears glasses and a white apron. As soon as she noticed you, she immediately came right up close to you.*\n\n' +' "Hello there! How is your evening going?"<br><br>\n'+'<img src="img/star_dust_city.png" width=80%; display:block;">\n'}];
|
||||
|
||||
var safetychat = [{name: 'Chloe',is_user: false,is_name: true,create_date: 0,mes: '\n*You deleted a charcter and arrived back here for safety reasons! Pick another character!*\n\n'}];
|
||||
var chat_create_date = 0;
|
||||
|
||||
//RossAscends: Added function to format dates used in files and chat timestamps to a humanized format.
|
||||
@@ -193,6 +193,7 @@
|
||||
xhr.setRequestHeader("X-CSRF-Token", token);
|
||||
});
|
||||
|
||||
|
||||
$.get("/csrf-token")
|
||||
.then(data => {
|
||||
token = data.token;
|
||||
@@ -207,6 +208,24 @@
|
||||
autoconnect();
|
||||
});
|
||||
|
||||
//RossAscends: a smaller load-up function to be used instead of refreshing the page in cases like deleting a character and changing username
|
||||
function QuickRefresh(){
|
||||
clearChat();
|
||||
//characters.length = 0 //if this could be enabled it would allow the GetCharacters function to detect files added or removed from the char dir on each panel load
|
||||
console.log('quickRefresh() -- active_character -- '+active_character);
|
||||
console.log('quickRefresh() -- this_chid -- '+this_chid);
|
||||
getSettings("def");
|
||||
getCharacters();
|
||||
getUserAvatars();
|
||||
//console.log(chat);
|
||||
printMessages();
|
||||
$( "#rm_button_selected_ch" ).css("class","deselected-right-tab");
|
||||
$( "#rm_button_selected_ch" ).children("h2").text('');
|
||||
if (NavToggle.checked === false) {
|
||||
document.getElementById('nav-toggle').click();
|
||||
};
|
||||
}
|
||||
|
||||
$('#characloud_url').click(function(){
|
||||
window.open('https://boosty.to/tavernai', '_blank');
|
||||
});
|
||||
@@ -328,23 +347,26 @@
|
||||
$("#api_button").css("display", 'inline-block');
|
||||
}
|
||||
function printCharacters(){
|
||||
//console.log(1);
|
||||
//console.log('printCharacters() entered');
|
||||
|
||||
$("#rm_print_characters_block").empty();
|
||||
console.log('printCharacters() -- sees '+characters.length+' characters.');
|
||||
characters.forEach(function(item, i, arr) {
|
||||
|
||||
var this_avatar = default_avatar;
|
||||
if(item.avatar != 'none'){
|
||||
this_avatar = "characters/"+item.avatar+"#"+Date.now();
|
||||
|
||||
}
|
||||
$("#rm_print_characters_block").prepend('<div class=character_select chid='+i+' id="CharID'+i+'"><div class=avatar><img src="'+this_avatar+'"></div><div class=ch_name>'+item.name+'</div></div>');
|
||||
//console.log(item.name);
|
||||
console.log('printcharacters() -- printing -- ChID '+i+' ('+item.name+')');
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
async function getCharacters() {
|
||||
|
||||
const response = await fetch("/getcharacters", {
|
||||
//console.log('getCharacters() -- entered');
|
||||
//console.log(characters);
|
||||
var response = await fetch("/getcharacters", { //RossAscends: changed from const
|
||||
method: "POST",
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
@@ -353,25 +375,30 @@
|
||||
body: JSON.stringify({
|
||||
"": ""
|
||||
})
|
||||
|
||||
});
|
||||
if (response.ok === true) {
|
||||
const getData = await response.json();
|
||||
|
||||
var getData = ''; //RossAscends: reset to force array to update to account for deleted character.
|
||||
var getData = await response.json(); //RossAscends: changed from const
|
||||
//console.log(getData);
|
||||
|
||||
//var aa = JSON.parse(getData[0]);
|
||||
const load_ch_count = Object.getOwnPropertyNames(getData);
|
||||
|
||||
var load_ch_count = Object.getOwnPropertyNames(getData); //RossAscends: change from const to create dynamic character load amounts.
|
||||
var charCount = load_ch_count.length;
|
||||
//console.log('/getcharacters -- expecting to load '+charCount+' characters.')
|
||||
for(var i = 0; i < load_ch_count.length;i++){
|
||||
|
||||
characters[i] = [];
|
||||
characters[i] = getData[i];
|
||||
|
||||
//console.log(characters[i]);
|
||||
//console.log('/getcharacters -- loaded character #'+(i+1)+' ('+characters[i].name+')');
|
||||
}
|
||||
characters.sort((a,b) => a.create_date - b.create_date );
|
||||
//characters.reverse();
|
||||
if(this_chid != undefined) $("#avatar_url_pole").val(characters[this_chid].avatar);
|
||||
console.log('/getcharacters -- this_chid -- '+this_chid);
|
||||
if(this_chid != undefined && this_chid != 'invalid-safety-id') $("#avatar_url_pole").val(characters[this_chid].avatar);
|
||||
//console.log('/getcharacters -- sending '+i+' characters to /printcharacters');
|
||||
printCharacters();
|
||||
|
||||
//console.log(propOwn.length);
|
||||
//return JSON.parse(getData[0]);
|
||||
//const getData = await response.json();
|
||||
@@ -499,6 +526,8 @@
|
||||
}
|
||||
}
|
||||
function printMessages(){
|
||||
//console.log(chat);
|
||||
//console.log('printMessages() -- printing messages for -- '+this_chid+' '+active_character+' '+characters[this_chid]);
|
||||
chat.forEach(function(item, i, arr) {
|
||||
addOneMessage(item);
|
||||
});
|
||||
@@ -534,7 +563,7 @@
|
||||
//thisText = thisText.split("\n").join("<br>");
|
||||
var avatarImg = "User Avatars/"+user_avatar;
|
||||
if(!mes['is_user']){
|
||||
if(this_chid == undefined){
|
||||
if(this_chid == undefined || this_chid == "invalid-safety-id"){
|
||||
avatarImg = "img/chloe.png";
|
||||
}else{
|
||||
if(characters[this_chid].avatar != 'none'){
|
||||
@@ -1093,7 +1122,7 @@
|
||||
addOneMessage(chat[chat.length-1]);
|
||||
$( "#send_but" ).css("display", "inline");
|
||||
$( "#loading_mes" ).css("display", "none");
|
||||
//console.log('/savechat called by /Generate');
|
||||
//console.log('/savechat called by /Generate');
|
||||
saveChat();
|
||||
}else{
|
||||
//console.log('run force_name2 protocol');
|
||||
@@ -1154,8 +1183,7 @@
|
||||
});
|
||||
}
|
||||
async function getChat() {
|
||||
//console.log('/getChat entered');
|
||||
//console.log(characters[this_chid].chat);
|
||||
console.log('/getchat -- entered for -- '+characters[this_chid].name);
|
||||
jQuery.ajax({
|
||||
type: 'POST',
|
||||
url: '/getchat',
|
||||
@@ -1175,16 +1203,16 @@
|
||||
}
|
||||
//chat = data;
|
||||
chat_create_date = chat[0]['create_date'];
|
||||
//console.log('/getchat saw chat_create_date: '+chat_create_date);
|
||||
//console.log('/getchat saw chat_create_date: '+chat_create_date);
|
||||
chat.shift();
|
||||
|
||||
}else{
|
||||
chat_create_date = humanizedISO8601DateTime();
|
||||
}
|
||||
//console.log(chat);
|
||||
//console.log('getChatResults called by /getchat');
|
||||
//console.log('getChatResults called by /getchat');
|
||||
getChatResult();
|
||||
//console.log('savechat called by /getchat');
|
||||
//console.log('savechat called by /getchat');
|
||||
saveChat();
|
||||
},
|
||||
error: function (jqXHR, exception) {
|
||||
@@ -1239,7 +1267,7 @@
|
||||
}
|
||||
});
|
||||
|
||||
//RossAscends: Lets add some hotkeys
|
||||
//RossAscends: Additional hotkeys
|
||||
document.addEventListener('keydown', (event) => {
|
||||
|
||||
if(event.ctrlKey && event.key == "Enter") { // Ctrl+Enter for Regeneration Last Response
|
||||
@@ -1266,7 +1294,7 @@
|
||||
selected_button = 'settings';
|
||||
menu_type = 'settings';
|
||||
$( "#rm_characters_block" ).css("display", "none");
|
||||
$( "#rm_api_block" ).css("display", "block");
|
||||
$( "#rm_api_block" ).css("display", "grid");
|
||||
$('#rm_api_block').css('opacity',0.0);
|
||||
$('#rm_api_block').transition({
|
||||
opacity: 1.0,
|
||||
@@ -1299,12 +1327,12 @@
|
||||
});
|
||||
function select_rm_create(){
|
||||
menu_type = 'create';
|
||||
//console.log('select_rm_Create() -- selected button: '+selected_button);
|
||||
if(selected_button == 'create'){
|
||||
if(create_save_avatar != ''){
|
||||
$("#add_avatar_button").get(0).files = create_save_avatar;
|
||||
read_avatar_load($("#add_avatar_button").get(0));
|
||||
}
|
||||
|
||||
}
|
||||
$( "#rm_characters_block" ).css("display", "none");
|
||||
$( "#rm_api_block" ).css("display", "none");
|
||||
@@ -1318,11 +1346,13 @@
|
||||
complete: function() { }
|
||||
});
|
||||
$( "#rm_info_block" ).css("display", "none");
|
||||
|
||||
$( "#delete_button_div" ).css("display", "none");
|
||||
$( "#delete_button" ).css("display", "none");
|
||||
$( "#export_button" ).css("display", "none");
|
||||
$("#create_button").css("display", "block");
|
||||
$("#create_button").attr("value", "Create");
|
||||
$('#result_info').html(' ');
|
||||
//RossAscends: commented this out as part of the auto-loading token counter
|
||||
//$('#result_info').html(' ');
|
||||
$( "#rm_button_characters" ).css("class","deselected-right-tab");
|
||||
$( "#rm_button_settings" ).css("class","deselected-right-tab");
|
||||
$( "#rm_button_selected_ch" ).css("class","deselected-right-tab");
|
||||
@@ -1348,7 +1378,7 @@
|
||||
$("#form_create").attr("actiontype", "createcharacter");
|
||||
}
|
||||
function select_rm_characters(){
|
||||
|
||||
QuickRefresh();
|
||||
menu_type = 'characters';
|
||||
$( "#rm_characters_block" ).css("display", "block");
|
||||
$('#rm_characters_block').css('opacity',0.0);
|
||||
@@ -1383,7 +1413,8 @@
|
||||
//console.log('select_selected_character() -- starting with input of -- '+chid+' (name:'+characters[chid].name+')');
|
||||
select_rm_create();
|
||||
menu_type = 'character_edit';
|
||||
$( "#delete_button_div" ).css("display", "block");
|
||||
$( "#delete_button" ).css("display", "block");
|
||||
$( "#export_button" ).css("display", "block");
|
||||
$( "#rm_button_selected_ch" ).css("class","selected-right-tab");
|
||||
var display_name = characters[chid].name;
|
||||
|
||||
@@ -1429,18 +1460,28 @@
|
||||
//console.log('select_selected_character() -- active_character -- '+chid+'(ChID of '+display_name+')');
|
||||
saveSettings();
|
||||
//console.log('select_selected_character() -- called saveSettings() to save -- active_character -- '+active_character+'(ChID of '+display_name+')');
|
||||
|
||||
}
|
||||
$(document).on('click', '.character_select', function(){
|
||||
if(this_chid !== $(this).attr("chid")){
|
||||
if(this_chid !== $(this).attr("chid")){ //if clicked on a different character from what was currently selected
|
||||
if(!is_send_press){
|
||||
this_edit_mes_id = undefined;
|
||||
selected_button = 'character_edit';
|
||||
this_chid = $(this).attr("chid");
|
||||
active_character = this_chid;
|
||||
clearChat();
|
||||
chat.length = 0;
|
||||
getChat();
|
||||
}
|
||||
var count_tokens = encode(JSON.stringify(characters[this_chid].description+characters[this_chid].personality+characters[this_chid].scenario+characters[this_chid].mes_example)).length;
|
||||
//RossAscends: added token counter to load when a character is selected, instead of waiting for an edit.
|
||||
if(count_tokens < 1024){
|
||||
$('#result_info').html(count_tokens+" Tokens");
|
||||
}else{
|
||||
$('#result_info').html("<font color=red>"+count_tokens+" Tokens(TOO MANY TOKENS)</font>");
|
||||
}
|
||||
console.log('Clicked on '+characters[this_chid].name+' Active_Character set to: '+active_character+' (ChID:'+this_chid+')');
|
||||
}
|
||||
}else{ //if clicked on character that was already selected
|
||||
selected_button = 'character_edit';
|
||||
select_selected_character(this_chid);
|
||||
}
|
||||
@@ -1567,19 +1608,29 @@
|
||||
bg_file_for_del.parent().remove();
|
||||
}
|
||||
if(popup_type == 'del_ch'){
|
||||
console.log('Deleting character -- ChID: '+this_chid+ ' -- Name: '+characters[this_chid].name);
|
||||
var msg = jQuery('#form_create').serialize(); // ID form
|
||||
jQuery.ajax({
|
||||
method: 'POST',
|
||||
url: '/deletecharacter',
|
||||
beforeSend: function(){
|
||||
select_rm_info("Character deleted");
|
||||
|
||||
//$('#create_button').attr('value','Deleting...');
|
||||
},
|
||||
data: msg,
|
||||
cache: false,
|
||||
success: function(html){
|
||||
location.reload();
|
||||
//RossAscends: setting active character to null in order to avoid array errors.
|
||||
//this allows for dynamic refresh of character list after deleting a character.
|
||||
$('#character_cross').click();
|
||||
active_character = 'invalid-safety-id'; //unsets the chid in settings (this prevents AutoLoadChat from trying to load the wrong ChID
|
||||
this_chid = 'invalid-safety-id'; //unsets expected chid before reloading (related to getCharacters/printCharacters from using old arrays)
|
||||
characters.length = 0; // resets the characters array, forcing getcharacters to reset
|
||||
name2="Chloe"; // replaces deleted charcter name with Chloe, since she wil be displayed next.
|
||||
chat = safetychat; // sets up chloe to tell user about having deleted a character
|
||||
saveSettings(); // saving settings to keep changes to variables
|
||||
QuickRefresh(); // call quick refresh of Char list, clears chat, and loads Chloe 'post-char-delete' message.
|
||||
//location.reload(); // this is Humi's original code
|
||||
//getCharacters();
|
||||
//$('#create_button_div').html(html);
|
||||
}
|
||||
@@ -1721,8 +1772,8 @@
|
||||
var formData = new FormData($("#form_create").get(0));
|
||||
if($("#form_create").attr("actiontype") == "createcharacter"){
|
||||
|
||||
if($("#character_name_pole").val().length > 0){
|
||||
//console.log('/createcharacter entered');
|
||||
if($("#character_name_pole").val().length > 0){ //if the character name text area isn't empty (only posible when creating a new character)
|
||||
//console.log('/createcharacter entered');
|
||||
jQuery.ajax({
|
||||
type: 'POST',
|
||||
url: '/createcharacter',
|
||||
@@ -1735,7 +1786,7 @@
|
||||
contentType: false,
|
||||
processData: false,
|
||||
success: function(html){
|
||||
$('#character_cross').click();
|
||||
$('#character_cross').click(); //closes the advanced character editing popup
|
||||
$("#character_name_pole").val('');
|
||||
create_save_name = '';
|
||||
$("#description_textarea").val('');
|
||||
@@ -1765,13 +1816,15 @@
|
||||
select_rm_info("Character created");
|
||||
|
||||
$('#rm_info_block').transition({ opacity: 1.0 ,duration: 2000});
|
||||
//console.log('/getcharacters called after /createchracter');
|
||||
|
||||
|
||||
getCharacters();
|
||||
}else{
|
||||
$('#result_info').html(html);
|
||||
}
|
||||
},
|
||||
error: function (jqXHR, exception) {
|
||||
//alert('ERROR: '+xhr.status+ ' Status Text: '+xhr.statusText+' '+xhr.responseText);
|
||||
$('#create_button').removeAttr("disabled");
|
||||
}
|
||||
});
|
||||
@@ -1779,8 +1832,8 @@
|
||||
$('#result_info').html("Name not entered");
|
||||
}
|
||||
}else{
|
||||
//console.log('Avatar Button Value:'+$("#add_avatar_button").val());
|
||||
|
||||
//console.log('/editcharacter -- entered.');
|
||||
//console.log('Avatar Button Value:'+$("#add_avatar_button").val());
|
||||
jQuery.ajax({
|
||||
type: 'POST',
|
||||
url: '/editcharacter',
|
||||
@@ -1793,14 +1846,12 @@
|
||||
contentType: false,
|
||||
processData: false,
|
||||
success: function(html){
|
||||
|
||||
$('.mes').each(function(){
|
||||
if($(this).attr('ch_name') != name1){
|
||||
$(this).children('.avatar').children('img').attr('src', $('#avatar_load_preview').attr('src'));
|
||||
}
|
||||
});
|
||||
if(chat.length === 1 ){
|
||||
|
||||
var this_ch_mes = default_ch_mes;
|
||||
if($('#firstmessage_textarea').val() != ""){
|
||||
this_ch_mes = $('#firstmessage_textarea').val();
|
||||
@@ -1818,24 +1869,19 @@
|
||||
}
|
||||
}
|
||||
$('#create_button').removeAttr("disabled");
|
||||
|
||||
getCharacters();
|
||||
|
||||
|
||||
$("#add_avatar_button").replaceWith($("#add_avatar_button").val('').clone(true));
|
||||
$('#create_button').attr('value','Save');
|
||||
|
||||
//console.log('/editcharacters -- this_chid -- '+this_chid);
|
||||
if(this_chid != undefined && this_chid != 'invalid-safety-id'){ //added check to avoid trying to load tokens in case of character deletion
|
||||
var count_tokens = encode(JSON.stringify(characters[this_chid].description+characters[this_chid].personality+characters[this_chid].scenario+characters[this_chid].mes_example)).length;
|
||||
}
|
||||
if(count_tokens < 1024){
|
||||
$('#result_info').html(count_tokens+" Tokens");
|
||||
}else{
|
||||
$('#result_info').html("<font color=red>"+count_tokens+" Tokens(TOO MANY TOKENS)</font>");
|
||||
}
|
||||
|
||||
//$('#result_info').transition({ opacity: 0.0 ,delay: 500,duration: 1000,easing: 'in-out',complete: function() {
|
||||
//$('#result_info').transition({ opacity: 1.0,duration: 0});
|
||||
//$('#result_info').html(' ');
|
||||
//}});
|
||||
},
|
||||
error: function (jqXHR, exception) {
|
||||
$('#create_button').removeAttr("disabled");
|
||||
@@ -1847,7 +1893,7 @@
|
||||
});
|
||||
$( "#delete_button" ).click(function() {
|
||||
popup_type = 'del_ch';
|
||||
callPopup('<h3>Delete the character?</h3>');
|
||||
callPopup('<h3>Delete the character?</h3>Page will reload and you will be returned to Chloe.');
|
||||
});
|
||||
$( "#rm_info_button" ).click(function() {
|
||||
$('#rm_info_avatar').html('');
|
||||
@@ -1937,7 +1983,7 @@
|
||||
}
|
||||
});
|
||||
|
||||
// RossAscends: Added functionality that will close the RightNav panels when User clicks outside them
|
||||
// RossAscends: Added functionality that will close the RightNav panel click outside of it or related panels (adv editing popup, or dialog popups)
|
||||
|
||||
var NavToggle = document.getElementById("nav-toggle");
|
||||
var PanelPin = document.getElementById("rm_button_panel_pin");
|
||||
@@ -1946,15 +1992,17 @@
|
||||
if (NavToggle.checked === true && PanelPin.checked === false) {
|
||||
if ($(e.target).attr('id') !== "nav-toggle") {
|
||||
if (document.querySelector('#right-nav-panel').contains(e.target) === false){
|
||||
if (document.querySelector('#character_popup').contains(e.target) === false){
|
||||
if (document.querySelector('#dialogue_popup').contains(e.target) === false){
|
||||
document.getElementById('nav-toggle').click();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
});
|
||||
});
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------
|
||||
|
||||
$( "#options_button" ).click(function() { // this is the options button click function, shows the options menu if closed
|
||||
if($("#options").css('display') === 'none' && $("#options").css('opacity') == 0.0){
|
||||
$("#options").css('display', 'block');
|
||||
@@ -2040,7 +2088,6 @@
|
||||
|
||||
|
||||
});
|
||||
|
||||
$( "#settings_perset" ).change(function() {
|
||||
|
||||
if($('#settings_perset').find(":selected").val() != 'gui'){
|
||||
@@ -2878,7 +2925,6 @@
|
||||
|
||||
});
|
||||
//RossAscends: auto-load last character function (fires when active_character is defined and auto_load_chat is true)
|
||||
//RossAscends: auto-connect to last API function (fires when API URL exists in settings and auto_connect is true)
|
||||
function autoloadchat(){
|
||||
console.log('starting autoloadchat routine');
|
||||
jQuery.ajax({
|
||||
@@ -3017,7 +3063,7 @@
|
||||
</div>
|
||||
<div id="select_chat_import"> <!-- import chat popup header -->
|
||||
|
||||
<input id="chat_import_button" type="submit" value="+Import">
|
||||
<input id="chat_import_button" class="menu_button" type="submit" value="+Import">
|
||||
<div>
|
||||
<a href="/notes/10" class="notes-link" target="_blank"><span class="note-link-span">?</span></a>
|
||||
</div>
|
||||
@@ -3040,7 +3086,7 @@
|
||||
</div>
|
||||
</div>
|
||||
<div id="shadow_tips_popup">
|
||||
<div id="tips_popup" style="padding-top: 30px;">
|
||||
<div id="tips_popup">
|
||||
<img id="tips_cross" src="img/cross.png" style="position: absolute; margin-left: 230px; width: 20px; height: 20px; cursor: pointer; opacity: 0.6">
|
||||
|
||||
<img src="img/love.png" style="width: 45px;height: 45px; margin-bottom: 0px; opacity: 0.6;">
|
||||
@@ -3084,33 +3130,22 @@
|
||||
</div>
|
||||
|
||||
<div id="rm_ch_create_block" class="right_menu" style="display: none;">
|
||||
<div id="rm_button_back" class="right_menu_button"><h2 style="color: rgb(188, 193, 200, 0.5);">⇐</h2></div>
|
||||
|
||||
<form id="form_create" action="javascript:void(null);" method="post" enctype="multipart/form-data">
|
||||
|
||||
<div id="name_div">
|
||||
<h4>Name</h4><h5>Character name</h5>
|
||||
<input id="character_name_pole" name="ch_name" class="text_pole" maxlength="120" value="" autocomplete="off">
|
||||
</div>
|
||||
|
||||
<!--<div id="avatar_div" class="avatar_div" style="display: block;">
|
||||
<div id="avatar_div_div" class="avatar">
|
||||
<img id="avatar_load_preview" src="img/fluffy.png" alt="avatar">
|
||||
</div>
|
||||
<input type="file" id="add_avatar_button" name="avatar" accept="image/png, image/jpeg, image/jpg, image/gif, image/bmp">
|
||||
</div>-->
|
||||
|
||||
<div id="avatar_div" class="avatar_div">
|
||||
<div id="avatar_div_div" class="avatar">
|
||||
<img id="avatar_load_preview" src="img/fluffy.png" alt="avatar">
|
||||
</div>
|
||||
|
||||
<label for="add_avatar_button" class="add_avatar_button_label" title="Click to select a new avatar for this character">
|
||||
<label for="add_avatar_button" class="menu_button" title="Click to select a new avatar for this character">
|
||||
<input type="file" id="add_avatar_button" name="avatar" accept="image/png, image/jpeg, image/jpg, image/gif, image/bmp">
|
||||
Change Avatar
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<hr>
|
||||
<div id="description_div">
|
||||
<h4>Description</h4><h5>Description of personality and other characteristics <a href="/notes/1" class="notes-link" target="_blank"><span class="note-link-span">?</span></a></h5>
|
||||
<textarea id="description_textarea" name="description" placeholder=""></textarea>
|
||||
@@ -3120,6 +3155,7 @@
|
||||
<textarea id="firstmessage_textarea" name="first_mes" placeholder=""></textarea>
|
||||
</div>
|
||||
|
||||
<!-- these divs are invisible and used for server communication purposes -->
|
||||
<div id="avatar_url_div">
|
||||
<input id="avatar_url_pole" name="avatar_url" class="text_pole" maxlength="999" size="2" value="" autocomplete="off">
|
||||
</div>
|
||||
@@ -3132,73 +3168,96 @@
|
||||
<div id="last_mes_div">
|
||||
<input id="last_mes_pole" name="last_mes" class="text_pole" maxlength="999" size="2" value="" autocomplete="off">
|
||||
</div>
|
||||
<input id="advanced_div" type="button" value="Advanced Edit">
|
||||
<div id="export_character_div">
|
||||
<!-- now back to normal divs for display purposes-->
|
||||
|
||||
<input id="advanced_div" class="menu_button" type="button" value="Advanced Edit">
|
||||
<div id="result_info" style="width: 100px;"> </div>
|
||||
<hr>
|
||||
<div class="form_create_bottom_buttons_block">
|
||||
<div id="rm_button_back" class="menu_button">Go Back</div>
|
||||
<input id="delete_button" class="menu_button" type="button" value="Delete">
|
||||
<input id="export_button" class="menu_button" type="button" value="Export">
|
||||
<input id="create_button" class="menu_button" type="submit" value="Create">
|
||||
|
||||
</div>
|
||||
<div id="create_button_div">
|
||||
<input id="create_button" type="submit" value="Create">
|
||||
</div>
|
||||
|
||||
</form>
|
||||
<div id="delete_button_div">
|
||||
<input id="delete_button" type="submit" value="Delete">
|
||||
<input id="export_button" type="submit" value="Export">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div id="rm_api_block" class="right_menu" >
|
||||
|
||||
<div id="main-API-selector-block">
|
||||
<h3 id="title_api">API</h3>
|
||||
<select id="main_api" >
|
||||
<option value="kobold">KoboldAI</option>
|
||||
<option value="novel">NovelAI</option>
|
||||
</select>
|
||||
<div id="kobold_api" style="position: relative;">
|
||||
<div style="position: absolute; right:188px; top:-34px; opacity:0.20;">
|
||||
</div>
|
||||
|
||||
<div id="respective-settings-block">
|
||||
<div id="kobold_api" style="position: relative;"> <!-- shows the kobold settings -->
|
||||
<div class="API-logo">
|
||||
<a href="https://github.com/KoboldAI/KoboldAI-Client" target="_blank">
|
||||
<img src="img/kobold.png" style="width:40px;height:40px;">
|
||||
</a>
|
||||
</div>
|
||||
<form action="javascript:void(null);" method="post" enctype="multipart/form-data">
|
||||
|
||||
<h4>API url</h4><h5>Example: http://127.0.0.1:5000/api </h5>
|
||||
<input id="api_url_text" name="api_url" class="text_pole" maxlength="500" value="" autocomplete="off">
|
||||
<input id="api_button" type="submit" value="Connect">
|
||||
<input id="api_button" class="menu_button" type="submit" value="Connect">
|
||||
<img id="api_loading" src="img/load.svg" >
|
||||
</form>
|
||||
<div id="online_status2">
|
||||
<div id="online_status_indicator2"></div><div id="online_status_text2">Not connected</div>
|
||||
<div id="online_status_indicator2"></div>
|
||||
<div id="online_status_text2">Not connected</div>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<hr>
|
||||
|
||||
<div id="ai-presets-and-config-block">
|
||||
<h4>Preset settings</h4><h5>Selecting settings <a href="/notes/4" class="notes-link" target="_blank"><span class="note-link-span">?</span></a></h5>
|
||||
<select id="settings_perset">
|
||||
<option value="gui">GUI KoboldAI Settings</option>
|
||||
</select>
|
||||
<div id="range_block">
|
||||
<h4>Temperature </h4><h5 id="temp_counter">select</h5>
|
||||
<input type="range" id="temp" name="volume" min="0.1" max="2.0" step="0.01">
|
||||
<!--<h4>Amount generation </h4><h5 id="amount_gen_counter">select</h5>
|
||||
<input type="range" id="amount_gen" name="volume" min="16" max="512" step="1">-->
|
||||
<h4>Repetition Penalty </h4><h5 id="rep_pen_counter">select</h5>
|
||||
<input type="range" id="rep_pen" name="volume" min="1" max="1.5" step="0.01">
|
||||
<h4>Repetition Penalty Range</h4><h5 id="rep_pen_size_counter">select</h5>
|
||||
<input type="range" id="rep_pen_size" name="volume" min="0" max="2048" step="1">
|
||||
<div class="range-block">
|
||||
<div class="range-block-title"><h4>Temperature </h4></div>
|
||||
<div class="range-block-counter"><h5 id="temp_counter">select</h5></div>
|
||||
<div class="range-block-range" ><input type="range" id="temp" name="volume" min="0.1" max="2.0" step="0.01"></div>
|
||||
</div>
|
||||
<div class="range-block">
|
||||
<div class="range-block-title"><h4>Repetition Penalty </h4></div>
|
||||
<div class="range-block-counter"><h5 id="rep_pen_counter">select</h5></div>
|
||||
<div class="range-block-range" ><input type="range" id="rep_pen" name="volume" min="1" max="1.5" step="0.01"></div>
|
||||
</div>
|
||||
<div class="range-block">
|
||||
<div class="range-block-title"><h4>Repetition Penalty Range</h4></div>
|
||||
<div class="range-block-counter"><h5 id="rep_pen_size_counter">select</h5></div>
|
||||
<div class="range-block-range" ><input type="range" id="rep_pen_size" name="volume" min="0" max="2048" step="1"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div id="novel_api" style="display: none;position: relative;">
|
||||
<div style="position: absolute; right:152px; top:-25px; opacity:0.25;"><a href="https://novelai.net/" target="_blank"><img src="img/novelai.png" style="width:auto;height:22px;"></a></div>
|
||||
<form action="javascript:void(null);" method="post" enctype="multipart/form-data">
|
||||
|
||||
<h4>API key</h4><h5>Where to get <a href="/notes/6" class="notes-link" target="_blank"><span class="note-link-span"><span class="note-link-span">?</span></span></a></h5>
|
||||
<div id="novel_api" style="display: none;position: relative;"> <!-- shows the novel settings -->
|
||||
<div class="API-logo">
|
||||
<a href="https://novelai.net/" target="_blank">
|
||||
<img src="img/novelai.png" style="width:auto;height:22px;">
|
||||
</a>
|
||||
</div>
|
||||
<form action="javascript:void(null);" method="post" enctype="multipart/form-data">
|
||||
<h4>API key</h4>
|
||||
<h5>Where to get <a href="/notes/6" class="notes-link" target="_blank"><span class="note-link-span">?</span></a></h5>
|
||||
<input id="api_key_novel" name="api_key_novel" class="text_pole" maxlength="500" value="" autocomplete="off">
|
||||
<Br>
|
||||
<input id="api_button_novel" type="submit" value="Connect">
|
||||
<input id="api_button_novel" class="menu_button" type="submit" value="Connect">
|
||||
<img id="api_loading_novel" src="img/load.svg" >
|
||||
</form>
|
||||
<div id="online_status3">
|
||||
<div id="online_status_indicator3"></div><div id="online_status_text3">No connection...</div>
|
||||
<div id="online_status_indicator3"></div>
|
||||
<div id="online_status_text3">No connection...</div>
|
||||
</div>
|
||||
<h4>Model</h4><h5>Selecting NovelAI model <a href="/notes/8" class="notes-link" target="_blank"><span class="note-link-span">?</span></a></h5>
|
||||
<h4>Model</h4>
|
||||
<h5>Selecting NovelAI model <a href="/notes/8" class="notes-link" target="_blank"><span class="note-link-span">?</span></a></h5>
|
||||
<select id="model_novel_select" class="option_select_right_menu" style='margin-bottom: 16px;'>
|
||||
<option value="euterpe-v2">Euterpe</option>
|
||||
<option value="krake-v2">Krake</option>
|
||||
@@ -3210,29 +3269,32 @@
|
||||
<div id="range_block_novel">
|
||||
<h4>Temperature </h4><h5 id="temp_counter_novel">select</h5>
|
||||
<input type="range" id="temp_novel" name="volume" min="0.1" max="2.0" step="0.01">
|
||||
<!--<h4>Amount generation </h4><h5 id="amount_gen_counter">select</h5>
|
||||
<input type="range" id="amount_gen" name="volume" min="16" max="512" step="1">-->
|
||||
<h4>Repetition Penalty </h4><h5 id="rep_pen_counter_novel">select</h5>
|
||||
<input type="range" id="rep_pen_novel" name="volume" min="1" max="1.5" step="0.01">
|
||||
<h4>Repetition Penalty Range</h4><h5 id="rep_pen_size_counter_novel">select</h5>
|
||||
<input type="range" id="rep_pen_size_novel" name="volume" min="0" max="2048" step="1">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<hr>
|
||||
|
||||
<h4>Your Avatar</h4><h5></h5>
|
||||
<div id="user-settings-block">
|
||||
<h3>User Settings</h3>
|
||||
<h4>Your Avatar</h4>
|
||||
<div id="user_avatar_block"></div>
|
||||
<form id='form_change_name' action="javascript:void(null);" method="post" enctype="multipart/form-data">
|
||||
<h4>Name</h4>
|
||||
<input id="your_name" name="your_name" class="text_pole" maxlength="35" value="" autocomplete="off">
|
||||
<br>
|
||||
<input id="your_name_button" type="submit" title="Click to set a new User Name (reloads page)" value="Change Name">
|
||||
<input id="your_name_button" class="menu_button" type="submit" title="Click to set a new User Name (reloads page)" value="Change Name">
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<hr>
|
||||
|
||||
<div id="pro-settings-block">
|
||||
<h3>Pro Settings</h3>
|
||||
|
||||
<div id="amount_gen_block">
|
||||
<h4>Amount generation </h4>
|
||||
<h5 id="amount_gen_counter">select</h5>
|
||||
@@ -3243,8 +3305,7 @@
|
||||
<h5 id="max_context_counter">select</h5>
|
||||
<input type="range" id="max_context" name="volume" min="512" max="2048" step="1">
|
||||
</div>
|
||||
|
||||
<h4>Anchors Order</h4>
|
||||
<div id="anchors-block"><h4>Anchors Order</h4>
|
||||
<h5>Helps to increase the length of messages <a href="/notes/9" class="notes-link" target="_blank"><span class="note-link-span">?</span></a></h5>
|
||||
<select id="anchor_order">
|
||||
<option value="0">Character Anchor - Style Anchor</option>
|
||||
@@ -3255,6 +3316,8 @@
|
||||
<input id="style_anchor" type="checkbox"/><h4>Style Anchor</h4>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<hr>
|
||||
|
||||
<div ="power-user-options-block">
|
||||
@@ -3273,14 +3336,16 @@
|
||||
<input id="character_import_file_type" name="file_type" class="text_pole" maxlength="999" size="2" value="" autocomplete="off">
|
||||
</form>
|
||||
</div>
|
||||
<div id="rm_characters_block" class="right_menu">
|
||||
<div id="rm_button_create" class="right_menu_button"><h2>+New Character</h2></div>
|
||||
<div id="character_import_button" class="right_menu_button"><h2>+Import Character</h2></div>
|
||||
|
||||
<div id="characloud_url" title="Find more characters on CharaCloud (coming soon)">
|
||||
|
||||
<div id="rm_characters_block" class="right_menu">
|
||||
<div class="form_create_bottom_buttons_block">
|
||||
<div id="rm_button_create" class="menu_button">+New Character</div>
|
||||
<div id="character_import_button" class="menu_button">+Import Character</div>
|
||||
<div id="characloud_url" class="menu_button" title="Find more characters on CharaCloud (coming soon)">
|
||||
<img src="img/cloud_logo.png">
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div id="rm_print_characters_block"></div>
|
||||
|
||||
</div>
|
||||
@@ -3288,7 +3353,7 @@
|
||||
<div id="rm_info_panel">
|
||||
<div id="rm_info_avatar"></div>
|
||||
<div id="rm_info_text"></div>
|
||||
<div id="rm_info_button">Back</div>
|
||||
<div id="rm_info_button" class="menu_button">Back</div>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
|
445
public/style.css
445
public/style.css
@@ -27,7 +27,6 @@
|
||||
--ivory: rgba(229,224,216,1);
|
||||
}
|
||||
|
||||
|
||||
* {
|
||||
box-sizing: border-box;
|
||||
-webkit-font-smoothing: antialiased;
|
||||
@@ -63,8 +62,8 @@ body {
|
||||
}
|
||||
|
||||
::-webkit-scrollbar-track {
|
||||
background-color: var(--black50a);
|
||||
-webkit-box-shadow: inset 0 0 6px var(--black30a);
|
||||
/*background-color: var(--black50a);*/
|
||||
/*-webkit-box-shadow: inset 0 0 6px var(--black30a);*/
|
||||
-webkit-border-radius: 10px;
|
||||
border-radius: 10px;
|
||||
}
|
||||
@@ -82,32 +81,12 @@ body {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
.mes_text i {
|
||||
color: var(--grey70);
|
||||
}
|
||||
.mes_text em {
|
||||
color: var(--grey70);
|
||||
}
|
||||
.mes_text p {
|
||||
margin-top:0;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
.mes_text strong {
|
||||
font-weight: bold;
|
||||
|
||||
}
|
||||
.mes_text h2 {
|
||||
font-weight: bold;
|
||||
|
||||
}
|
||||
.mes_text h1 {
|
||||
font-weight: bold;
|
||||
|
||||
}
|
||||
|
||||
/*.mes_text br {display:none;}*/
|
||||
.mes_text i, .mes_text em {color: var(--grey70);}
|
||||
.mes_text strong, .mes_text h2, .mes_text h1 {font-weight: bold;}
|
||||
|
||||
code {
|
||||
padding: 5px;
|
||||
@@ -259,8 +238,6 @@ code {
|
||||
cursor: pointer;
|
||||
font-size: 1rem;
|
||||
line-height: 1rem;
|
||||
/*height: 40px;*/
|
||||
/*width: 40px;*/
|
||||
z-index: 2001;
|
||||
-webkit-transition: color .25s ease-in-out;
|
||||
-moz-transition: color .25s ease-in-out;
|
||||
@@ -411,12 +388,11 @@ width: 100%;
|
||||
border: 1px solid var(--white30a);
|
||||
border-radius: 10px;
|
||||
box-shadow: 0 0 2px var(--black50a);
|
||||
padding: 10px;
|
||||
color: var(--white70a);
|
||||
font-size: 15px;
|
||||
font-family: "Noto Sans", "Noto Color Emoji", sans-serif;
|
||||
margin-left: 10px;
|
||||
margin-top: 10px;
|
||||
padding-left: 10px;
|
||||
padding-top: 10px;
|
||||
}
|
||||
|
||||
#send_textarea{
|
||||
@@ -444,31 +420,31 @@ width: 100%;
|
||||
}
|
||||
|
||||
#description_textarea{
|
||||
width: 92%;
|
||||
|
||||
height: 200px;
|
||||
margin-top:0;
|
||||
|
||||
}
|
||||
|
||||
#character_name_pole{
|
||||
|
||||
width: 92%;
|
||||
|
||||
}
|
||||
#firstmessage_textarea{
|
||||
width: 92%;
|
||||
|
||||
height: 140px;
|
||||
margin-top:0;
|
||||
}
|
||||
|
||||
.text_pole{
|
||||
border:1px solid var(--white30a);
|
||||
border-radius:15px;
|
||||
background-color: var(--black30a);
|
||||
color: var(--white70a);
|
||||
border:1px solid var(--white30a);
|
||||
border-radius:10px;
|
||||
font-family: "Noto Sans", "Noto Color Emoji", sans-serif;
|
||||
font-size: 11pt;
|
||||
font-size: 15px;
|
||||
padding: 7px;
|
||||
width:90%;
|
||||
margin: 5px;
|
||||
width:100%;
|
||||
margin: 5px 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -478,22 +454,16 @@ width: 100%;
|
||||
}
|
||||
.right_menu h3 {
|
||||
margin:0;
|
||||
padding:0;
|
||||
margin-left: 10px;
|
||||
margin-bottom: 10px;
|
||||
padding:10px 0;
|
||||
}
|
||||
.right_menu h4 {
|
||||
margin:0;
|
||||
padding:0;
|
||||
margin-left: 10px;
|
||||
margin-bottom: 1px;
|
||||
padding:5px 0;
|
||||
}
|
||||
.right_menu h5 {
|
||||
color: var(--white50a);
|
||||
margin:0;
|
||||
padding:0;
|
||||
margin-left: 10px;
|
||||
margin-bottom: 5px;
|
||||
padding:5px 0;
|
||||
font-size:0.75rem;
|
||||
}
|
||||
|
||||
@@ -502,13 +472,6 @@ input:focus, textarea:focus, select:focus{
|
||||
}
|
||||
|
||||
input::file-selector-button {
|
||||
font-weight: bold;
|
||||
color: var(--white100);
|
||||
padding: 0.5em;
|
||||
border: 1px solid var(--white50a);
|
||||
border-radius: 3px;
|
||||
background-color: var(--black30a);
|
||||
cursor: pointer;
|
||||
|
||||
}
|
||||
|
||||
@@ -517,13 +480,6 @@ input[type="file"] {
|
||||
}
|
||||
|
||||
input[type=submit] {
|
||||
font-weight: bold;
|
||||
font-size:1rem;
|
||||
color: var(--white100);
|
||||
padding: 0.5em;
|
||||
border: 1px solid var(--white30a);
|
||||
border-radius: 5px;
|
||||
background-color: var(--black50a);
|
||||
}
|
||||
|
||||
#right-nav-panel-tabs{
|
||||
@@ -534,6 +490,10 @@ input[type=submit] {
|
||||
margin-right:30px;
|
||||
}
|
||||
|
||||
/* ##################################################################### */
|
||||
/* Right Panel's Upper Tabs */
|
||||
/* ##################################################################### */
|
||||
|
||||
.right_menu_button{
|
||||
display:inline-block;
|
||||
cursor:pointer;
|
||||
@@ -560,9 +520,6 @@ input[type=submit] {
|
||||
}
|
||||
|
||||
#rm_button_panel_pin {
|
||||
/*position: absolute;
|
||||
right: 13px;
|
||||
top: 12px;*/
|
||||
padding:0;
|
||||
margin:0;
|
||||
cursor: pointer;
|
||||
@@ -601,58 +558,14 @@ input[type=submit] {
|
||||
}
|
||||
|
||||
|
||||
#character_import_button{
|
||||
cursor: pointer;
|
||||
display: inline-block;
|
||||
|
||||
/*margin-left: 15px;/* 274px; */
|
||||
/*margin-top: 6px;/* 10px; */
|
||||
|
||||
}
|
||||
#character_import_button h2{
|
||||
margin-top: auto;
|
||||
margin-bottom: auto;
|
||||
font-size: 15px;
|
||||
color: var(--white70a);
|
||||
border: 1px solid var(--white30a);
|
||||
background-color: var(--black30a);
|
||||
padding:5px;
|
||||
border-radius: 10px;
|
||||
}
|
||||
|
||||
#rm_button_create h2{
|
||||
margin-top: auto;
|
||||
margin-bottom: auto;
|
||||
font-size: 15px;
|
||||
color: var(--white70a);
|
||||
border: 1px solid var(--white30a);
|
||||
background-color: var(--black30a);
|
||||
padding:5px;
|
||||
border-radius: 10px;
|
||||
}
|
||||
/* ####################################################################### */
|
||||
|
||||
#characloud_url{
|
||||
margin-right: 0px;
|
||||
margin-top: 0;
|
||||
float: right;
|
||||
cursor: pointer;
|
||||
border: 1px solid var(--white30a);
|
||||
background-color: var(--black30a);
|
||||
border-radius: 10px;
|
||||
padding: 5px;
|
||||
opacity: 0.5;
|
||||
opacity: 0.3;
|
||||
}
|
||||
|
||||
#characloud_url img {
|
||||
width: 25px;
|
||||
height: auto;
|
||||
display:inline-block;
|
||||
opacity:0.7;
|
||||
}
|
||||
|
||||
#characloud_url div {
|
||||
vertical-align: top;
|
||||
display:inline-block;
|
||||
}
|
||||
|
||||
#rm_print_characters_block {
|
||||
@@ -661,9 +574,6 @@ margin-right: 0px;
|
||||
overflow-y: auto;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
#rm_ch_create_block{
|
||||
display: none;
|
||||
overflow-y: auto;
|
||||
@@ -673,6 +583,16 @@ margin-right: 0px;
|
||||
/* CUSTOMIZE THE DROPDOWN SELECT COLORS FOR RIGHT MENU
|
||||
/*#################################################################*/
|
||||
|
||||
select {
|
||||
color: var(--white70a);
|
||||
padding: 7px;
|
||||
background-color: var(--black30a);
|
||||
font-size: 15px;
|
||||
border: 1px solid var(--white30a);
|
||||
border-radius:10px;
|
||||
width:100%;
|
||||
}
|
||||
|
||||
select option { /* works to highlight selected/active option */
|
||||
background-color: var(--white50a);
|
||||
color: var(--black70a);
|
||||
@@ -687,25 +607,25 @@ select option:not(:checked) { /* works to color unselected items */
|
||||
/*#######################################################################*/
|
||||
|
||||
#rm_api_block{
|
||||
display: none;
|
||||
display: none;
|
||||
padding-bottom: 5px;
|
||||
overflow-y: auto;
|
||||
grid-template-rows: auto;
|
||||
grid-gap: 10px;
|
||||
}
|
||||
|
||||
.API-logo{
|
||||
margin: 0 auto;
|
||||
width: min-content;
|
||||
opacity: 0.5;
|
||||
}
|
||||
|
||||
#api_url_text{
|
||||
/*margin-right: 4px;*/
|
||||
display:block;
|
||||
}
|
||||
#api_button, #api_button_novel {
|
||||
cursor: pointer;
|
||||
color: var(--white100);
|
||||
opacity:0.7;
|
||||
padding: 10px;
|
||||
margin-left: 10px;
|
||||
margin-top: 10px;
|
||||
margin: 10px;
|
||||
font-size: 1rem;
|
||||
height: 2.5rem;
|
||||
transition: 0.3s;
|
||||
|
||||
}
|
||||
|
||||
#api_button:hover, #api_button_novel:hover{background-color:green;}
|
||||
@@ -894,41 +814,24 @@ width: 103px;
|
||||
display: grid;
|
||||
grid-template-columns: min-content min-content;
|
||||
align-items:center;
|
||||
grid-gap:10px;
|
||||
}
|
||||
.avatar_div .avatar{
|
||||
margin-left: 4px;
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
.add_avatar_button_label{
|
||||
display: inline-block;
|
||||
margin-left: 15px;
|
||||
color: var(--white70a);
|
||||
background-color: var(--black30a);
|
||||
border: 1px solid var(--white50a);
|
||||
padding: 5px;
|
||||
border-radius: 5px;
|
||||
cursor: pointer;
|
||||
height: min-content;
|
||||
}
|
||||
#description_div{
|
||||
margin-top: 6px;
|
||||
#first_message_div{}
|
||||
|
||||
}
|
||||
#first_message_div{
|
||||
margin-top: 20px;
|
||||
}
|
||||
#advanced_div{
|
||||
margin-top: 20px;
|
||||
cursor: pointer;
|
||||
}
|
||||
#create_button{
|
||||
opacity: 0.8;
|
||||
margin-left: 9px;
|
||||
margin-top: 8px;
|
||||
margin-bottom: 10px;
|
||||
font-size: 14px;
|
||||
cursor: pointer;
|
||||
#advanced_div{width:100%;}
|
||||
|
||||
.form_create_bottom_buttons_block{
|
||||
display: grid;
|
||||
width: min-content;
|
||||
grid-template-columns: repeat(3, min-content);
|
||||
grid-gap: 20px;
|
||||
align-items: center;
|
||||
margin: 0px auto;
|
||||
}
|
||||
|
||||
#rm_info_block{
|
||||
@@ -945,14 +848,8 @@ width: 103px;
|
||||
text-align: center;
|
||||
}
|
||||
#rm_info_button{
|
||||
width: 100px;
|
||||
margin-top: 10px;
|
||||
font-size: 20px;
|
||||
display: block;
|
||||
cursor: pointer;
|
||||
text-align: center;
|
||||
margin-left: auto;
|
||||
margin-right: auto;
|
||||
width: min-content;
|
||||
margin: 0 auto;
|
||||
}
|
||||
#rm_info_avatar{
|
||||
width: 69px;
|
||||
@@ -960,34 +857,14 @@ width: 103px;
|
||||
margin-left: auto;
|
||||
margin-right: auto;
|
||||
}
|
||||
#delete_button{
|
||||
opacity: 0.7;
|
||||
cursor: pointer;
|
||||
display: block;
|
||||
float: right;
|
||||
margin-top: 25px;
|
||||
margin-right: 25px;
|
||||
margin-bottom: 30px;
|
||||
color: var(--white100);
|
||||
background-color: var(--crimson70a);
|
||||
font-size: 1rem;
|
||||
}
|
||||
#export_button{
|
||||
opacity: 0.7;
|
||||
cursor: pointer;
|
||||
margin-top: 25px;
|
||||
margin-left: 10px;
|
||||
margin-bottom:30px;
|
||||
color: var(--white100);
|
||||
font-size: 1rem;
|
||||
}
|
||||
#delete_button{background-color: var(--crimson70a);}
|
||||
|
||||
#result_info{
|
||||
margin-left: 10px;
|
||||
color: var(--white30a);
|
||||
}
|
||||
|
||||
.input-file {
|
||||
|
||||
display: block;
|
||||
}
|
||||
|
||||
@@ -1018,7 +895,6 @@ width: 103px;
|
||||
#dialogue_popup{
|
||||
|
||||
width:300px;
|
||||
height: 150px;
|
||||
position: absolute;
|
||||
z-index: 2060;
|
||||
margin-left: auto;
|
||||
@@ -1063,14 +939,24 @@ width: 103px;
|
||||
}
|
||||
.menu_button{
|
||||
font-weight: bold;
|
||||
color: var(--white100);
|
||||
padding: 5px;
|
||||
border: 1px solid var(--black50a);
|
||||
border-radius: 3px;
|
||||
color: var(--white70);
|
||||
background-color: var(--black50a);
|
||||
border: 1px solid var(--white30a);
|
||||
border-radius: 10px;
|
||||
padding: 10px;
|
||||
width: min-content;
|
||||
cursor: pointer;
|
||||
margin:10px 0;
|
||||
transition: 0.3s;
|
||||
font-size:15px;
|
||||
}
|
||||
|
||||
.menu_button:hover{
|
||||
background-color: var(--white30a);
|
||||
}
|
||||
|
||||
|
||||
#dialogue_del_mes .menu_button{
|
||||
font-weight: bold;
|
||||
font-size: 1.25rem;
|
||||
margin-left: 25px;
|
||||
margin-right: 25px;
|
||||
@@ -1108,7 +994,7 @@ width: 103px;
|
||||
#online_status2{
|
||||
opacity: 0.5;
|
||||
margin-top: 2px;
|
||||
margin-left: 10px;
|
||||
|
||||
margin-bottom: 30px;
|
||||
}
|
||||
#online_status_indicator2{
|
||||
@@ -1125,7 +1011,7 @@ width: 103px;
|
||||
#online_status3{
|
||||
opacity: 0.5;
|
||||
margin-top: 2px;
|
||||
margin-left: 10px;
|
||||
|
||||
margin-bottom: 30px;
|
||||
}
|
||||
#online_status_indicator3{
|
||||
@@ -1175,8 +1061,6 @@ input[type='checkbox']:not(#nav-toggle):not(#rm_button_panel_pin) {
|
||||
background-color: white;
|
||||
box-shadow: inset 0 0 3px 0 var(--black70a);
|
||||
cursor: pointer;
|
||||
/*margin-top: 18px; /*odd but this is what aligns it with the character avatar*/
|
||||
/*right: 5px; /*and centers it in the checkbox column*/
|
||||
}
|
||||
|
||||
/* the checkbox starts with a size 0 background of a checkmark */
|
||||
@@ -1207,45 +1091,20 @@ input[type='checkbox']:not(#nav-toggle):not(#rm_button_panel_pin):checked::after
|
||||
}
|
||||
/*---------------------------------------------------------------------------------------------------------*/
|
||||
|
||||
select {
|
||||
color: var(--white70a);
|
||||
padding: 5px 10px;
|
||||
width:95%;
|
||||
height: 34px;
|
||||
margin-left: 3px;
|
||||
background-color: var(--black30a);
|
||||
font-size: 15px;
|
||||
border: 1px solid var(--white30a);
|
||||
border-radius:10px;
|
||||
margin-top: 5px;
|
||||
margin-bottom: 45px;
|
||||
}
|
||||
#title_api{
|
||||
margin-left: 3px;
|
||||
}
|
||||
#settings_perset{
|
||||
width:284px;
|
||||
margin-left: 10px;
|
||||
margin-bottom: 35px;
|
||||
color: var(--white70a);
|
||||
border-radius:10px;
|
||||
background-color: var(--black30a);
|
||||
box-shadow:none;
|
||||
|
||||
}
|
||||
|
||||
.option_select_right_menu{
|
||||
width:284px;
|
||||
margin-left: 10px;
|
||||
margin-bottom: 35px;
|
||||
color: var(--white70a);
|
||||
box-shadow: 0 0 2px var(--black50a);
|
||||
background-color: var(--black30a);
|
||||
}
|
||||
#user_avatar_block{
|
||||
margin-left: 6px;
|
||||
display: grid;
|
||||
grid-gap: 10px;
|
||||
margin-top: 10px;
|
||||
grid-template-columns: repeat( auto-fit, minmax(60px, 1fr) );
|
||||
grid-template-rows: min-content;
|
||||
}
|
||||
@@ -1258,39 +1117,19 @@ select {
|
||||
width: 60px;
|
||||
height: 60px;
|
||||
}
|
||||
#temp{
|
||||
margin-left: 10px;
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
#temp_counter{
|
||||
margin-bottom:0;
|
||||
}
|
||||
#amount_gen{
|
||||
margin-left: 10px;
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
#amount_gen_counter{
|
||||
margin-bottom:0;
|
||||
}
|
||||
#max_context{
|
||||
margin-left: 10px;
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
#max_context_counter{
|
||||
margin-bottom:0;
|
||||
}
|
||||
#range_block input{
|
||||
margin-left: 10px;
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
#range_block_novel input{
|
||||
margin-left: 10px;
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
/* range sliders */
|
||||
|
||||
#range_block, #range_block_novel {margin-top: 10px;}
|
||||
#range_block input, #range_block_novel input{margin-bottom: 20px;}
|
||||
#temp, #amount_gen, #max_context {margin-bottom: 20px;}
|
||||
#temp_counter, #amount_gen_counter, #max_context_counter {margin-bottom:0;}
|
||||
.range-block-counter {width: min-content; margin:0 auto;}
|
||||
.range-block-range{margin: 0 auto; width: 100%;}
|
||||
|
||||
input[type="range"] {
|
||||
-webkit-appearance: none;
|
||||
margin-right: 15px;
|
||||
width: 200px;
|
||||
margin: 0 auto;
|
||||
width: 100%;
|
||||
height: 7px;
|
||||
background: var(--white50a);
|
||||
border-radius: 15px;
|
||||
@@ -1338,6 +1177,7 @@ input[type="range"] {
|
||||
backdrop-filter: blur(10px) brightness(0.3);
|
||||
-webkit-backdrop-filter: blur(10px) brightness(0.3);
|
||||
border-radius: 10px;
|
||||
padding-top: 30px;
|
||||
}
|
||||
#shadow_tips_popup{
|
||||
display: none;
|
||||
@@ -1399,46 +1239,21 @@ input[type="range"] {
|
||||
line-height:1.25rem;
|
||||
}
|
||||
|
||||
#your_name_button {
|
||||
cursor: pointer;
|
||||
color: var(--white100);
|
||||
opacity: 0.7;
|
||||
padding: 10px;
|
||||
margin: 10px;
|
||||
font-size: 1rem;
|
||||
height: 2.5rem;
|
||||
transition: 0.3s;
|
||||
}
|
||||
|
||||
#your_name_button:hover{background-color:green;}
|
||||
|
||||
#form_change_name{
|
||||
margin-bottom: 15px;
|
||||
}
|
||||
|
||||
#anchor_order{
|
||||
width:284px;
|
||||
margin-left: 10px;
|
||||
|
||||
margin-bottom: 15px;
|
||||
color: var(--white70a);
|
||||
background-color: var(--black50a);
|
||||
}
|
||||
#anchor_checkbox{
|
||||
margin-left: 10px;
|
||||
align-items: center;
|
||||
text-align: left;
|
||||
display: grid;
|
||||
grid-template-rows: 30px auto;
|
||||
grid-template-columns: 30px auto;
|
||||
}
|
||||
#anchor_checkbox, #power-user-option-checkboxes{
|
||||
|
||||
#power-user-option-checkboxes {
|
||||
margin-left: 10px;
|
||||
align-items: center;
|
||||
text-align: left;
|
||||
display: grid;
|
||||
grid-template-rows: 30px auto;
|
||||
grid-template-columns: 30px auto;
|
||||
grid-gap:5px;
|
||||
}
|
||||
|
||||
#shadow_character_popup{
|
||||
@@ -1567,18 +1382,10 @@ input[type="range"] {
|
||||
margin-top: 6vh;
|
||||
box-shadow: 0 0 10px var(--black50a);
|
||||
padding: 10px;
|
||||
/* padding-top: 50px; */
|
||||
|
||||
background-color: var(--black70a);
|
||||
border-radius: 20px;
|
||||
overflow-y: scroll;
|
||||
}
|
||||
/*#select_chat_popup a, #chat_import_button a{
|
||||
color: var(--sienna);
|
||||
}
|
||||
#select_chat_popup a:hover, #chat_import_button a:hover {
|
||||
color: var(--orangered);
|
||||
}*/
|
||||
|
||||
#export_div{
|
||||
cursor:pointer;
|
||||
@@ -1614,18 +1421,12 @@ input[type="range"] {
|
||||
margin-top: 15px;
|
||||
}
|
||||
|
||||
#chat_import_button{
|
||||
margin-top: 0;
|
||||
margin-left: 0;
|
||||
cursor:pointer;
|
||||
}
|
||||
|
||||
.select_chat_block{
|
||||
border-radius: 5px;
|
||||
margin-right: 10px;
|
||||
margin-bottom: 10px;
|
||||
border: 1px solid var(--white30a);
|
||||
padding: 5px;
|
||||
padding: 10px;
|
||||
display: grid;
|
||||
grid-template-columns: min-content auto;
|
||||
grid-template-rows: auto auto;
|
||||
@@ -1656,31 +1457,11 @@ border-radius: 5px;
|
||||
width:30px;*/
|
||||
}
|
||||
|
||||
#advanced_div{
|
||||
font-size: 1rem;
|
||||
background-repeat: no-repeat;
|
||||
background-size: 28px;
|
||||
background-position: 92px 5px;
|
||||
width: 92%;
|
||||
height: 40px;
|
||||
margin-left: 10px;
|
||||
font-weight: bold;
|
||||
color: var(--white100);
|
||||
padding: 0.5em;
|
||||
border: thin solid var(--white30a);
|
||||
border-radius: 3px;
|
||||
background-color: var(--black30a);
|
||||
opacity: 0.7;
|
||||
}
|
||||
#advanced_book_logo{
|
||||
width: 35px;
|
||||
height: 35px;
|
||||
display: inline-block;
|
||||
}
|
||||
#character_popup_text_h3{
|
||||
display: inline-block;
|
||||
margin-left: 38px;
|
||||
}
|
||||
|
||||
#export_character_div{
|
||||
display: grid;
|
||||
@@ -1696,7 +1477,7 @@ p {
|
||||
}
|
||||
|
||||
hr {
|
||||
margin: 22px 0;
|
||||
margin: 10px 0;
|
||||
height: 1px;
|
||||
border: 0;
|
||||
}
|
||||
@@ -1726,39 +1507,7 @@ a {
|
||||
color: orange;
|
||||
text-decoration: none;
|
||||
}
|
||||
.btn {
|
||||
-webkit-border-radius: 10em;
|
||||
-moz-border-radius: 10em;
|
||||
-ms-border-radius: 10em;
|
||||
-o-border-radius: 10em;
|
||||
border-radius: 10em;
|
||||
border: 0;
|
||||
color: var(--white100);
|
||||
margin: 6px;
|
||||
white-space: normal;
|
||||
word-wrap: break-word;
|
||||
display: inline-block;
|
||||
line-height: 1.25;
|
||||
text-align: center;
|
||||
vertical-align: middle;
|
||||
cursor: pointer;
|
||||
-webkit-user-select: none;
|
||||
-moz-user-select: none;
|
||||
-ms-user-select: none;
|
||||
user-select: none;
|
||||
padding: .5rem 1rem;
|
||||
font-size: 1rem;
|
||||
font-weight: 400;
|
||||
box-shadow: 0 2px 5px 0 var(--transparent),0 2px 10px 0 var(--black30a);
|
||||
}
|
||||
.btn {
|
||||
|
||||
transition: box-shadow .2s ease-out;
|
||||
}
|
||||
.btn:hover {
|
||||
|
||||
box-shadow: 0 5px 11px 0 var(--transparent),0 4px 15px 0 var(--black30a);
|
||||
}
|
||||
|
||||
/* ############################################################# */
|
||||
/* Right nav panel and nav-toggle */
|
||||
@@ -1832,12 +1581,10 @@ a {
|
||||
font-size: 2em;
|
||||
}
|
||||
|
||||
/* this affects the #right-nav-panel div ONLY WHEN the nav-toggle checkbox is checked*/
|
||||
/* the #right-nav-panel is moved to the right edge of the screen*/
|
||||
/* this is what causes the panel movement */
|
||||
|
||||
#nav-toggle:checked ~ #right-nav-panel{
|
||||
right:0;
|
||||
box-shadow: -5px 0 10px 0 var(--black50a);
|
||||
overflow-y: auto;
|
||||
border-left: 1px solid var(--white30a);
|
||||
}
|
12
server.js
12
server.js
@@ -423,22 +423,24 @@ function charaFormatData(data){
|
||||
}
|
||||
app.post("/createcharacter", urlencodedParser, function(request, response){
|
||||
|
||||
|
||||
|
||||
//var sameNameChar = fs.existsSync(charactersPath+request.body.ch_name+'.png');
|
||||
//if (sameNameChar == true) return response.sendStatus(500);
|
||||
if(!request.body) return response.sendStatus(400);
|
||||
console.log('/createcharacter -- looking for -- '+(charactersPath+request.body.ch_name+'.png'));
|
||||
console.log('Does this file already exists? '+fs.existsSync(charactersPath+request.body.ch_name+'.png'));
|
||||
if (!fs.existsSync(charactersPath+request.body.ch_name+'.png')){
|
||||
if(!fs.existsSync(chatsPath+request.body.ch_name) )fs.mkdirSync(chatsPath+request.body.ch_name);
|
||||
|
||||
let filedata = request.file;
|
||||
//console.log(filedata.mimetype);
|
||||
var fileType = ".png";
|
||||
var img_file = "ai";
|
||||
var img_path = "public/img/";
|
||||
|
||||
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": 'none', "chat": Date.now(), "last_mes": '', "mes_example": ''};
|
||||
char = JSON.stringify(char);
|
||||
if(!filedata){
|
||||
|
||||
charaWrite('./public/img/fluffy.png', char, request.body.ch_name, response);
|
||||
|
||||
}else{
|
||||
|
||||
img_path = "./uploads/";
|
||||
@@ -452,7 +454,9 @@ app.post("/createcharacter", urlencodedParser, function(request, response){
|
||||
//console.log("The file was saved.");
|
||||
|
||||
}else{
|
||||
console.error("Error: Cannot save file. A character with that name already exists.");
|
||||
response.send("Error: A character with that name already exists.");
|
||||
//response.send({error: true});
|
||||
}
|
||||
//console.log(request.body);
|
||||
//response.send(request.body.ch_name);
|
||||
|
Reference in New Issue
Block a user