More formatting options

This commit is contained in:
SillyLossy
2023-04-16 17:26:08 +03:00
parent b2d8510b87
commit 269bd69d7c
3 changed files with 37 additions and 11 deletions

View File

@ -983,6 +983,14 @@
<input id="disable-personality-formatting-checkbox" type="checkbox" /> <input id="disable-personality-formatting-checkbox" type="checkbox" />
Disable personality formatting Disable personality formatting
</label> </label>
<label class="checkbox_label" for="disable-examples-formatting-checkbox">
<input id="disable-examples-formatting-checkbox" type="checkbox" />
Disable example chats formatting
</label>
<label class="checkbox_label" for="disable-start-formatting-checkbox">
<input id="disable-start-formatting-checkbox" type="checkbox" />
Disable chat start formatting
</label>
<div> <div>
<h4> <h4>
Custom Chat Separator Custom Chat Separator

View File

@ -1475,7 +1475,8 @@ async function Generate(type, automatic_trigger, force_name2) {
if (!storyString.endsWith('\n')) { if (!storyString.endsWith('\n')) {
storyString += '\n'; storyString += '\n';
} }
example = example.replace(/<START>/i, 'This is how ' + name2 + ' should talk');//An example of how '+name2+' responds const replaceString = power_user.disable_examples_formatting ? `This is how ${name2} should talk` : '';
example = example.replace(/<START>/i, replaceString);
} }
storyString += appendToStoryString(example, ''); storyString += appendToStoryString(example, '');
} }
@ -1617,6 +1618,10 @@ async function Generate(type, automatic_trigger, force_name2) {
const prompt = JSON.stringify(worldInfoString + storyString + mesExmString + chatString + anchorTop + anchorBottom + charPersonality + promptBias + allAnchors); const prompt = JSON.stringify(worldInfoString + storyString + mesExmString + chatString + anchorTop + anchorBottom + charPersonality + promptBias + allAnchors);
const tokenCount = getTokenCount(prompt, padding_tokens); const tokenCount = getTokenCount(prompt, padding_tokens);
if (tokenCount < this_max_context) { if (tokenCount < this_max_context) {
if (power_user.disable_examples_formatting) {
mesExamplesArray[iii] = mesExamplesArray[iii].replace(/<START>/i, '');
}
if (!is_pygmalion) { if (!is_pygmalion) {
mesExamplesArray[iii] = mesExamplesArray[iii].replace(/<START>/i, `This is how ${name2} should talk`); mesExamplesArray[iii] = mesExamplesArray[iii].replace(/<START>/i, `This is how ${name2} should talk`);
} }
@ -1773,6 +1778,10 @@ async function Generate(type, automatic_trigger, force_name2) {
if (power_user.custom_chat_separator && power_user.custom_chat_separator.length) { if (power_user.custom_chat_separator && power_user.custom_chat_separator.length) {
mesSendString = power_user.custom_chat_separator + '\n' + mesSendString; mesSendString = power_user.custom_chat_separator + '\n' + mesSendString;
} }
// if chat start formatting is disabled
else if (power_user.disable_start_formatting) {
mesSendString = mesSendString;
}
// add non-pygma dingus // add non-pygma dingus
else if (!is_pygmalion) { else if (!is_pygmalion) {
mesSendString = '\nThen the roleplay chat between ' + name1 + ' and ' + name2 + ' begins.\n' + mesSendString; mesSendString = '\nThen the roleplay chat between ' + name1 + ' and ' + name2 + ' begins.\n' + mesSendString;

View File

@ -45,6 +45,8 @@ let power_user = {
disable_description_formatting: false, disable_description_formatting: false,
disable_scenario_formatting: false, disable_scenario_formatting: false,
disable_personality_formatting: false, disable_personality_formatting: false,
disable_examples_formatting: false,
disable_start_formatting: false,
always_force_name2: false, always_force_name2: false,
multigen: false, multigen: false,
multigen_first_chunk: 50, multigen_first_chunk: 50,
@ -149,11 +151,6 @@ function applySheldWidth() {
} }
async function applyThemeColor(type) { async function applyThemeColor(type) {
const $MainTextColorPicker = document.getElementById('main-text-color-picker');
const $ItalicsTextColorPicker = document.getElementById('italics-color-picker');
const $FastUIBGColorPicker = document.getElementById('fastui-bg-color-picker');
const $BlurTintColorPicker = document.getElementById('blur-tint-color-picker');
// temporarily unset transition from chat to not make the browser calculate the animation // temporarily unset transition from chat to not make the browser calculate the animation
chat.style.transition = 'unset'; chat.style.transition = 'unset';
@ -286,6 +283,8 @@ function loadPowerUserSettings(settings, data) {
$("#disable-scenario-formatting-checkbox").prop("checked", power_user.disable_scenario_formatting); $("#disable-scenario-formatting-checkbox").prop("checked", power_user.disable_scenario_formatting);
$("#disable-personality-formatting-checkbox").prop("checked", power_user.disable_personality_formatting); $("#disable-personality-formatting-checkbox").prop("checked", power_user.disable_personality_formatting);
$("#always-force-name2-checkbox").prop("checked", power_user.always_force_name2); $("#always-force-name2-checkbox").prop("checked", power_user.always_force_name2);
$("#disable-examples-formatting-checkbox").prop("checked", power_user.disable_examples_formatting);
$('#disable-start-formatting-checkbox').prop("checked", power_user.disable_start_formatting);
$("#custom_chat_separator").val(power_user.custom_chat_separator); $("#custom_chat_separator").val(power_user.custom_chat_separator);
$("#fast_ui_mode").prop("checked", power_user.fast_ui_mode); $("#fast_ui_mode").prop("checked", power_user.fast_ui_mode);
$("#waifuMode").prop("checked", power_user.waifuMode); $("#waifuMode").prop("checked", power_user.waifuMode);
@ -369,6 +368,16 @@ $(document).ready(() => {
saveSettingsDebounced(); saveSettingsDebounced();
}); });
$("#disable-examples-formatting-checkbox").change(function () {
power_user.disable_examples_formatting = !!$(this).prop('checked');
saveSettingsDebounced();
})
$("#disable-start-formatting-checkbox").change(function () {
power_user.disable_start_formatting = !!$(this).prop('checked');
saveSettingsDebounced();
});
$("#always-force-name2-checkbox").change(function () { $("#always-force-name2-checkbox").change(function () {
power_user.always_force_name2 = !!$(this).prop("checked"); power_user.always_force_name2 = !!$(this).prop("checked");
saveSettingsDebounced(); saveSettingsDebounced();
@ -416,18 +425,18 @@ $(document).ready(() => {
applySheldWidth(); applySheldWidth();
}); });
$(`input[name="font_scale"]`).on('input', function (e) { $(`input[name="font_scale"]`).on('input', async function (e) {
power_user.font_scale = Number(e.target.value); power_user.font_scale = Number(e.target.value);
$("#font_scale_counter").text(power_user.font_scale); $("#font_scale_counter").text(power_user.font_scale);
localStorage.setItem(storage_keys.font_scale, power_user.font_scale); localStorage.setItem(storage_keys.font_scale, power_user.font_scale);
applyFontScale(); await applyFontScale();
}); });
$(`input[name="blur_strength"]`).on('input', function (e) { $(`input[name="blur_strength"]`).on('input', async function (e) {
power_user.blur_strength = Number(e.target.value); power_user.blur_strength = Number(e.target.value);
$("#blur_strength_counter").text(power_user.blur_strength); $("#blur_strength_counter").text(power_user.blur_strength);
localStorage.setItem(storage_keys.blur_strength, power_user.blur_strength); localStorage.setItem(storage_keys.blur_strength, power_user.blur_strength);
applyBlurStrength(); await applyBlurStrength();
}); });
$("#main-text-color-picker").on('change', (evt) => { $("#main-text-color-picker").on('change', (evt) => {