From 4a7a11dfd560c21ac99cf25bb9f4167cc75992e2 Mon Sep 17 00:00:00 2001 From: Cohee <18619528+Cohee1207@users.noreply.github.com> Date: Sat, 30 Nov 2024 18:19:31 +0200 Subject: [PATCH] Add JSdoc for function --- public/script.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/public/script.js b/public/script.js index cf8e79300..f93880cea 100644 --- a/public/script.js +++ b/public/script.js @@ -6833,9 +6833,14 @@ export async function saveSettings(type) { }); } -export function setGenerationParamsFromPreset(preset, keep_context_lock) { +/** + * Sets the generation parameters from a preset object. + * @param {{ genamt?: number, max_length?: number }} preset Preset object + * @param {boolean?} keepContextLock If true, will not unlock context if it needs to be unlocked + */ +export function setGenerationParamsFromPreset(preset, keepContextLock = false) { const needsUnlock = (preset.max_length ?? max_context) > MAX_CONTEXT_DEFAULT || (preset.genamt ?? amount_gen) > MAX_RESPONSE_DEFAULT; - if (!keep_context_lock || $('#max_context_unlocked').prop('checked')) { + if (!keepContextLock || $('#max_context_unlocked').prop('checked')) { $('#max_context_unlocked').prop('checked', needsUnlock).trigger('change'); } else if (needsUnlock) { // cap values