Add pygmalion formatting dropdown

This commit is contained in:
SillyLossy
2023-04-15 17:30:11 +03:00
parent e419988f26
commit 7c9e424863
5 changed files with 30 additions and 18 deletions

View File

@ -999,10 +999,6 @@
<input id="always-force-name2-checkbox" type="checkbox" />
Always add character's name to prompt
</label>
<label class="checkbox_label" for="force-pygmalion-formatting-checkbox">
<input id="force-pygmalion-formatting-checkbox" type="checkbox" />
Pygmalion Formatting for All Models
</label>
<label class="checkbox_label" for="multigen">
<input id="multigen" type="checkbox" />
<span>
@ -1019,6 +1015,14 @@
<label class="checkbox_label" for="collapse-newlines-checkbox"><input id="collapse-newlines-checkbox" type="checkbox" />
Remove Empty New Lines from Output
</label>
<div>
<h4>Pygmalion Formatting</h4>
<select id="pygmalion_formatting">
<option value="-1">Disabled for all models</option>
<option value="0">Automatic (based on model name)</option>
<option value="1">Enabled for all models</option>
</select>
</div>
</div>
<div id="anchors-block">
<h4>
@ -1371,7 +1375,7 @@
<div id="delete_button" class="menu_button fa-solid fa-trash-can " title="Delete Character"></div>
</div>
</div>
<div id="result_info"></div>
<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">

View File

@ -45,6 +45,7 @@ import {
playMessageSound,
sortCharactersList,
power_user,
pygmalion_options,
} from "./scripts/power-user.js";
import {
@ -508,7 +509,8 @@ async function getStatus() {
if (online_status == undefined) {
online_status = "no_connection";
}
if (online_status.toLowerCase().indexOf("pygmalion") != -1 || (online_status !== "no_connection" && power_user.force_pygmalion_formatting)) {
if ((online_status.toLowerCase().indexOf("pygmalion") != -1 && power_user.pygmalion_formatting == pygmalion_options.AUTO)
|| (online_status !== "no_connection" && power_user.pygmalion_formatting == pygmalion_options.ENABLED)) {
is_pygmalion = true;
online_status += " (Pyg. formatting on)";
} else {
@ -2188,10 +2190,8 @@ function saveReply(type, getMessage, this_mes_is_name) {
} else {
chat[chat.length - 1]['mes'] = getMessage;
}
is_send_press = false;
} else {
console.log('entering chat update routine for non-swipe post');
is_send_press = false;
chat[chat.length] = {};
chat[chat.length - 1]['name'] = name2;
chat[chat.length - 1]['is_user'] = false;

View File

@ -26,7 +26,7 @@ const defaultSettings = {
shortMemoryStep: 16,
longMemoryStep: 8,
repetitionPenaltyStep: 0.05,
repetitionPenalty: 1.0,
repetitionPenalty: 1.2,
maxRepetitionPenalty: 2.0,
minRepetitionPenalty: 1.0,
temperature: 1.0,
@ -327,15 +327,15 @@ $(document).ready(function () {
<div class="inline-drawer-icon fa-solid fa-circle-chevron-down down"></div>
</div>
<div class="inline-drawer-content">
<label for="memory_short_length">Memory summarization [short-term] length (<span id="memory_short_length_tokens"></span> tokens)</label>
<label for="memory_short_length">Buffer <small>[short-term]</small> length (<span id="memory_short_length_tokens"></span> tokens)</label>
<input id="memory_short_length" type="range" value="${defaultSettings.shortMemoryLength}" min="${defaultSettings.minShortMemory}" max="${defaultSettings.maxShortMemory}" step="${defaultSettings.shortMemoryStep}" />
<label for="memory_long_length">Memory context [long-term] length (<span id="memory_long_length_tokens"></span> tokens)</label>
<label for="memory_long_length">Summary <small>[long-term]</small> length (<span id="memory_long_length_tokens"></span> tokens)</label>
<input id="memory_long_length" type="range" value="${defaultSettings.longMemoryLength}" min="${defaultSettings.minLongMemory}" max="${defaultSettings.maxLongMemory}" step="${defaultSettings.longMemoryStep}" />
<label for="memory_temperature">Summarization temperature (<span id="memory_temperature_value"></span>)</label>
<label for="memory_temperature">Temperature (<span id="memory_temperature_value"></span>)</label>
<input id="memory_temperature" type="range" value="${defaultSettings.temperature}" min="${defaultSettings.minTemperature}" max="${defaultSettings.maxTemperature}" step="${defaultSettings.temperatureStep}" />
<label for="memory_repetition_penalty">Summarization repetition penalty (<span id="memory_repetition_penalty_value"></span>)</label>
<label for="memory_repetition_penalty">Repetition penalty (<span id="memory_repetition_penalty_value"></span>)</label>
<input id="memory_repetition_penalty" type="range" value="${defaultSettings.repetitionPenalty}" min="${defaultSettings.minRepetitionPenalty}" max="${defaultSettings.maxRepetitionPenalty}" step="${defaultSettings.repetitionPenaltyStep}" />
<label for="memory_length_penalty">Summarization length penalty (<span id="memory_length_penalty_value"></span>)</label>
<label for="memory_length_penalty">Length penalty <small>[higher = longer summaries]</small> (<span id="memory_length_penalty_value"></span>)</label>
<input id="memory_length_penalty" type="range" value="${defaultSettings.lengthPenalty}" min="${defaultSettings.minLengthPenalty}" max="${defaultSettings.maxLengthPenalty}" step="${defaultSettings.lengthPenaltyStep}" />
</div>
</div>

View File

@ -14,6 +14,7 @@ export {
playMessageSound,
sortCharactersList,
power_user,
pygmalion_options,
};
const avatar_styles = {
@ -31,9 +32,15 @@ const sheld_width = {
w1000px: 1,
}
const pygmalion_options = {
DISABLED: -1,
AUTO: 0,
ENABLED: 1,
}
let power_user = {
collapse_newlines: false,
force_pygmalion_formatting: false,
pygmalion_formatting: pygmalion_options.AUTO,
pin_examples: false,
disable_description_formatting: false,
disable_scenario_formatting: false,
@ -270,7 +277,7 @@ function loadPowerUserSettings(settings, data) {
power_user.font_scale = Number(localStorage.getItem(storage_keys.font_scale) ?? 1);
power_user.blur_strength = Number(localStorage.getItem(storage_keys.blur_strength) ?? 10);
$("#force-pygmalion-formatting-checkbox").prop("checked", power_user.force_pygmalion_formatting);
$(`#pygmalion_formatting option[value=${power_user.pygmalion_formatting}]`).prop("checked", true);
$("#collapse-newlines-checkbox").prop("checked", power_user.collapse_newlines);
$("#pin-examples-checkbox").prop("checked", power_user.pin_examples);
$("#disable-description-formatting-checkbox").prop("checked", power_user.disable_description_formatting);
@ -333,8 +340,8 @@ $(document).ready(() => {
saveSettingsDebounced();
});
$("#force-pygmalion-formatting-checkbox").change(function () {
power_user.force_pygmalion_formatting = !!$(this).prop("checked");
$("#pygmalion_formatting").change(function (e) {
power_user.pygmalion_formatting = Number($(this).find(":selected").val());
saveSettingsDebounced();
});

View File

@ -1156,6 +1156,7 @@ input[type=search]:focus::-webkit-search-cancel-button {
color: var(--white30a);
display: flex;
font-size: calc(var(--mainFontSize) - 0.2rem);
font-weight: bold;
}
/* Focus */