Remove "include newlines" checkbox from context formatting settings

This commit is contained in:
Cohee 2024-09-22 19:55:43 +03:00
parent 93bf87b035
commit a18dae8f69
32 changed files with 19 additions and 74 deletions

View File

@ -6,7 +6,6 @@
"allow_jailbreak": false, "allow_jailbreak": false,
"always_force_name2": false, "always_force_name2": false,
"trim_sentences": false, "trim_sentences": false,
"include_newline": false,
"single_line": true, "single_line": true,
"name": "Adventure" "name": "Adventure"
} }

View File

@ -6,7 +6,6 @@
"allow_jailbreak": false, "allow_jailbreak": false,
"always_force_name2": true, "always_force_name2": true,
"trim_sentences": false, "trim_sentences": false,
"include_newline": false,
"single_line": false, "single_line": false,
"name": "Alpaca-Roleplay" "name": "Alpaca-Roleplay"
} }

View File

@ -6,7 +6,6 @@
"allow_jailbreak": false, "allow_jailbreak": false,
"always_force_name2": false, "always_force_name2": false,
"trim_sentences": false, "trim_sentences": false,
"include_newline": false,
"single_line": false, "single_line": false,
"name": "Alpaca-Single-Turn" "name": "Alpaca-Single-Turn"
} }

View File

@ -6,7 +6,6 @@
"allow_jailbreak": false, "allow_jailbreak": false,
"always_force_name2": true, "always_force_name2": true,
"trim_sentences": false, "trim_sentences": false,
"include_newline": false,
"single_line": false, "single_line": false,
"name": "Alpaca" "name": "Alpaca"
} }

View File

@ -6,7 +6,6 @@
"allow_jailbreak": false, "allow_jailbreak": false,
"always_force_name2": true, "always_force_name2": true,
"trim_sentences": false, "trim_sentences": false,
"include_newline": false,
"single_line": false, "single_line": false,
"name": "ChatML-Names" "name": "ChatML-Names"
} }

View File

@ -6,7 +6,6 @@
"allow_jailbreak": false, "allow_jailbreak": false,
"always_force_name2": true, "always_force_name2": true,
"trim_sentences": false, "trim_sentences": false,
"include_newline": false,
"single_line": false, "single_line": false,
"name": "ChatML" "name": "ChatML"
} }

View File

@ -6,7 +6,6 @@
"allow_jailbreak": false, "allow_jailbreak": false,
"always_force_name2": true, "always_force_name2": true,
"trim_sentences": false, "trim_sentences": false,
"include_newline": false,
"single_line": false, "single_line": false,
"name": "Command R" "name": "Command R"
} }

View File

@ -6,7 +6,6 @@
"allow_jailbreak": false, "allow_jailbreak": false,
"always_force_name2": true, "always_force_name2": true,
"trim_sentences": false, "trim_sentences": false,
"include_newline": false,
"single_line": false, "single_line": false,
"name": "Default" "name": "Default"
} }

View File

@ -6,7 +6,6 @@
"allow_jailbreak": false, "allow_jailbreak": false,
"always_force_name2": false, "always_force_name2": false,
"trim_sentences": true, "trim_sentences": true,
"include_newline": false,
"single_line": false, "single_line": false,
"name": "DreamGen Role-Play V1 ChatML" "name": "DreamGen Role-Play V1 ChatML"
} }

View File

@ -6,7 +6,6 @@
"allow_jailbreak": false, "allow_jailbreak": false,
"always_force_name2": false, "always_force_name2": false,
"trim_sentences": true, "trim_sentences": true,
"include_newline": false,
"single_line": false, "single_line": false,
"name": "DreamGen Role-Play V1 Llama3" "name": "DreamGen Role-Play V1 Llama3"
} }

View File

@ -6,7 +6,6 @@
"allow_jailbreak": false, "allow_jailbreak": false,
"always_force_name2": true, "always_force_name2": true,
"trim_sentences": false, "trim_sentences": false,
"include_newline": false,
"single_line": false, "single_line": false,
"name": "Gemma 2" "name": "Gemma 2"
} }

View File

@ -6,7 +6,6 @@
"allow_jailbreak": false, "allow_jailbreak": false,
"always_force_name2": true, "always_force_name2": true,
"trim_sentences": false, "trim_sentences": false,
"include_newline": false,
"single_line": false, "single_line": false,
"name": "Libra-32B" "name": "Libra-32B"
} }

View File

@ -6,7 +6,6 @@
"allow_jailbreak": false, "allow_jailbreak": false,
"always_force_name2": true, "always_force_name2": true,
"trim_sentences": false, "trim_sentences": false,
"include_newline": false,
"single_line": false, "single_line": false,
"name": "Lightning 1.1" "name": "Lightning 1.1"
} }

View File

@ -6,7 +6,6 @@
"allow_jailbreak": false, "allow_jailbreak": false,
"always_force_name2": true, "always_force_name2": true,
"trim_sentences": false, "trim_sentences": false,
"include_newline": false,
"single_line": false, "single_line": false,
"name": "Llama 2 Chat" "name": "Llama 2 Chat"
} }

View File

@ -6,7 +6,6 @@
"allow_jailbreak": false, "allow_jailbreak": false,
"always_force_name2": true, "always_force_name2": true,
"trim_sentences": false, "trim_sentences": false,
"include_newline": false,
"single_line": false, "single_line": false,
"name": "Llama 3 Instruct" "name": "Llama 3 Instruct"
} }

View File

@ -6,7 +6,6 @@
"allow_jailbreak": false, "allow_jailbreak": false,
"always_force_name2": true, "always_force_name2": true,
"trim_sentences": false, "trim_sentences": false,
"include_newline": false,
"single_line": false, "single_line": false,
"name": "Llama-3-Instruct-Names" "name": "Llama-3-Instruct-Names"
} }

View File

@ -6,7 +6,6 @@
"allow_jailbreak": false, "allow_jailbreak": false,
"always_force_name2": true, "always_force_name2": true,
"trim_sentences": false, "trim_sentences": false,
"include_newline": false,
"single_line": false, "single_line": false,
"name": "Minimalist" "name": "Minimalist"
} }

View File

@ -6,7 +6,6 @@
"allow_jailbreak": false, "allow_jailbreak": false,
"always_force_name2": true, "always_force_name2": true,
"trim_sentences": false, "trim_sentences": false,
"include_newline": false,
"single_line": false, "single_line": false,
"name": "Mistral V1" "name": "Mistral V1"
} }

View File

@ -6,7 +6,6 @@
"allow_jailbreak": false, "allow_jailbreak": false,
"always_force_name2": true, "always_force_name2": true,
"trim_sentences": false, "trim_sentences": false,
"include_newline": false,
"single_line": false, "single_line": false,
"name": "Mistral V2 & V3" "name": "Mistral V2 & V3"
} }

View File

@ -6,7 +6,6 @@
"allow_jailbreak": false, "allow_jailbreak": false,
"always_force_name2": true, "always_force_name2": true,
"trim_sentences": false, "trim_sentences": false,
"include_newline": false,
"single_line": false, "single_line": false,
"name": "Mistral V3-Tekken" "name": "Mistral V3-Tekken"
} }

View File

@ -6,7 +6,6 @@
"allow_jailbreak": false, "allow_jailbreak": false,
"always_force_name2": true, "always_force_name2": true,
"trim_sentences": false, "trim_sentences": false,
"include_newline": false,
"single_line": false, "single_line": false,
"name": "NovelAI" "name": "NovelAI"
} }

View File

@ -6,7 +6,6 @@
"allow_jailbreak": false, "allow_jailbreak": false,
"always_force_name2": true, "always_force_name2": true,
"trim_sentences": false, "trim_sentences": false,
"include_newline": false,
"single_line": false, "single_line": false,
"name": "OldDefault" "name": "OldDefault"
} }

View File

@ -6,7 +6,6 @@
"allow_jailbreak": false, "allow_jailbreak": false,
"always_force_name2": true, "always_force_name2": true,
"trim_sentences": false, "trim_sentences": false,
"include_newline": false,
"single_line": false, "single_line": false,
"name": "Phi" "name": "Phi"
} }

View File

@ -6,7 +6,6 @@
"allow_jailbreak": false, "allow_jailbreak": false,
"always_force_name2": true, "always_force_name2": true,
"trim_sentences": false, "trim_sentences": false,
"include_newline": false,
"single_line": false, "single_line": false,
"name": "Pygmalion" "name": "Pygmalion"
} }

View File

@ -6,7 +6,6 @@
"allow_jailbreak": false, "allow_jailbreak": false,
"always_force_name2": true, "always_force_name2": true,
"trim_sentences": false, "trim_sentences": false,
"include_newline": false,
"single_line": false, "single_line": false,
"name": "Story" "name": "Story"
} }

View File

@ -6,7 +6,6 @@
"allow_jailbreak": false, "allow_jailbreak": false,
"always_force_name2": true, "always_force_name2": true,
"trim_sentences": false, "trim_sentences": false,
"include_newline": false,
"single_line": false, "single_line": false,
"name": "Synthia" "name": "Synthia"
} }

View File

@ -6,7 +6,6 @@
"allow_jailbreak": false, "allow_jailbreak": false,
"always_force_name2": true, "always_force_name2": true,
"trim_sentences": false, "trim_sentences": false,
"include_newline": false,
"single_line": false, "single_line": false,
"name": "simple-proxy-for-tavern" "name": "simple-proxy-for-tavern"
} }

View File

@ -90,7 +90,6 @@
"pin_examples": false, "pin_examples": false,
"strip_examples": false, "strip_examples": false,
"trim_sentences": false, "trim_sentences": false,
"include_newline": false,
"always_force_name2": true, "always_force_name2": true,
"user_prompt_bias": "", "user_prompt_bias": "",
"show_user_prompt_bias": true, "show_user_prompt_bias": true,

View File

@ -3251,11 +3251,6 @@
Trim Incomplete Sentences Trim Incomplete Sentences
</small> </small>
</label> </label>
<!-- Add margin since this is a child of above -->
<label class="checkbox_label indent20p" for="include_newline_checkbox">
<input id="include_newline_checkbox" type="checkbox" />
<small data-i18n="Include Newline">Include Newline</small>
</label>
<label class="checkbox_label" title="Add Chat Start and Example Separator to a list of stopping strings." data-i18n="[title]Add Chat Start and Example Separator to a list of stopping strings."> <label class="checkbox_label" title="Add Chat Start and Example Separator to a list of stopping strings." data-i18n="[title]Add Chat Start and Example Separator to a list of stopping strings.">
<input id="context_use_stop_strings" type="checkbox" /> <input id="context_use_stop_strings" type="checkbox" />
<small data-i18n="Separators as Stop Strings">Separators as Stop Strings</small> <small data-i18n="Separators as Stop Strings">Separators as Stop Strings</small>

View File

@ -5480,7 +5480,7 @@ export function cleanUpMessage(getMessage, isImpersonate, isContinue, displayInc
} }
if (!displayIncompleteSentences && power_user.trim_sentences) { if (!displayIncompleteSentences && power_user.trim_sentences) {
getMessage = trimToEndSentence(getMessage, power_user.include_newline); getMessage = trimToEndSentence(getMessage);
} }
if (power_user.trim_spaces) { if (power_user.trim_spaces) {

View File

@ -114,7 +114,6 @@ let power_user = {
pin_examples: false, pin_examples: false,
strip_examples: false, strip_examples: false,
trim_sentences: false, trim_sentences: false,
include_newline: false,
always_force_name2: false, always_force_name2: false,
user_prompt_bias: '', user_prompt_bias: '',
show_user_prompt_bias: true, show_user_prompt_bias: true,
@ -317,7 +316,6 @@ const contextControls = [
// Existing power user settings // Existing power user settings
{ id: 'always-force-name2-checkbox', property: 'always_force_name2', isCheckbox: true, isGlobalSetting: true, defaultValue: 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: '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 }, { id: 'single_line', property: 'single_line', isCheckbox: true, isGlobalSetting: true, defaultValue: false },
]; ];
@ -1487,7 +1485,6 @@ async function loadPowerUserSettings(settings, data) {
$('#collapse-newlines-checkbox').prop('checked', power_user.collapse_newlines); $('#collapse-newlines-checkbox').prop('checked', power_user.collapse_newlines);
$('#always-force-name2-checkbox').prop('checked', power_user.always_force_name2); $('#always-force-name2-checkbox').prop('checked', power_user.always_force_name2);
$('#trim_sentences_checkbox').prop('checked', power_user.trim_sentences); $('#trim_sentences_checkbox').prop('checked', power_user.trim_sentences);
$('#include_newline_checkbox').prop('checked', power_user.include_newline);
$('#render_formulas').prop('checked', power_user.render_formulas); $('#render_formulas').prop('checked', power_user.render_formulas);
$('#disable_group_trimming').prop('checked', power_user.disable_group_trimming); $('#disable_group_trimming').prop('checked', power_user.disable_group_trimming);
$('#markdown_escape_strings').val(power_user.markdown_escape_strings); $('#markdown_escape_strings').val(power_user.markdown_escape_strings);
@ -3069,19 +3066,6 @@ $(document).ready(() => {
// if trim sentences is unchecked, include newline must be unchecked // if trim sentences is unchecked, include newline must be unchecked
$('#trim_sentences_checkbox').change(function () { $('#trim_sentences_checkbox').change(function () {
power_user.trim_sentences = !!$(this).prop('checked'); power_user.trim_sentences = !!$(this).prop('checked');
if (!$(this).prop('checked')) {
$('#include_newline_checkbox').prop('checked', false);
power_user.include_newline = false;
}
saveSettingsDebounced();
});
$('#include_newline_checkbox').change(function () {
power_user.include_newline = !!$(this).prop('checked');
if ($(this).prop('checked')) {
$('#trim_sentences_checkbox').prop('checked', true);
power_user.trim_sentences = true;
}
saveSettingsDebounced(); saveSettingsDebounced();
}); });

View File

@ -607,12 +607,11 @@ export function sortByCssOrder(a, b) {
/** /**
* Trims a string to the end of a nearest sentence. * Trims a string to the end of a nearest sentence.
* @param {string} input The string to trim. * @param {string} input The string to trim.
* @param {boolean} include_newline Whether to include a newline character in the trimmed string.
* @returns {string} The trimmed string. * @returns {string} The trimmed string.
* @example * @example
* trimToEndSentence('Hello, world! I am from'); // 'Hello, world!' * trimToEndSentence('Hello, world! I am from'); // 'Hello, world!'
*/ */
export function trimToEndSentence(input, include_newline = false) { export function trimToEndSentence(input) {
if (!input) { if (!input) {
return ''; return '';
} }
@ -633,11 +632,6 @@ export function trimToEndSentence(input, include_newline = false) {
} }
break; break;
} }
if (include_newline && char === '\n') {
last = i;
break;
}
} }
if (last === -1) { if (last === -1) {