diff --git a/public/index.html b/public/index.html index 971498738..625c73ccd 100644 --- a/public/index.html +++ b/public/index.html @@ -979,9 +979,14 @@ - - - Adjust generation to worker capabilities + + + Adjust context size to worker capabilities + + + + + Adjust response length to worker capabilities API key Get it here: Register diff --git a/public/script.js b/public/script.js index 35f77a00d..f8197c59f 100644 --- a/public/script.js +++ b/public/script.js @@ -1794,7 +1794,7 @@ async function Generate(type, { automatic_trigger, force_name2, resolve, reject, // Adjust token limit for Horde let adjustedParams; - if (main_api == 'kobold' && horde_settings.use_horde && horde_settings.auto_adjust) { + if (main_api == 'kobold' && horde_settings.use_horde && (horde_settings.auto_adjust_context_length || horde_settings.auto_adjust_response_length)) { try { adjustedParams = await adjustHordeGenerationParams(max_context, amount_gen); } @@ -1802,7 +1802,9 @@ async function Generate(type, { automatic_trigger, force_name2, resolve, reject, activateSendButtons(); return; } - this_max_context = (adjustedParams.maxContextLength - adjustedParams.maxLength); + if (horde_settings.auto_adjust_context_length) { + this_max_context = (adjustedParams.maxContextLength - adjustedParams.maxLength); + } } // Extension added strings @@ -2107,7 +2109,7 @@ async function Generate(type, { automatic_trigger, force_name2, resolve, reject, } } - if (main_api == 'kobold' && horde_settings.use_horde && adjustedParams) { + if (main_api == 'kobold' && horde_settings.use_horde && horde_settings.auto_adjust_response_length) { this_amount_gen = Math.min(this_amount_gen, adjustedParams.maxLength); this_amount_gen = Math.max(this_amount_gen, MIN_AMOUNT_GEN); // prevent validation errors } @@ -2124,7 +2126,7 @@ async function Generate(type, { automatic_trigger, force_name2, resolve, reject, }; if (preset_settings != 'gui' || horde_settings.use_horde) { - const maxContext = horde_settings.use_horde && adjustedParams ? adjustedParams.maxContextLength : max_context; + const maxContext = horde_settings.use_horde && horde_settings.auto_adjust_context_length ? adjustedParams.maxContextLength : max_context; generate_data = getKoboldGenerationData(finalPromt, this_settings, this_amount_gen, maxContext, isImpersonate); } } diff --git a/public/scripts/horde.js b/public/scripts/horde.js index 14d43fccb..f881b8cac 100644 --- a/public/scripts/horde.js +++ b/public/scripts/horde.js @@ -17,7 +17,8 @@ let horde_settings = { api_key: '0000000000', models: [], use_horde: false, - auto_adjust: true, + auto_adjust_response_length: true, + auto_adjust_context_length: false, }; const MAX_RETRIES = 100; @@ -76,8 +77,12 @@ async function adjustHordeGenerationParams(max_context_length, max_length) { //get the minimum requires parameters, lowest common value for all selected for (const worker of availableWorkers) { - maxContextLength = Math.min(worker.max_context_length, maxContextLength); - maxLength = Math.min(worker.max_length, maxLength); + if (horde_settings.auto_adjust_context_length) { + maxContextLength = Math.min(worker.max_context_length, maxContextLength); + } + if (horde_settings.auto_adjust_response_length) { + maxLength = Math.min(worker.max_length, maxLength); + } } return { maxContextLength, maxLength }; @@ -186,7 +191,8 @@ function loadHordeSettings(settings) { $('#use_horde').prop("checked", horde_settings.use_horde).trigger('input'); $('#horde_api_key').val(horde_settings.api_key); - $('#horde_auto_adjust').prop("checked", horde_settings.auto_adjust); + $('#horde_auto_adjust_response_length').prop("checked", horde_settings.auto_adjust_response_length); + $('#horde_auto_adjust_context_length').prop("checked", horde_settings.auto_adjust_context_length); } jQuery(function () { @@ -218,8 +224,13 @@ jQuery(function () { saveSettingsDebounced(); }); - $("#horde_auto_adjust").on("input", function () { - horde_settings.auto_adjust = !!$(this).prop("checked"); + $("#horde_auto_adjust_response_length").on("input", function () { + horde_settings.auto_adjust_response_length = !!$(this).prop("checked"); + saveSettingsDebounced(); + }); + + $("#horde_auto_adjust_context_length").on("input", function () { + horde_settings.auto_adjust_context_length = !!$(this).prop("checked"); saveSettingsDebounced(); });