Create a deep clone of the preset before applying

Prevents non-primitives from causing overlapping references
This commit is contained in:
maver 2023-08-12 19:40:01 +02:00
parent f5aa7f7970
commit 0f897158b9
1 changed files with 2 additions and 1 deletions

View File

@ -2397,7 +2397,8 @@ function onSettingsPresetChange() {
const presetName = $('#settings_perset_openai').find(":selected").text(); const presetName = $('#settings_perset_openai').find(":selected").text();
oai_settings.preset_settings_openai = presetName; oai_settings.preset_settings_openai = presetName;
const preset = openai_settings[openai_setting_names[oai_settings.preset_settings_openai]];
const preset = structuredClone(openai_settings[openai_setting_names[oai_settings.preset_settings_openai]]);
const updateInput = (selector, value) => $(selector).val(value).trigger('input'); const updateInput = (selector, value) => $(selector).val(value).trigger('input');
const updateCheckbox = (selector, value) => $(selector).prop('checked', value).trigger('input'); const updateCheckbox = (selector, value) => $(selector).prop('checked', value).trigger('input');