add neutralize samplers button for text completion slider panel

This commit is contained in:
RossAscends 2024-01-14 18:07:43 +09:00
parent 44bd57f763
commit 80b39bdac1
2 changed files with 51 additions and 0 deletions

View File

@ -1177,6 +1177,12 @@
</div>
</div><!-- end of novel settings-->
<div id="textgenerationwebui_api-settings">
<div data-newbie-hidden class="flex-container justifyCenter">
<small class="flex-container alignitemscenter">
<div id="samplerResetButton" class="menu_button whitespacenowrap">Neutralize Samplers</div>
<div class="fa-solid fa-circle-info opacity50p" title="Sets all samplers to their neutral/disabled state."></div>
</small>
</div>
<div data-newbie-hidden data-tg-type="aphrodite" class="flex-container flexFlowColumn alignitemscenter flexBasis100p flexGrow flexShrink gap0">
<small data-i18n="Multiple swipes per generation">Multiple swipes per generation</small>
<input type="number" id="n_textgenerationwebui" class="text_pole textAlignCenter" min="1" value="1" />

View File

@ -502,6 +502,51 @@ jQuery(function () {
selectPreset(presetName);
});
$('#samplerResetButton').off('click').on('click', function () {
const inputs = {
'temp_textgenerationwebui': '1',
'top_k_textgenerationwebui': '0',
'top_p_textgenerationwebui': '1',
'min_p_textgenerationwebui': '0',
'rep_pen_textgenerationwebui': '1',
'rep_pen_range_textgenerationwebui': '0',
'dynatemp_textgenerationwebui': false,
'seed_textgenerationwebui': '-1',
'ban_eos_token_textgenerationwebui': false,
'do_sample_textgenerationwebui': true,
'add_bos_token_textgenerationwebui': true,
'temperature_last_textgenerationwebui': true,
'skip_special_tokens_textgenerationwebui': true,
'top_a_textgenerationwebui': '0',
'top_a_counter_textgenerationwebui': '0',
'mirostat_mode_textgenerationwebui': '0',
'mirostat_tau_textgenerationwebui': '5',
'mirostat_eta_textgenerationwebui': '0.1',
'tfs_textgenerationwebui': '1',
'epsilon_cutoff_textgenerationwebui': '0',
'eta_cutoff_textgenerationwebui': '0',
'encoder_rep_pen_textgenerationwebui': '1',
'freq_pen_textgenerationwebui': '0',
'presence_pen_textgenerationwebui': '0',
'no_repeat_ngram_size_textgenerationwebui': '0',
'min_length_textgenerationwebui': '0',
'num_beams_textgenerationwebui': '1',
'length_penalty_textgenerationwebui': '0',
'penalty_alpha_textgenerationwebui': '0',
'typical_p_textgenerationwebui': '1', // Added entry
'guidance_scale_textgenerationwebui': '1',
};
for (const [id, value] of Object.entries(inputs)) {
const inputElement = $(`#${id}`);
if (inputElement.prop('type') === 'checkbox') {
inputElement.prop('checked', value);
} else {
inputElement.val(value).trigger('input');
}
}
});
for (const i of setting_names) {
$(`#${i}_textgenerationwebui`).attr('x-setting-id', i);
$(document).on('input', `#${i}_textgenerationwebui`, function () {