| 6833 | 6833 | }); |
| 6834 | 6834 | } |
| 6835 | 6835 | |
| 6836 | | -export function setGenerationParamsFromPreset(preset, keep_context_lock) { |
| 6836 | +/** |
| 6837 | + * Sets the generation parameters from a preset object. |
| 6838 | + * @param {{ genamt?: number, max_length?: number }} preset Preset object |
| 6839 | + * @param {boolean?} keepContextLock If true, will not unlock context if it needs to be unlocked |
| 6840 | + */ |
| 6841 | +export function setGenerationParamsFromPreset(preset, keepContextLock = false) { |
| 6837 | 6842 | const needsUnlock = (preset.max_length ?? max_context) > MAX_CONTEXT_DEFAULT || (preset.genamt ?? amount_gen) > MAX_RESPONSE_DEFAULT; |
| 6838 | 6843 | if (!keep_context_lockkeepContextLock || $('#max_context_unlocked').prop('checked')) { |
| 6839 | 6844 | $('#max_context_unlocked').prop('checked', needsUnlock).trigger('change'); |
| 6840 | 6845 | } else if (needsUnlock) { |
| 6841 | 6846 | // cap values |