diff --git a/public/index.html b/public/index.html index 7051db97a..49dd405f0 100644 --- a/public/index.html +++ b/public/index.html @@ -1282,6 +1282,45 @@ + +
+

+ + +
+
+

+
+
+ Multiplier + + +
+
+ Base + + +
+
+ Allowed Length + + +
+
+ Penalty Range + + +
+
+
+
+ Sequence Breakers +
+
+ +
+
+

diff --git a/public/script.js b/public/script.js index 7dbe20253..fb0fa5546 100644 --- a/public/script.js +++ b/public/script.js @@ -684,6 +684,7 @@ export function reloadMarkdownProcessor(render_formulas = false) { parseImgDimensions: true, simpleLineBreaks: true, strikethrough: true, + disableForced4SpacesIndentedSublists: true, extensions: [ showdownKatex( { @@ -704,6 +705,7 @@ export function reloadMarkdownProcessor(render_formulas = false) { underline: true, simpleLineBreaks: true, strikethrough: true, + disableForced4SpacesIndentedSublists: true, extensions: [markdownUnderscoreExt()], }); } diff --git a/public/scripts/extensions/stable-diffusion/index.js b/public/scripts/extensions/stable-diffusion/index.js index 9d34e6db3..db7f3b92f 100644 --- a/public/scripts/extensions/stable-diffusion/index.js +++ b/public/scripts/extensions/stable-diffusion/index.js @@ -3160,7 +3160,9 @@ jQuery(async () => { } eventSource.on(event_types.EXTRAS_CONNECTED, async () => { - await loadSettingOptions(); + if (extension_settings.sd.source === sources.extras) { + await loadSettingOptions(); + } }); eventSource.on(event_types.CHAT_CHANGED, onChatChanged); diff --git a/public/scripts/extensions/stable-diffusion/settings.html b/public/scripts/extensions/stable-diffusion/settings.html index 70c0913ce..417e99c5e 100644 --- a/public/scripts/extensions/stable-diffusion/settings.html +++ b/public/scripts/extensions/stable-diffusion/settings.html @@ -72,7 +72,7 @@
- + Important: run DrawThings app with HTTP API switch enabled in the UI! The server must be accessible from the SillyTavern host machine.

diff --git a/public/scripts/power-user.js b/public/scripts/power-user.js index 464fb4adb..a39172415 100644 --- a/public/scripts/power-user.js +++ b/public/scripts/power-user.js @@ -678,6 +678,8 @@ async function CreateZenSliders(elmnt) { sliderID == 'top_k' || sliderID == 'mirostat_mode_kobold' || sliderID == 'rep_pen_range' || + sliderID == 'dry_allowed_length_textgenerationwebui' || + sliderID == 'dry_penalty_last_n_textgenerationwebui' || sliderID == 'max_tokens_second_textgenerationwebui') { decimals = 0; } @@ -685,7 +687,9 @@ async function CreateZenSliders(elmnt) { sliderID == 'max_temp_textgenerationwebui' || sliderID == 'dynatemp_exponent_textgenerationwebui' || sliderID == 'smoothing_curve_textgenerationwebui' || - sliderID == 'smoothing_factor_textgenerationwebui') { + sliderID == 'smoothing_factor_textgenerationwebui' || + sliderID == 'dry_multiplier_textgenerationwebui' || + sliderID == 'dry_base_textgenerationwebui') { decimals = 2; } if (sliderID == 'eta_cutoff_textgenerationwebui' || @@ -746,8 +750,9 @@ async function CreateZenSliders(elmnt) { sliderID == 'rep_pen_slope' || sliderID == 'smoothing_factor_textgenerationwebui' || sliderID == 'smoothing_curve_textgenerationwebui' || - sliderID == 'min_length_textgenerationwebui' || - sliderID == 'skew_textgenerationwebui') { + sliderID == 'skew_textgenerationwebui' || + sliderID == 'dry_multiplier_textgenerationwebui' || + sliderID == 'min_length_textgenerationwebui') { offVal = 0; } if (sliderID == 'rep_pen_textgenerationwebui' || @@ -1755,11 +1760,21 @@ function loadMaxContextUnlocked() { } function switchMaxContextSize() { - const elements = [$('#max_context'), $('#max_context_counter'), $('#rep_pen_range'), $('#rep_pen_range_counter'), $('#rep_pen_range_textgenerationwebui'), $('#rep_pen_range_counter_textgenerationwebui')]; + const elements = [ + $('#max_context'), + $('#max_context_counter'), + $('#rep_pen_range'), + $('#rep_pen_range_counter'), + $('#rep_pen_range_textgenerationwebui'), + $('#rep_pen_range_counter_textgenerationwebui'), + $('#dry_penalty_last_n_textgenerationwebui'), + $('#dry_penalty_last_n_counter_textgenerationwebui'), + ]; const maxValue = power_user.max_context_unlocked ? MAX_CONTEXT_UNLOCKED : MAX_CONTEXT_DEFAULT; const minValue = power_user.max_context_unlocked ? maxContextMin : maxContextMin; const steps = power_user.max_context_unlocked ? unlockedMaxContextStep : maxContextStep; $('#rep_pen_range_textgenerationwebui_zenslider').remove(); //unsure why, but this is necessary. + $('#dry_penalty_last_n_textgenerationwebui_zenslider').remove(); for (const element of elements) { const id = element.attr('id'); element.attr('max', maxValue); @@ -1788,6 +1803,8 @@ function switchMaxContextSize() { CreateZenSliders($('#max_context')); $('#rep_pen_range_textgenerationwebui_zenslider').remove(); CreateZenSliders($('#rep_pen_range_textgenerationwebui')); + $('#dry_penalty_last_n_textgenerationwebui_zenslider').remove(); + CreateZenSliders($('#dry_penalty_last_n_textgenerationwebui')); } } @@ -3010,7 +3027,7 @@ $(document).ready(() => { var coreTruthWinHeight = window.innerHeight; $(window).on('resize', async () => { - console.log(`Window resize: ${coreTruthWinWidth}x${coreTruthWinHeight} -> ${window.innerWidth}x${window.innerHeight}`) + console.log(`Window resize: ${coreTruthWinWidth}x${coreTruthWinHeight} -> ${window.innerWidth}x${window.innerHeight}`); adjustAutocompleteDebounced(); setHotswapsDebounced(); @@ -3063,7 +3080,7 @@ $(document).ready(() => { } } } else { - console.log('aborting MUI reset', Object.keys(power_user.movingUIState).length) + console.log('aborting MUI reset', Object.keys(power_user.movingUIState).length); } saveSettingsDebounced(); coreTruthWinWidth = window.innerWidth; diff --git a/public/scripts/textgen-settings.js b/public/scripts/textgen-settings.js index 43e5a7a4f..9d2cd6214 100644 --- a/public/scripts/textgen-settings.js +++ b/public/scripts/textgen-settings.js @@ -118,6 +118,11 @@ const settings = { dynatemp_exponent: 1.0, smoothing_factor: 0.0, smoothing_curve: 1.0, + dry_allowed_length: 2, + dry_multiplier: 0.0, + dry_base: 1.75, + dry_sequence_breakers: '["\\n", ":", "\\"", "*"]', + dry_penalty_last_n: 0, max_tokens_second: 0, seed: -1, preset: 'Default', @@ -194,6 +199,11 @@ export const setting_names = [ 'dynatemp_exponent', 'smoothing_factor', 'smoothing_curve', + 'dry_allowed_length', + 'dry_multiplier', + 'dry_base', + 'dry_sequence_breakers', + 'dry_penalty_last_n', 'max_tokens_second', 'encoder_rep_pen', 'freq_pen', @@ -674,6 +684,10 @@ jQuery(function () { 'guidance_scale_textgenerationwebui': 1, 'smoothing_factor_textgenerationwebui': 0, 'smoothing_curve_textgenerationwebui': 1, + 'dry_allowed_length_textgenerationwebui': 2, + 'dry_multiplier_textgenerationwebui': 0, + 'dry_base_textgenerationwebui': 1.75, + 'dry_penalty_last_n_textgenerationwebui': 0, }; for (const [id, value] of Object.entries(inputs)) { @@ -1038,6 +1052,11 @@ export function getTextGenGenerationData(finalPrompt, maxTokens, isImpersonate, 'dynatemp_exponent': settings.dynatemp ? settings.dynatemp_exponent : undefined, 'smoothing_factor': settings.smoothing_factor, 'smoothing_curve': settings.smoothing_curve, + 'dry_allowed_length': settings.dry_allowed_length, + 'dry_multiplier': settings.dry_multiplier, + 'dry_base': settings.dry_base, + 'dry_sequence_breakers': settings.dry_sequence_breakers, + 'dry_penalty_last_n': settings.dry_penalty_last_n, 'max_tokens_second': settings.max_tokens_second, 'sampler_priority': settings.type === OOBA ? settings.sampler_priority : undefined, 'samplers': settings.type === LLAMACPP ? settings.samplers : undefined, diff --git a/public/scripts/variables.js b/public/scripts/variables.js index 5f3229692..c8e47c77f 100644 --- a/public/scripts/variables.js +++ b/public/scripts/variables.js @@ -795,27 +795,26 @@ function letCallback(args, value) { /** * Set or retrieve a variable in the current scope or nearest ancestor scope. - * @param {{_scope:SlashCommandScope, key?:string, index?:String|Number}} args Named arguments. - * @param {String|[String, SlashCommandClosure]} value Name and optional value for the variable. + * @param {{_scope:SlashCommandScope, key?:string, index?:string|number}} args Named arguments. + * @param {string|SlashCommandClosure|(string|SlashCommandClosure)[]} value Name and optional value for the variable. * @returns The variable's value */ function varCallback(args, value) { - if (Array.isArray(value)) { - args._scope.setVariable(value[0], typeof value[1] == 'string' ? value.slice(1).join(' ') : value[1], args.index); - return value[1]; - } + if (!Array.isArray(value)) value = [value]; if (args.key !== undefined) { const key = args.key; - const val = value; - args._scope.setVariable(key, val, args.index); - return val; - } else if (value.includes(' ')) { - const key = value.split(' ')[0]; - const val = value.split(' ').slice(1).join(' '); + const val = value.join(' '); args._scope.setVariable(key, val, args.index); return val; } - return args._scope.getVariable(args.key ?? value, args.index); + const key = value.shift(); + if (value.length > 0) { + const val = value.join(' '); + args._scope.setVariable(key, val, args.index); + return val; + } else { + return args._scope.getVariable(key, args.index); + } } export function registerVariableCommands() { @@ -1733,7 +1732,7 @@ export function registerVariableCommands() { returns: 'the variable value', namedArgumentList: [ new SlashCommandNamedArgument( - 'key', 'variable name', [ARGUMENT_TYPE.VARIABLE_NAME], false, + 'key', 'variable name; forces setting the variable, even if no value is provided', [ARGUMENT_TYPE.VARIABLE_NAME], false, ), new SlashCommandNamedArgument( 'index', @@ -1769,7 +1768,7 @@ export function registerVariableCommands() {
/let x foo | /var x foo bar | /var x | /echo
  • -
    /let x foo | /var key=x foo bar | /var key=x | /echo
    +
    /let x foo | /var key=x foo bar | /var x | /echo
  • diff --git a/public/scripts/world-info.js b/public/scripts/world-info.js index 256821b3f..723ea94c9 100644 --- a/public/scripts/world-info.js +++ b/public/scripts/world-info.js @@ -1057,6 +1057,34 @@ function displayWorldEntries(name, data, navigation = navigation_option.none, fl return; } + // Regardless of whether success is displayed or not. Make sure the delete button is available. + // Do not put this code behind. + $('#world_popup_delete').off('click').on('click', async () => { + const confirmation = await callPopup(`

    Delete the World/Lorebook: "${name}"?

    This action is irreversible!`, 'confirm'); + + if (!confirmation) { + return; + } + + if (world_info.charLore) { + world_info.charLore.forEach((charLore, index) => { + if (charLore.extraBooks?.includes(name)) { + const tempCharLore = charLore.extraBooks.filter((e) => e !== name); + if (tempCharLore.length === 0) { + world_info.charLore.splice(index, 1); + } else { + charLore.extraBooks = tempCharLore; + } + } + }); + + saveSettingsDebounced(); + } + + // Selected world_info automatically refreshes + await deleteWorldInfo(name); + }); + // Before printing the WI, we check if we should enable/disable search sorting verifyWorldInfoSearchSortRule(); @@ -1225,32 +1253,6 @@ function displayWorldEntries(name, data, navigation = navigation_option.none, fl } }); - $('#world_popup_delete').off('click').on('click', async () => { - const confirmation = await callPopup(`

    Delete the World/Lorebook: "${name}"?

    This action is irreversible!`, 'confirm'); - - if (!confirmation) { - return; - } - - if (world_info.charLore) { - world_info.charLore.forEach((charLore, index) => { - if (charLore.extraBooks?.includes(name)) { - const tempCharLore = charLore.extraBooks.filter((e) => e !== name); - if (tempCharLore.length === 0) { - world_info.charLore.splice(index, 1); - } else { - charLore.extraBooks = tempCharLore; - } - } - }); - - saveSettingsDebounced(); - } - - // Selected world_info automatically refreshes - await deleteWorldInfo(name); - }); - // Check if a sortable instance exists if (worldEntriesList.sortable('instance') !== undefined) { // Destroy the instance