This commit is contained in:
SillyLossy
2023-04-20 20:27:48 +03:00
5 changed files with 60 additions and 37 deletions

View File

@@ -94,7 +94,7 @@ function waitForElement(querySelector, timeout) {
}
waitForElement("#expression-image", 10000).then(function () {
console.log("expression image loaded, now draggable.");
dragElement(document.getElementById("expression-holder"));
}).catch(() => {
console.log("expression holder not loaded yet");
@@ -591,13 +591,10 @@ $("document").ready(function () {
var chatbarInFocus = false;
$('#send_textarea').focus(function () {
chatbarInFocus = true;
console.log("chatbatInfocus =" + chatbarInFocus);
});
$('#send_textarea').blur(function () {
chatbarInFocus = false;
console.log("chatbatInfocus =" + chatbarInFocus);
});
@@ -677,28 +674,11 @@ $("document").ready(function () {
if (event.ctrlKey && event.key == "Enter") {
// Ctrl+Enter for Regeneration Last Response
if (is_send_press == false) {
$('#option_regenerate').click();
$('#options').hide();
//setTimeout(function () { $('#chat').click(); }, 50) //needed to remove the options menu popping up..
//Generate("regenerate");
}
}
/* if (event.ctrlKey && event.key == "ArrowUp") {
//Ctrl+UpArrow for Connect to last server
console.log(main_api);
if (online_status === "no_connection") {
if (main_api == "kobold") {
document.getElementById("api_button").click();
}
if (main_api == "novel") {
document.getElementById("api_button_novel").click();
}
if (main_api == "textgenerationwebui") {
document.getElementById("api_button_textgenerationwebui").click();
}
}
} */
if (event.ctrlKey && event.key == "ArrowLeft") { //for debug, show all local stored vars
CheckLocal();
}

View File

@@ -260,12 +260,12 @@ async function getExpressionsList() {
console.log('getting expressions list');
// get something for offline mode (default images)
if (!modules.includes('classify')) {
console.log('classify not available, loading default');
return DEFAULT_EXPRESSIONS;
}
if (Array.isArray(expressionsList)) {
console.log('got array, loading array');
return expressionsList;
}
@@ -273,21 +273,21 @@ async function getExpressionsList() {
url.pathname = '/api/classify/labels';
try {
console.log('trying for API');
const apiResult = await fetch(url, {
method: 'GET',
headers: { 'Bypass-Tunnel-Reminder': 'bypass' },
});
if (apiResult.ok) {
console.log('API ok, adding labels');
const data = await apiResult.json();
expressionsList = data.labels;
return expressionsList;
}
}
catch (error) {
console.log('got error!');
console.log(error);
return [];
}
@@ -313,7 +313,7 @@ async function setExpression(character, expression, force) {
});
} else {
if (extension_settings.expressions.showDefault) {
console.log('no character images, trying default expressions');
setDefault();
}
}
@@ -344,7 +344,7 @@ function onClickExpressionImage() {
(function () {
function addExpressionImage() {
console.log('entered addExpressionImage');
const html = `
<div id="expression-holder" class="expression-holder" style="display:none;">
<div id="expression-holderheader" class="fa-solid fa-grip drag-grabber"></div>
@@ -353,7 +353,7 @@ function onClickExpressionImage() {
$('body').append(html);
}
function addSettings() {
console.log('entered addSettings');
const html = `
<div class="expression_settings">
<div class="inline-drawer">

View File

@@ -59,6 +59,7 @@ let power_user = {
sheld_width: sheld_width.DEFAULT,
play_message_sound: false,
play_sound_unfocused: true,
auto_save_msg_edits: false,
sort_field: 'name',
sort_order: 'asc',
font_scale: 1,
@@ -307,6 +308,7 @@ function loadPowerUserSettings(settings, data) {
$("#multigen_next_chunks").val(power_user.multigen_next_chunks);
$("#play_message_sound").prop("checked", power_user.play_message_sound);
$("#play_sound_unfocused").prop("checked", power_user.play_sound_unfocused);
$("#auto_save_msg_edits").prop("checked", power_user.auto_save_msg_edits);
$(`input[name="avatar_style"][value="${power_user.avatar_style}"]`).prop("checked", true);
$(`input[name="chat_display"][value="${power_user.chat_display}"]`).prop("checked", true);
$(`input[name="sheld_width"][value="${power_user.sheld_width}"]`).prop("checked", true);
@@ -573,6 +575,11 @@ $(document).ready(() => {
saveSettingsDebounced();
});
$("#auto_save_msg_edits").on('input', function () {
power_user.auto_save_msg_edits = !!$(this).prop('checked');
saveSettingsDebounced();
});
$("#character_sort_order").on('change', function () {
power_user.sort_field = $(this).find(":selected").data('field');
power_user.sort_order = $(this).find(":selected").data('order');