Hide extension settings to drawers

This commit is contained in:
SillyLossy
2023-04-14 14:44:39 +03:00
parent 2bc63ec839
commit c126f15291
5 changed files with 59 additions and 34 deletions

View File

@ -194,19 +194,20 @@ async function getExpressionsList() {
async function setExpression(character, expression, force) { async function setExpression(character, expression, force) {
const filename = `${expression}.png`; const filename = `${expression}.png`;
const debugImageStatus = document.querySelector(`#image_list div[id="${filename}"] span`); const debugImageStatus = document.querySelector(`#image_list div[id="${filename}"] span`);
const img = $('img.expression');
if (force || (debugImageStatus && !debugImageStatus.classList.contains('failure'))) { if (force || (debugImageStatus && !debugImageStatus.classList.contains('failure'))) {
//console.log('setting expression from character images folder'); //console.log('setting expression from character images folder');
const imgUrl = `/characters/${character}/${filename}`; const imgUrl = `/characters/${character}/${filename}`;
$('img.expression').prop('src', imgUrl); img.attr('src', imgUrl);
$('img.expression').removeClass('default'); img.removeClass('default');
} else { } else {
if (extension_settings.expressions.showDefault) { if (extension_settings.expressions.showDefault) {
//console.log('no character images, trying default expressions'); //console.log('no character images, trying default expressions');
const defImgUrl = `/img/default-expressions/${filename}`; const defImgUrl = `/img/default-expressions/${filename}`;
//console.log(defImgUrl); //console.log(defImgUrl);
$('img.expression').prop('src', defImgUrl); img.attr('src', defImgUrl);
$('img.expression').addClass('default'); img.addClass('default');
} }
} }
} }
@ -233,19 +234,18 @@ function onClickExpressionImage() {
function addSettings() { function addSettings() {
const html = ` const html = `
<div class="expression_settings"> <div class="expression_settings">
<h4>Expression images</h4>
<div class="inline-drawer"> <div class="inline-drawer">
<div class="inline-drawer-toggle inline-drawer-header"> <div class="inline-drawer-toggle inline-drawer-header">
<b>View supported images</b> <b>Expression images</b>
<div class="inline-drawer-icon fa-solid fa-circle-chevron-down down"></div> <div class="inline-drawer-icon fa-solid fa-circle-chevron-down down"></div>
</div> </div>
<div class="inline-drawer-content"> <div class="inline-drawer-content">
<p class="offline_mode">You are in offline mode. Click on the image below to set the expression.</p> <p class="offline_mode">You are in offline mode. Click on the image below to set the expression.</p>
<div id="image_list"></div> <div id="image_list"></div>
<p class="hint"><b>Hint:</b> <i>Create new folder in the <b>public/characters/</b> folder and name it as the name of the character. Put PNG images with expressions there.</i></p> <p class="hint"><b>Hint:</b> <i>Create new folder in the <b>public/characters/</b> folder and name it as the name of the character. Put PNG images with expressions there.</i></p>
</div> <label for="expressions_show_default"><input id="expressions_show_default" type="checkbox">Show default images (emojis) if missing</label>
</div>
</div> </div>
<label for="expressions_show_default"><input id="expressions_show_default" type="checkbox">Show default images (emojis) if missing</label>
</div> </div>
`; `;
$('#extensions_settings').append(html); $('#extensions_settings').append(html);

View File

@ -98,24 +98,32 @@ async function moduleWorker() {
(function () { (function () {
function addExtensionsSettings() { function addExtensionsSettings() {
const settingsHtml = ` const settingsHtml = `
<h4>Author's Note / Character Bias</h4>
<div class="floating_prompt_settings"> <div class="floating_prompt_settings">
<label for="extension_floating_prompt">Append the following text:</label> <div class="inline-drawer">
<textarea id="extension_floating_prompt" class="text_pole" rows="8"></textarea> <div class="inline-drawer-toggle inline-drawer-header">
<label> <b>Author's Note / Character Bias</b>
<input type="radio" name="extension_floating_position" value="0" /> <div class="inline-drawer-icon fa-solid fa-circle-chevron-down down"></div>
After scenario </div>
</label> <div class="inline-drawer-content">
<label> <label for="extension_floating_prompt">Append the following text:</label>
<input type="radio" name="extension_floating_position" value="1" /> <textarea id="extension_floating_prompt" class="text_pole" rows="8"></textarea>
In-chat <div class="floating_prompt_radio_group">
</label> <label>
<label for="extension_floating_interval">Every N messages <b>you</b> send (set to 0 to disable):</label> <input type="radio" name="extension_floating_position" value="0" />
<input id="extension_floating_interval" class="text_pole" type="number" min="0" max="999" /> After scenario
<label for="extension_floating_interval">Insertion depth (for in-chat positioning):</label> </label>
<input id="extension_floating_depth" class="text_pole" type="number" min="0" max="99" /> <label>
<span>Appending to the prompt in next: <span id="extension_floating_counter">No</span> message(s)</span> <input type="radio" name="extension_floating_position" value="1" />
<br> In-chat
</label>
</div>
<label for="extension_floating_interval">Every N messages <b>you</b> send (set to 0 to disable):</label>
<input id="extension_floating_interval" class="text_pole" type="number" min="0" max="999" />
<label for="extension_floating_interval">Insertion depth (for in-chat positioning):</label>
<input id="extension_floating_depth" class="text_pole" type="number" min="0" max="99" />
<span>Appending to the prompt in next: <span id="extension_floating_counter">No</span> message(s)</span>
</div>
</div>
<div class="inline-drawer"> <div class="inline-drawer">
<div class="inline-drawer-toggle inline-drawer-header"> <div class="inline-drawer-toggle inline-drawer-header">
<b>Default note for new chats</b> <b>Default note for new chats</b>

View File

@ -6,4 +6,14 @@
#extension_floating_counter { #extension_floating_counter {
font-weight: 600; font-weight: 600;
color: orange; color: orange;
}
.floating_prompt_settings textarea {
font-size: calc(var(--mainFontSize) * 0.9);
line-height: 1.2;
}
.floating_prompt_radio_group {
display: flex;
flex-direction: column;
} }

View File

@ -234,7 +234,7 @@ async function summarizeChat(context) {
body: JSON.stringify({ body: JSON.stringify({
text: resultingString, text: resultingString,
params: { params: {
min_length: extension_settings.memory.longMemoryLength * 0.8, min_length: extension_settings.memory.longMemoryLength * 0, // testing how it behaves 0 min length
max_length: extension_settings.memory.longMemoryLength, max_length: extension_settings.memory.longMemoryLength,
repetition_penalty: extension_settings.memory.repetitionPenalty, repetition_penalty: extension_settings.memory.repetitionPenalty,
temperature: extension_settings.memory.temperature, temperature: extension_settings.memory.temperature,
@ -307,16 +307,23 @@ $(document).ready(function () {
function addExtensionControls() { function addExtensionControls() {
const settingsHtml = ` const settingsHtml = `
<div id="memory_settings"> <div id="memory_settings">
<h4>Memory</h4> <div class="inline-drawer">
<label for="memory_contents">Memory contents</label> <div class="inline-drawer-toggle inline-drawer-header">
<textarea id="memory_contents" class="text_pole" rows="8" placeholder="Context will be generated here..."></textarea> <b>Chat memory</b>
<div class="memory_contents_controls"> <div class="inline-drawer-icon fa-solid fa-circle-chevron-down down"></div>
<input id="memory_restore" class="menu_button" type="submit" value="Restore previous state" /> </div>
<label for="memory_frozen"><input id="memory_frozen" type="checkbox" /> Freeze context</label> <div class="inline-drawer-content">
<label for="memory_contents">Memory contents</label>
<textarea id="memory_contents" class="text_pole" rows="8" placeholder="Context will be generated here..."></textarea>
<div class="memory_contents_controls">
<input id="memory_restore" class="menu_button" type="submit" value="Restore previous state" />
<label for="memory_frozen"><input id="memory_frozen" type="checkbox" /> Freeze context</label>
</div>
</div>
</div> </div>
<div class="inline-drawer"> <div class="inline-drawer">
<div class="inline-drawer-toggle inline-drawer-header"> <div class="inline-drawer-toggle inline-drawer-header">
<b>Summarization settings</b> <b>Summarization parameters</b>
<div class="inline-drawer-icon fa-solid fa-circle-chevron-down down"></div> <div class="inline-drawer-icon fa-solid fa-circle-chevron-down down"></div>
</div> </div>
<div class="inline-drawer-content"> <div class="inline-drawer-content">

View File

@ -4,7 +4,7 @@
} }
#memory_settings textarea { #memory_settings textarea {
font-size: 14px; font-size: calc(var(--mainFontSize) * 0.9);
line-height: 1.2; line-height: 1.2;
} }