mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-06-05 21:59:27 +02:00
appwide slider overhaul
This commit is contained in:
@@ -72,7 +72,7 @@ export function loadKoboldSettings(preset) {
|
||||
const formattedValue = slider.format(value);
|
||||
slider.setValue(value);
|
||||
$(slider.sliderId).val(value);
|
||||
$(slider.counterId).text(formattedValue);
|
||||
$(slider.counterId).val(formattedValue);
|
||||
}
|
||||
|
||||
// TODO: refactor checkboxes (if adding any more)
|
||||
@@ -375,7 +375,7 @@ jQuery(function () {
|
||||
const value = $(this).val();
|
||||
const formattedValue = slider.format(value);
|
||||
slider.setValue(value);
|
||||
$(slider.counterId).text(formattedValue);
|
||||
$(slider.counterId).val(formattedValue);
|
||||
saveSettingsDebounced();
|
||||
});
|
||||
});
|
||||
|
@@ -176,36 +176,36 @@ export function loadNovelSettings(settings) {
|
||||
|
||||
function loadNovelSettingsUi(ui_settings) {
|
||||
$("#temp_novel").val(ui_settings.temperature);
|
||||
$("#temp_counter_novel").text(Number(ui_settings.temperature).toFixed(2));
|
||||
$("#temp_counter_novel").val(Number(ui_settings.temperature).toFixed(2));
|
||||
$("#rep_pen_novel").val(ui_settings.repetition_penalty);
|
||||
$("#rep_pen_counter_novel").text(Number(ui_settings.repetition_penalty).toFixed(2));
|
||||
$("#rep_pen_counter_novel").val(Number(ui_settings.repetition_penalty).toFixed(2));
|
||||
$("#rep_pen_size_novel").val(ui_settings.repetition_penalty_range);
|
||||
$("#rep_pen_size_counter_novel").text(Number(ui_settings.repetition_penalty_range).toFixed(0));
|
||||
$("#rep_pen_size_counter_novel").val(Number(ui_settings.repetition_penalty_range).toFixed(0));
|
||||
$("#rep_pen_slope_novel").val(ui_settings.repetition_penalty_slope);
|
||||
$("#rep_pen_slope_counter_novel").text(Number(`${ui_settings.repetition_penalty_slope}`).toFixed(2));
|
||||
$("#rep_pen_slope_counter_novel").val(Number(`${ui_settings.repetition_penalty_slope}`).toFixed(2));
|
||||
$("#rep_pen_freq_novel").val(ui_settings.repetition_penalty_frequency);
|
||||
$("#rep_pen_freq_counter_novel").text(Number(ui_settings.repetition_penalty_frequency).toFixed(5));
|
||||
$("#rep_pen_freq_counter_novel").val(Number(ui_settings.repetition_penalty_frequency).toFixed(5));
|
||||
$("#rep_pen_presence_novel").val(ui_settings.repetition_penalty_presence);
|
||||
$("#rep_pen_presence_counter_novel").text(Number(ui_settings.repetition_penalty_presence).toFixed(3));
|
||||
$("#rep_pen_presence_counter_novel").val(Number(ui_settings.repetition_penalty_presence).toFixed(3));
|
||||
$("#tail_free_sampling_novel").val(ui_settings.tail_free_sampling);
|
||||
$("#tail_free_sampling_counter_novel").text(Number(ui_settings.tail_free_sampling).toFixed(3));
|
||||
$("#tail_free_sampling_counter_novel").val(Number(ui_settings.tail_free_sampling).toFixed(3));
|
||||
$("#top_k_novel").val(ui_settings.top_k);
|
||||
$("#top_k_counter_novel").text(Number(ui_settings.top_k).toFixed(0));
|
||||
$("#top_k_counter_novel").val(Number(ui_settings.top_k).toFixed(0));
|
||||
$("#top_p_novel").val(ui_settings.top_p);
|
||||
$("#top_p_counter_novel").text(Number(ui_settings.top_p).toFixed(2));
|
||||
$("#top_p_counter_novel").val(Number(ui_settings.top_p).toFixed(2));
|
||||
$("#top_a_novel").val(ui_settings.top_a);
|
||||
$("#top_a_counter_novel").text(Number(ui_settings.top_a).toFixed(2));
|
||||
$("#top_a_counter_novel").val(Number(ui_settings.top_a).toFixed(2));
|
||||
$("#typical_p_novel").val(ui_settings.typical_p);
|
||||
$("#typical_p_counter_novel").text(Number(ui_settings.typical_p).toFixed(3));
|
||||
$("#typical_p_counter_novel").val(Number(ui_settings.typical_p).toFixed(3));
|
||||
$("#cfg_scale_novel").val(ui_settings.cfg_scale);
|
||||
$("#cfg_scale_counter_novel").text(Number(ui_settings.cfg_scale).toFixed(2));
|
||||
$("#cfg_scale_counter_novel").val(Number(ui_settings.cfg_scale).toFixed(2));
|
||||
$("#phrase_rep_pen_novel").val(ui_settings.phrase_rep_pen || "off");
|
||||
$("#mirostat_lr_novel").val(ui_settings.mirostat_lr);
|
||||
$("#mirostat_lr_counter_novel").text(Number(ui_settings.mirostat_lr).toFixed(2));
|
||||
$("#mirostat_lr_counter_novel").val(Number(ui_settings.mirostat_lr).toFixed(2));
|
||||
$("#mirostat_tau_novel").val(ui_settings.mirostat_tau);
|
||||
$("#mirostat_tau_counter_novel").text(Number(ui_settings.mirostat_tau).toFixed(2));
|
||||
$("#mirostat_tau_counter_novel").val(Number(ui_settings.mirostat_tau).toFixed(2));
|
||||
$("#min_length_novel").val(ui_settings.min_length);
|
||||
$("#min_length_counter_novel").text(Number(ui_settings.min_length).toFixed(0));
|
||||
$("#min_length_counter_novel").val(Number(ui_settings.min_length).toFixed(0));
|
||||
$('#nai_preamble_textarea').val(ui_settings.preamble);
|
||||
$('#nai_prefix').val(ui_settings.prefix || "vanilla");
|
||||
$('#nai_cfg_uc').val(ui_settings.cfg_uc || "");
|
||||
@@ -244,7 +244,7 @@ const sliders = [
|
||||
{
|
||||
sliderId: "#rep_pen_freq_novel",
|
||||
counterId: "#rep_pen_freq_counter_novel",
|
||||
format: (val) => `${val}`,
|
||||
format: (val) => Number(val).toFixed(5),
|
||||
setValue: (val) => { nai_settings.repetition_penalty_frequency = Number(val).toFixed(5); },
|
||||
},
|
||||
{
|
||||
@@ -740,7 +740,7 @@ jQuery(function () {
|
||||
const value = $(this).val();
|
||||
const formattedValue = slider.format(value);
|
||||
slider.setValue(value);
|
||||
$(slider.counterId).text(formattedValue);
|
||||
$(slider.counterId).val(formattedValue);
|
||||
saveSettingsDebounced();
|
||||
});
|
||||
});
|
||||
|
@@ -2070,7 +2070,7 @@ function loadOpenAISettings(data, settings) {
|
||||
$('#model_ai21_select').val(oai_settings.ai21_model);
|
||||
$(`#model_ai21_select option[value="${oai_settings.ai21_model}"`).attr('selected', true);
|
||||
$('#openai_max_context').val(oai_settings.openai_max_context);
|
||||
$('#openai_max_context_counter').text(`${oai_settings.openai_max_context}`);
|
||||
$('#openai_max_context_counter').val(`${oai_settings.openai_max_context}`);
|
||||
$('#model_openrouter_select').val(oai_settings.openrouter_model);
|
||||
|
||||
$('#openai_max_tokens').val(oai_settings.openai_max_tokens);
|
||||
@@ -2099,22 +2099,22 @@ function loadOpenAISettings(data, settings) {
|
||||
$('#send_if_empty_textarea').val(oai_settings.send_if_empty);
|
||||
|
||||
$('#temp_openai').val(oai_settings.temp_openai);
|
||||
$('#temp_counter_openai').text(Number(oai_settings.temp_openai).toFixed(2));
|
||||
$('#temp_counter_openai').val(Number(oai_settings.temp_openai).toFixed(2));
|
||||
|
||||
$('#freq_pen_openai').val(oai_settings.freq_pen_openai);
|
||||
$('#freq_pen_counter_openai').text(Number(oai_settings.freq_pen_openai).toFixed(2));
|
||||
$('#freq_pen_counter_openai').val(Number(oai_settings.freq_pen_openai).toFixed(2));
|
||||
|
||||
$('#pres_pen_openai').val(oai_settings.pres_pen_openai);
|
||||
$('#pres_pen_counter_openai').text(Number(oai_settings.pres_pen_openai).toFixed(2));
|
||||
$('#pres_pen_counter_openai').val(Number(oai_settings.pres_pen_openai).toFixed(2));
|
||||
|
||||
$('#count_pen').val(oai_settings.count_pen);
|
||||
$('#count_pen_counter').text(Number(oai_settings.count_pen).toFixed(2));
|
||||
$('#count_pen_counter').val(Number(oai_settings.count_pen).toFixed(2));
|
||||
|
||||
$('#top_p_openai').val(oai_settings.top_p_openai);
|
||||
$('#top_p_counter_openai').text(Number(oai_settings.top_p_openai).toFixed(2));
|
||||
$('#top_p_counter_openai').val(Number(oai_settings.top_p_openai).toFixed(2));
|
||||
|
||||
$('#top_k_openai').val(oai_settings.top_k_openai);
|
||||
$('#top_k_counter_openai').text(Number(oai_settings.top_k_openai).toFixed(0));
|
||||
$('#top_k_counter_openai').val(Number(oai_settings.top_k_openai).toFixed(0));
|
||||
|
||||
if (settings.reverse_proxy !== undefined) oai_settings.reverse_proxy = settings.reverse_proxy;
|
||||
$('#openai_reverse_proxy').val(oai_settings.reverse_proxy);
|
||||
@@ -3119,43 +3119,43 @@ $(document).ready(async function () {
|
||||
|
||||
$(document).on('input', '#temp_openai', function () {
|
||||
oai_settings.temp_openai = Number($(this).val());
|
||||
$('#temp_counter_openai').text(Number($(this).val()).toFixed(2));
|
||||
$('#temp_counter_openai').val(Number($(this).val()).toFixed(2));
|
||||
saveSettingsDebounced();
|
||||
});
|
||||
|
||||
$(document).on('input', '#freq_pen_openai', function () {
|
||||
oai_settings.freq_pen_openai = Number($(this).val());
|
||||
$('#freq_pen_counter_openai').text(Number($(this).val()).toFixed(2));
|
||||
$('#freq_pen_counter_openai').val(Number($(this).val()).toFixed(2));
|
||||
saveSettingsDebounced();
|
||||
});
|
||||
|
||||
$(document).on('input', '#pres_pen_openai', function () {
|
||||
oai_settings.pres_pen_openai = Number($(this).val());
|
||||
$('#pres_pen_counter_openai').text(Number($(this).val()).toFixed(2));
|
||||
$('#pres_pen_counter_openai').val(Number($(this).val()).toFixed(2));
|
||||
saveSettingsDebounced();
|
||||
});
|
||||
|
||||
$(document).on('input', '#count_pen', function () {
|
||||
oai_settings.count_pen = Number($(this).val());
|
||||
$('#count_pen_counter').text(Number($(this).val()).toFixed(2));
|
||||
$('#count_pen_counter').val(Number($(this).val()).toFixed(2));
|
||||
saveSettingsDebounced();
|
||||
});
|
||||
|
||||
$(document).on('input', '#top_p_openai', function () {
|
||||
oai_settings.top_p_openai = Number($(this).val());
|
||||
$('#top_p_counter_openai').text(Number($(this).val()).toFixed(2));
|
||||
$('#top_p_counter_openai').val(Number($(this).val()).toFixed(2));
|
||||
saveSettingsDebounced();
|
||||
});
|
||||
|
||||
$(document).on('input', '#top_k_openai', function () {
|
||||
oai_settings.top_k_openai = Number($(this).val());
|
||||
$('#top_k_counter_openai').text(Number($(this).val()).toFixed(0));
|
||||
$('#top_k_counter_openai').val(Number($(this).val()).toFixed(0));
|
||||
saveSettingsDebounced();
|
||||
});
|
||||
|
||||
$(document).on('input', '#openai_max_context', function () {
|
||||
oai_settings.openai_max_context = Number($(this).val());
|
||||
$('#openai_max_context_counter').text(`${$(this).val()}`);
|
||||
$('#openai_max_context_counter').val(`${$(this).val()}`);
|
||||
calculateOpenRouterCost();
|
||||
saveSettingsDebounced();
|
||||
});
|
||||
|
@@ -44,8 +44,10 @@ export {
|
||||
getContextSettings,
|
||||
};
|
||||
|
||||
export const MAX_CONTEXT_DEFAULT = 4096;
|
||||
export const MAX_CONTEXT_DEFAULT = 8192;
|
||||
const MAX_CONTEXT_UNLOCKED = 65536;
|
||||
const unlockedMaxContextStep = 4096
|
||||
const unlockedMaxContestMin = 8192
|
||||
|
||||
const defaultStoryString = "{{#if system}}{{system}}\n{{/if}}{{#if description}}{{description}}\n{{/if}}{{#if personality}}{{char}}'s personality: {{personality}}\n{{/if}}{{#if scenario}}Scenario: {{scenario}}\n{{/if}}{{#if persona}}{{persona}}\n{{/if}}";
|
||||
const defaultExampleSeparator = '***';
|
||||
@@ -551,7 +553,7 @@ function applyChatWidth(type) {
|
||||
})
|
||||
}
|
||||
|
||||
$('#chat_width_slider_counter').text(power_user.chat_width);
|
||||
$('#chat_width_slider_counter').val(power_user.chat_width);
|
||||
}
|
||||
|
||||
async function applyThemeColor(type) {
|
||||
@@ -612,7 +614,7 @@ async function applyCustomCSS() {
|
||||
async function applyBlurStrength() {
|
||||
power_user.blur_strength = Number(localStorage.getItem(storage_keys.blur_strength) ?? 1);
|
||||
document.documentElement.style.setProperty('--blurStrength', power_user.blur_strength);
|
||||
$("#blur_strength_counter").text(power_user.blur_strength);
|
||||
$("#blur_strength_counter").val(power_user.blur_strength);
|
||||
$("#blur_strength").val(power_user.blur_strength);
|
||||
|
||||
|
||||
@@ -621,7 +623,7 @@ async function applyBlurStrength() {
|
||||
async function applyShadowWidth() {
|
||||
power_user.shadow_width = Number(localStorage.getItem(storage_keys.shadow_width) ?? 2);
|
||||
document.documentElement.style.setProperty('--shadowWidth', power_user.shadow_width);
|
||||
$("#shadow_width_counter").text(power_user.shadow_width);
|
||||
$("#shadow_width_counter").val(power_user.shadow_width);
|
||||
$("#shadow_width").val(power_user.shadow_width);
|
||||
|
||||
}
|
||||
@@ -639,7 +641,7 @@ async function applyFontScale(type) {
|
||||
})
|
||||
}
|
||||
|
||||
$("#font_scale_counter").text(power_user.font_scale);
|
||||
$("#font_scale_counter").val(power_user.font_scale);
|
||||
$("#font_scale").val(power_user.font_scale);
|
||||
}
|
||||
|
||||
@@ -985,13 +987,13 @@ function loadPowerUserSettings(settings, data) {
|
||||
$("#token_padding").val(power_user.token_padding);
|
||||
|
||||
$("#font_scale").val(power_user.font_scale);
|
||||
$("#font_scale_counter").text(power_user.font_scale);
|
||||
$("#font_scale_counter").val(power_user.font_scale);
|
||||
|
||||
$("#blur_strength").val(power_user.blur_strength);
|
||||
$("#blur_strength_counter").text(power_user.blur_strength);
|
||||
$("#blur_strength_counter").val(power_user.blur_strength);
|
||||
|
||||
$("#shadow_width").val(power_user.shadow_width);
|
||||
$("#shadow_width_counter").text(power_user.shadow_width);
|
||||
$("#shadow_width_counter").val(power_user.shadow_width);
|
||||
|
||||
$("#main-text-color-picker").attr('color', power_user.main_text_color);
|
||||
$("#italics-color-picker").attr('color', power_user.italics_text_color);
|
||||
@@ -1085,9 +1087,13 @@ function loadMaxContextUnlocked() {
|
||||
function switchMaxContextSize() {
|
||||
const elements = [$('#max_context'), $('#rep_pen_range'), $('#rep_pen_range_textgenerationwebui')];
|
||||
const maxValue = power_user.max_context_unlocked ? MAX_CONTEXT_UNLOCKED : MAX_CONTEXT_DEFAULT;
|
||||
const minValue = power_user.max_context_unlocked ? unlockedMaxContestMin : 0;
|
||||
const steps = power_user.max_context_unlocked ? unlockedMaxContextStep : 256;
|
||||
|
||||
for (const element of elements) {
|
||||
element.attr('max', maxValue);
|
||||
element.attr('step', steps);
|
||||
element.attr('min', minValue);
|
||||
const value = Number(element.val());
|
||||
|
||||
if (value >= maxValue) {
|
||||
@@ -2052,7 +2058,7 @@ $(document).ready(() => {
|
||||
|
||||
$(`input[name="font_scale"]`).on('input', async function (e) {
|
||||
power_user.font_scale = Number(e.target.value);
|
||||
$("#font_scale_counter").text(power_user.font_scale);
|
||||
$("#font_scale_counter").val(power_user.font_scale);
|
||||
localStorage.setItem(storage_keys.font_scale, power_user.font_scale);
|
||||
await applyFontScale();
|
||||
saveSettingsDebounced();
|
||||
@@ -2060,7 +2066,7 @@ $(document).ready(() => {
|
||||
|
||||
$(`input[name="blur_strength"]`).on('input', async function (e) {
|
||||
power_user.blur_strength = Number(e.target.value);
|
||||
$("#blur_strength_counter").text(power_user.blur_strength);
|
||||
$("#blur_strength_counter").val(power_user.blur_strength);
|
||||
localStorage.setItem(storage_keys.blur_strength, power_user.blur_strength);
|
||||
await applyBlurStrength();
|
||||
saveSettingsDebounced();
|
||||
@@ -2068,7 +2074,7 @@ $(document).ready(() => {
|
||||
|
||||
$(`input[name="shadow_width"]`).on('input', async function (e) {
|
||||
power_user.shadow_width = Number(e.target.value);
|
||||
$("#shadow_width_counter").text(power_user.shadow_width);
|
||||
$("#shadow_width_counter").val(power_user.shadow_width);
|
||||
localStorage.setItem(storage_keys.shadow_width, power_user.shadow_width);
|
||||
await applyShadowWidth();
|
||||
saveSettingsDebounced();
|
||||
|
@@ -286,7 +286,8 @@ jQuery(function () {
|
||||
}
|
||||
else {
|
||||
const value = Number($(this).val());
|
||||
$(`#${id}_counter_textgenerationwebui`).text(value.toFixed(2));
|
||||
$(`#${id}_counter_textgenerationwebui`).val(value.toFixed(2));
|
||||
$("#rep_pen_range_counter_textgenerationwebui").val(Math.floor(value));
|
||||
textgenerationwebui_settings[id] = value;
|
||||
}
|
||||
|
||||
@@ -312,7 +313,8 @@ function setSettingByName(i, value, trigger) {
|
||||
else {
|
||||
const val = parseFloat(value);
|
||||
$(`#${i}_textgenerationwebui`).val(val);
|
||||
$(`#${i}_counter_textgenerationwebui`).text(val.toFixed(2));
|
||||
$(`#${i}_counter_textgenerationwebui`).val(val.toFixed(2));
|
||||
$("#rep_pen_range_counter_textgenerationwebui").val(Math.floor(val));
|
||||
}
|
||||
|
||||
if (trigger) {
|
||||
|
Reference in New Issue
Block a user