Rework single-line mode, add section for Context Formatting settings
This commit is contained in:
parent
a2d8a2a447
commit
52ecad1cdf
|
@ -405,7 +405,6 @@
|
|||
"typical": 1,
|
||||
"tfs": 1,
|
||||
"rep_pen_slope": 0,
|
||||
"single_line": false,
|
||||
"streaming_kobold": false,
|
||||
"sampler_order": [
|
||||
6,
|
||||
|
|
|
@ -5,7 +5,6 @@
|
|||
"always_force_name2": false,
|
||||
"trim_sentences": false,
|
||||
"include_newline": false,
|
||||
"custom_stopping_strings": "[\"\\n\"]",
|
||||
"custom_stopping_strings_macro": true,
|
||||
"single_line": true,
|
||||
"name": "Adventure"
|
||||
}
|
|
@ -105,6 +105,10 @@
|
|||
align-items: flex-end !important;
|
||||
}
|
||||
|
||||
.alignItemsBaseline {
|
||||
align-items: baseline !important;
|
||||
}
|
||||
|
||||
.alignSelfStart {
|
||||
align-self: start;
|
||||
}
|
||||
|
|
|
@ -997,17 +997,6 @@
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="range-block">
|
||||
<label class="checkbox_label" for="single_line">
|
||||
<input id="single_line" type="checkbox" /><span data-i18n="Single-line mode">
|
||||
Single-line mode</span>
|
||||
</label>
|
||||
<div class="toggle-description justifyLeft">
|
||||
<span data-i18n="Generate only one line per request (KoboldAI only, ignored by KoboldCpp).">
|
||||
Generate only one line per request (KoboldAI only, ignored by KoboldCpp).
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="range-block">
|
||||
<label class="checkbox_label" for="use_default_badwordsids">
|
||||
<input id="use_default_badwordsids" type="checkbox" />
|
||||
|
@ -2240,7 +2229,8 @@
|
|||
<div class="drawer-icon fa-solid fa-font closedIcon" title="AI Response Formatting" data-i18n="[title]AI Response Formatting"></div>
|
||||
</div>
|
||||
<div class="drawer-content">
|
||||
<h3 class="margin0" data-i18n="Advanced Formatting">Advanced Formatting
|
||||
<h3 class="margin0" data-i18n="Advanced Formatting">
|
||||
Advanced Formatting
|
||||
<a href="https://docs.sillytavern.app/usage/core-concepts/advancedformatting/" class="notes-link" target="_blank">
|
||||
<span class="note-link-span">?</span>
|
||||
</a>
|
||||
|
@ -2470,6 +2460,52 @@
|
|||
</div>
|
||||
</div>
|
||||
<div id="ContextFormatting">
|
||||
<div>
|
||||
<div class="flex-container alignItemsBaseline">
|
||||
<h4 data-i18n="Context Formatting">
|
||||
Context Formatting
|
||||
</h4>
|
||||
<small>
|
||||
(Saved to Context Template)
|
||||
</small>
|
||||
</div>
|
||||
<label class="checkbox_label" for="always-force-name2-checkbox">
|
||||
<input id="always-force-name2-checkbox" type="checkbox" />
|
||||
<span data-i18n="Always add character's name to prompt">
|
||||
Always add character's name to prompt
|
||||
</span>
|
||||
</label>
|
||||
<label class="checkbox_label" for="single_line">
|
||||
<input id="single_line" type="checkbox" />
|
||||
<span data-i18n="Generate only one line per request">
|
||||
Generate only one line per request
|
||||
</span>
|
||||
</label>
|
||||
<label class="checkbox_label" for="trim_sentences_checkbox">
|
||||
<input id="trim_sentences_checkbox" type="checkbox" />
|
||||
<span data-i18n="Trim Incomplete Sentences">
|
||||
Trim Incomplete Sentences
|
||||
</span>
|
||||
</label>
|
||||
<!-- Add margin since this is a child of above -->
|
||||
<label data-newbie-hidden class="checkbox_label indent20p" for="include_newline_checkbox">
|
||||
<input id="include_newline_checkbox" type="checkbox" />
|
||||
<span data-i18n="Include Newline">Include Newline</span>
|
||||
</label>
|
||||
</div>
|
||||
<h4>
|
||||
Misc. Settings
|
||||
</h4>
|
||||
<label class="checkbox_label" for="collapse-newlines-checkbox">
|
||||
<input id="collapse-newlines-checkbox" type="checkbox" />
|
||||
<span data-i18n="Remove Empty New Lines from Output">
|
||||
Remove Empty New Lines from Output
|
||||
</span>
|
||||
</label>
|
||||
<label data-newbie-hidden class="checkbox_label" for="trim_spaces">
|
||||
<input id="trim_spaces" type="checkbox" />
|
||||
<span data-i18n="Trim spaces">Trim spaces</span>
|
||||
</label>
|
||||
<div data-newbie-hidden>
|
||||
<h4><span data-i18n="Tokenizer">Tokenizer</span>
|
||||
<a href="https://docs.sillytavern.app/usage/core-concepts/advancedformatting/#tokenizer" class="notes-link" target="_blank">
|
||||
|
@ -2496,77 +2532,57 @@
|
|||
</div>
|
||||
<input id="token_padding" class="text_pole textarea_compact" type="number" min="-2048" max="2048" />
|
||||
</div>
|
||||
<label class="checkbox_label" for="always-force-name2-checkbox">
|
||||
<input id="always-force-name2-checkbox" type="checkbox" />
|
||||
<span data-i18n="Always add character's name to prompt">
|
||||
Always add character's name to prompt
|
||||
</span>
|
||||
</label>
|
||||
<label class="checkbox_label" for="collapse-newlines-checkbox"><input id="collapse-newlines-checkbox" type="checkbox" />
|
||||
<span data-i18n="Remove Empty New Lines from Output">
|
||||
Remove Empty New Lines from Output
|
||||
</span>
|
||||
</label>
|
||||
<label data-newbie-hidden class="checkbox_label" for="trim_spaces">
|
||||
<input id="trim_spaces" type="checkbox" />
|
||||
<span data-i18n="Trim spaces">Trim spaces</span>
|
||||
</label>
|
||||
<label class="checkbox_label" for="trim_sentences_checkbox">
|
||||
<input id="trim_sentences_checkbox" type="checkbox" />
|
||||
<span data-i18n="Trim Incomplete Sentences">Trim Incomplete Sentences</span>
|
||||
</label>
|
||||
<!-- Add margin since this is a child of above -->
|
||||
<label data-newbie-hidden class="checkbox_label indent20p" for="include_newline_checkbox">
|
||||
<input id="include_newline_checkbox" type="checkbox" />
|
||||
<span data-i18n="Include Newline">Include Newline</span>
|
||||
</label>
|
||||
<div data-newbie-hidden>
|
||||
<h4>
|
||||
<span data-i18n="Start Reply With">
|
||||
Start Reply With
|
||||
</span>
|
||||
</h4>
|
||||
<div class="flex-container flexFlowColumn" data-newbie-hidden>
|
||||
<div>
|
||||
<textarea id="start_reply_with" rows="2" class="text_pole textarea_compact" data-i18n="[placeholder]AI reply prefix" placeholder="AI reply prefix"></textarea>
|
||||
<h4 class="range-block-title justifyLeft">
|
||||
<span data-i18n="Start Reply With">
|
||||
Start Reply With
|
||||
</span>
|
||||
</h4>
|
||||
<div>
|
||||
<textarea id="start_reply_with" rows="2" class="text_pole textarea_compact" data-i18n="[placeholder]AI reply prefix" placeholder="AI reply prefix"></textarea>
|
||||
</div>
|
||||
<label class="checkbox_label" for="chat-show-reply-prefix-checkbox">
|
||||
<input id="chat-show-reply-prefix-checkbox" type="checkbox" />
|
||||
<span data-i18n="Show reply prefix in chat">
|
||||
Show reply prefix in chat
|
||||
</span>
|
||||
</label>
|
||||
</div>
|
||||
<label class="checkbox_label" for="chat-show-reply-prefix-checkbox"><input id="chat-show-reply-prefix-checkbox" type="checkbox" />
|
||||
<span data-i18n="Show reply prefix in chat">
|
||||
Show reply prefix in chat
|
||||
</span>
|
||||
</label>
|
||||
<div>
|
||||
<h4 data-i18n="Non-markdown strings">
|
||||
Non-markdown strings
|
||||
<h4 class="range-block-title justifyLeft">
|
||||
<span data-i18n="Non-markdown strings">
|
||||
Non-markdown strings
|
||||
</span>
|
||||
</h4>
|
||||
<div>
|
||||
<input id="markdown_escape_strings" class="text_pole textarea_compact" type="text" data-i18n="[placeholder]separate with commas w/o space between" placeholder="separate with commas w/o space between" maxlength="100" />
|
||||
</div>
|
||||
</div>
|
||||
<h4>
|
||||
<div class="range-block-title justifyLeft">
|
||||
<div>
|
||||
<h4 class="range-block-title justifyLeft">
|
||||
<span data-i18n="Custom Stopping Strings">
|
||||
Custom Stopping Strings
|
||||
</span>
|
||||
<a href="https://docs.sillytavern.app/usage/core-concepts/advancedformatting/#custom-stopping-strings" class="notes-link" target="_blank">
|
||||
<span class="note-link-span">?</span>
|
||||
</a>
|
||||
</div>
|
||||
</h4>
|
||||
<div>
|
||||
<small>
|
||||
<span data-i18n="JSON serialized array of strings">JSON serialized array of strings, for example:</span><br>
|
||||
<span class="monospace">["\n", "\nUser:", "\nChar:"]</span>
|
||||
<span data-i18n="JSON serialized array of strings">JSON serialized array of strings</span>
|
||||
</small>
|
||||
</div>
|
||||
</h4>
|
||||
<div>
|
||||
<textarea id="custom_stopping_strings" rows="2" class="text_pole textarea_compact monospace" placeholder="["Ford", "BMW", "Fiat"]"></textarea>
|
||||
<div>
|
||||
<textarea id="custom_stopping_strings" rows="2" class="text_pole textarea_compact monospace" placeholder="["Ford", "BMW", "Fiat"]"></textarea>
|
||||
</div>
|
||||
<label class="checkbox_label" for="custom_stopping_strings_macro">
|
||||
<input id="custom_stopping_strings_macro" type="checkbox" checked>
|
||||
<span data-i18n="Replace Macro in Custom Stopping Strings">
|
||||
Replace Macro in Custom Stopping Strings
|
||||
</span>
|
||||
</label>
|
||||
</div>
|
||||
<label class="checkbox_label" for="custom_stopping_strings_macro">
|
||||
<input id="custom_stopping_strings_macro" type="checkbox" checked>
|
||||
<span data-i18n="Replace Macro in Custom Stopping Strings">
|
||||
Replace Macro in Custom Stopping Strings
|
||||
</span>
|
||||
</label>
|
||||
</div>
|
||||
<div data-newbie-hidden>
|
||||
<h4>
|
||||
|
|
|
@ -1840,6 +1840,10 @@ function getStoppingStrings(isImpersonate) {
|
|||
result.push(...customStoppingStrings);
|
||||
}
|
||||
|
||||
if (power_user.single_line) {
|
||||
result.unshift('\n');
|
||||
}
|
||||
|
||||
return result.filter(onlyUnique);
|
||||
}
|
||||
|
||||
|
|
|
@ -20,7 +20,6 @@ export const kai_settings = {
|
|||
typical: 1,
|
||||
tfs: 1,
|
||||
rep_pen_slope: 0.9,
|
||||
single_line: false,
|
||||
streaming_kobold: false,
|
||||
sampler_order: [0, 1, 2, 3, 4, 5, 6],
|
||||
mirostat: 0,
|
||||
|
@ -76,11 +75,6 @@ export function loadKoboldSettings(preset) {
|
|||
$(slider.counterId).val(formattedValue);
|
||||
}
|
||||
|
||||
// TODO: refactor checkboxes (if adding any more)
|
||||
if (preset.hasOwnProperty('single_line')) {
|
||||
kai_settings.single_line = preset.single_line;
|
||||
$('#single_line').prop('checked', kai_settings.single_line);
|
||||
}
|
||||
if (preset.hasOwnProperty('streaming_kobold')) {
|
||||
kai_settings.streaming_kobold = preset.streaming_kobold;
|
||||
$('#streaming_kobold').prop('checked', kai_settings.streaming_kobold);
|
||||
|
@ -128,7 +122,7 @@ export function getKoboldGenerationData(finalPrompt, settings, maxLength, maxCon
|
|||
s6: sampler_order[5],
|
||||
s7: sampler_order[6],
|
||||
use_world_info: false,
|
||||
singleline: kai_settings.single_line,
|
||||
singleline: false,
|
||||
stop_sequence: (kai_flags.can_use_stop_sequence || isHorde) ? getStoppingStrings(isImpersonate) : undefined,
|
||||
streaming: kai_settings.streaming_kobold && kai_flags.can_use_streaming && type !== 'quiet',
|
||||
can_abort: kai_flags.can_use_streaming,
|
||||
|
@ -389,12 +383,6 @@ jQuery(function () {
|
|||
});
|
||||
});
|
||||
|
||||
$('#single_line').on("input", function () {
|
||||
const value = !!$(this).prop('checked');
|
||||
kai_settings.single_line = value;
|
||||
saveSettingsDebounced();
|
||||
});
|
||||
|
||||
$('#streaming_kobold').on("input", function () {
|
||||
const value = !!$(this).prop('checked');
|
||||
kai_settings.streaming_kobold = value;
|
||||
|
|
|
@ -170,6 +170,7 @@ let power_user = {
|
|||
relaxed_api_urls: false,
|
||||
world_import_dialog: true,
|
||||
disable_group_trimming: false,
|
||||
single_line: false,
|
||||
|
||||
default_instruct: '',
|
||||
instruct: {
|
||||
|
@ -259,11 +260,10 @@ const contextControls = [
|
|||
{ id: "context_chat_start", property: "chat_start", isCheckbox: false, isGlobalSetting: false },
|
||||
|
||||
// Existing power user settings
|
||||
{ id: "always-force-name2-checkbox", property: "always_force_name2", isCheckbox: true, isGlobalSetting: true },
|
||||
{ id: "trim_sentences_checkbox", property: "trim_sentences", isCheckbox: true, isGlobalSetting: true },
|
||||
{ id: "include_newline_checkbox", property: "include_newline", isCheckbox: true, isGlobalSetting: true },
|
||||
{ id: "custom_stopping_strings", property: "custom_stopping_strings", isCheckbox: false, isGlobalSetting: true },
|
||||
{ id: "custom_stopping_strings_macro", property: "custom_stopping_strings_macro", isCheckbox: true, isGlobalSetting: true }
|
||||
{ id: "always-force-name2-checkbox", property: "always_force_name2", isCheckbox: true, isGlobalSetting: true, defaultValue: true },
|
||||
{ id: "trim_sentences_checkbox", property: "trim_sentences", isCheckbox: true, isGlobalSetting: true, defaultValue: false },
|
||||
{ id: "include_newline_checkbox", property: "include_newline", isCheckbox: true, isGlobalSetting: true, defaultValue: false },
|
||||
{ id: "single_line", property: "single_line", isCheckbox: true, isGlobalSetting: true, defaultValue: false },
|
||||
];
|
||||
|
||||
let browser_has_focus = true;
|
||||
|
@ -924,6 +924,7 @@ function loadPowerUserSettings(settings, data) {
|
|||
power_user.tokenizer = tokenizers.GPT2;
|
||||
}
|
||||
|
||||
$('#single_line').prop("checked", power_user.single_line);
|
||||
$('#relaxed_api_urls').prop("checked", power_user.relaxed_api_urls);
|
||||
$('#world_import_dialog').prop("checked", power_user.world_import_dialog);
|
||||
$('#trim_spaces').prop("checked", power_user.trim_spaces);
|
||||
|
@ -1173,11 +1174,13 @@ function loadContextSettings() {
|
|||
|
||||
power_user.context.preset = name;
|
||||
contextControls.forEach(control => {
|
||||
if (preset[control.property] !== undefined) {
|
||||
const presetValue = preset[control.property] ?? control.defaultValue;
|
||||
|
||||
if (presetValue !== undefined) {
|
||||
if (control.isGlobalSetting) {
|
||||
power_user[control.property] = preset[control.property];
|
||||
power_user[control.property] = presetValue;
|
||||
} else {
|
||||
power_user.context[control.property] = preset[control.property];
|
||||
power_user.context[control.property] = presetValue;
|
||||
}
|
||||
|
||||
const $element = $(`#${control.id}`);
|
||||
|
@ -1938,6 +1941,12 @@ $(document).ready(() => {
|
|||
saveSettingsDebounced();
|
||||
});
|
||||
|
||||
$('#single_line').on("input", function () {
|
||||
const value = !!$(this).prop('checked');
|
||||
power_user.single_line = value;
|
||||
saveSettingsDebounced();
|
||||
});
|
||||
|
||||
$("#always-force-name2-checkbox").change(function () {
|
||||
power_user.always_force_name2 = !!$(this).prop("checked");
|
||||
saveSettingsDebounced();
|
||||
|
@ -2115,7 +2124,6 @@ $(document).ready(() => {
|
|||
saveSettingsDebounced();
|
||||
});
|
||||
|
||||
|
||||
$("#user-mes-blur-tint-color-picker").on('change', (evt) => {
|
||||
power_user.user_mes_blur_tint_color = evt.detail.rgba;
|
||||
applyThemeColor('userMesBlurTint');
|
||||
|
@ -2153,7 +2161,6 @@ $(document).ready(() => {
|
|||
power_user.movingUIPreset = movingUIPresetSelected;
|
||||
applyMovingUIPreset(movingUIPresetSelected);
|
||||
saveSettingsDebounced();
|
||||
|
||||
});
|
||||
|
||||
$("#ui-preset-save-button").on('click', saveTheme);
|
||||
|
|
Loading…
Reference in New Issue