Better UI control for phrase rep pen

This commit is contained in:
Cohee 2023-08-14 19:00:36 +03:00
parent c172801b5e
commit 8c759e87cf
2 changed files with 19 additions and 22 deletions

View File

@ -426,6 +426,19 @@
</div>
</div>
</div>
<div class="range-block">
<div class="range-block-title" data-i18n="Phrase Repetition Penalty">
Phrase Repetition Penalty
</div>
<select id="phrase_rep_pen_novel">
<option value="0" data-i18n="Disabled">Disabled</option>
<option value="1" data-i18n="Very Light">Very Light</option>
<option value="2" data-i18n="Light">Light</option>
<option value="3" data-i18n="Medium">Medium</option>
<option value="4" data-i18n="Aggressive">Aggressive</option>
<option value="5" data-i18n="Very Aggressive">Very Aggressive</option>
</select>
</div>
</div>
<div id="range_block_textgenerationwebui">
<div class="range-block">
@ -998,21 +1011,6 @@
</div>
</div>
</div>
<div class="range-block">
<div class="range-block-title" data-i18n="Phrase Repetition Penalty">
Phrase Repetition Penalty
</div>
<div class="range-block-range-and-counter">
<div class="range-block-range">
<input type="range" id="phrase_rep_pen_novel" name="volume" min="0" max="5" step="1">
</div>
<div class="range-block-counter">
<div contenteditable="true" data-for="phrase_rep_pen_novel" id="phrase_rep_pen_counter_novel">
select
</div>
</div>
</div>
</div>
<div class="range-block">
<div class="range-block-title" data-i18n="Min Length">
Min Length

View File

@ -191,7 +191,6 @@ function loadNovelSettingsUi(ui_settings) {
$("#cfg_scale_novel").val(ui_settings.cfg_scale);
$("#cfg_scale_counter_novel").text(Number(ui_settings.cfg_scale).toFixed(2));
$("#phrase_rep_pen_novel").val(getPhraseRepPenCounter(ui_settings.phrase_rep_pen));
$("#phrase_rep_pen_counter_novel").text(getPhraseRepPenCounter(ui_settings.phrase_rep_pen));
$("#top_g_novel").val(ui_settings.top_g);
$("#top_g_counter_novel").text(Number(ui_settings.top_g).toFixed(0));
$("#mirostat_lr_novel").val(ui_settings.mirostat_lr);
@ -298,12 +297,6 @@ const sliders = [
format: (val) => `${val}`,
setValue: (val) => { nai_settings.cfg_scale = Number(val).toFixed(2); },
},
{
sliderId: "#phrase_rep_pen_novel",
counterId: "#phrase_rep_pen_counter_novel",
format: (val) => `${val}`,
setValue: (val) => { nai_settings.phrase_rep_pen = getPhraseRepPenString(Number(val).toFixed(0)); },
},
{
sliderId: "#min_length_novel",
counterId: "#min_length_counter_novel",
@ -463,4 +456,10 @@ $(document).ready(function () {
nai_settings.prefix = $("#nai_prefix").find(":selected").val();
saveSettingsDebounced();
});
$("#phrase_rep_pen_novel", function () {
const val = $("#phrase_rep_pen_novel").find(":selected").val();
nai_settings.phrase_rep_pen = getPhraseRepPenString(Number(val).toFixed(0));
saveSettingsDebounced();
});
});