Add None continue postfix for chat completion

This commit is contained in:
Cohee
2024-07-08 20:33:37 +03:00
parent 8a154e7abf
commit 00de522a64
2 changed files with 17 additions and 3 deletions

View File

@ -1696,16 +1696,20 @@
<div class="fa-solid fa-circle-chevron-down inline-drawer-icon down"></div> <div class="fa-solid fa-circle-chevron-down inline-drawer-icon down"></div>
</div> </div>
<div class="inline-drawer-content"> <div class="inline-drawer-content">
<label class="checkbox_label flexWrap alignItemsCenter" for="continue_postfix_none">
<input type="radio" id="continue_postfix_none" name="continue_postfix" value="0">
<span data-i18n="None">None</span>
</label>
<label class="checkbox_label flexWrap alignItemsCenter" for="continue_postfix_space"> <label class="checkbox_label flexWrap alignItemsCenter" for="continue_postfix_space">
<input type="radio" id="continue_postfix_space" name="continue_postfix" value="0"> <input type="radio" id="continue_postfix_space" name="continue_postfix" value="1">
<span data-i18n="Space">Space</span> <span data-i18n="Space">Space</span>
</label> </label>
<label class="checkbox_label flexWrap alignItemsCenter" for="continue_postfix_newline"> <label class="checkbox_label flexWrap alignItemsCenter" for="continue_postfix_newline">
<input type="radio" id="continue_postfix_newline" name="continue_postfix" value="1"> <input type="radio" id="continue_postfix_newline" name="continue_postfix" value="2">
<span data-i18n="Newline">Newline</span> <span data-i18n="Newline">Newline</span>
</label> </label>
<label class="checkbox_label flexWrap alignItemsCenter" for="continue_postfix_double_newline"> <label class="checkbox_label flexWrap alignItemsCenter" for="continue_postfix_double_newline">
<input type="radio" id="continue_postfix_double_newline" name="continue_postfix" value="2"> <input type="radio" id="continue_postfix_double_newline" name="continue_postfix" value="3">
<span data-i18n="Double Newline">Double Newline</span> <span data-i18n="Double Newline">Double Newline</span>
</label> </label>
<!-- Hidden input for loading radio buttons from presets. Don't remove! --> <!-- Hidden input for loading radio buttons from presets. Don't remove! -->

View File

@ -191,6 +191,7 @@ const character_names_behavior = {
}; };
const continue_postfix_types = { const continue_postfix_types = {
NONE: '',
SPACE: ' ', SPACE: ' ',
NEWLINE: '\n', NEWLINE: '\n',
DOUBLE_NEWLINE: '\n\n', DOUBLE_NEWLINE: '\n\n',
@ -3138,6 +3139,9 @@ function setNamesBehaviorControls() {
function setContinuePostfixControls() { function setContinuePostfixControls() {
switch (oai_settings.continue_postfix) { switch (oai_settings.continue_postfix) {
case continue_postfix_types.NONE:
$('#continue_postfix_none').prop('checked', true);
break;
case continue_postfix_types.SPACE: case continue_postfix_types.SPACE:
$('#continue_postfix_space').prop('checked', true); $('#continue_postfix_space').prop('checked', true);
break; break;
@ -5078,6 +5082,12 @@ $(document).ready(async function () {
saveSettingsDebounced(); saveSettingsDebounced();
}); });
$('#continue_postfix_none').on('input', function () {
oai_settings.continue_postfix = continue_postfix_types.NONE;
setContinuePostfixControls();
saveSettingsDebounced();
});
$('#continue_postfix_space').on('input', function () { $('#continue_postfix_space').on('input', function () {
oai_settings.continue_postfix = continue_postfix_types.SPACE; oai_settings.continue_postfix = continue_postfix_types.SPACE;
setContinuePostfixControls(); setContinuePostfixControls();