From 0f897158b95a4754ef4454cd3feb7bcba41b2c2b Mon Sep 17 00:00:00 2001 From: maver Date: Sat, 12 Aug 2023 19:40:01 +0200 Subject: [PATCH] Create a deep clone of the preset before applying Prevents non-primitives from causing overlapping references --- public/scripts/openai.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/public/scripts/openai.js b/public/scripts/openai.js index a5d5fa2a0..60c7ec0c8 100644 --- a/public/scripts/openai.js +++ b/public/scripts/openai.js @@ -2397,7 +2397,8 @@ function onSettingsPresetChange() { const presetName = $('#settings_perset_openai').find(":selected").text(); 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 updateCheckbox = (selector, value) => $(selector).prop('checked', value).trigger('input');