From 25de57df49aff6404d403374451f7b731cd1b65b Mon Sep 17 00:00:00 2001 From: Sergey Konovalov Date: Sat, 11 Oct 2025 11:31:06 +0300 Subject: [PATCH] [bug] Avoid modifying cached config; Fix bug 77490 --- DocService/sources/ai/aiProxyHandler.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/DocService/sources/ai/aiProxyHandler.js b/DocService/sources/ai/aiProxyHandler.js index 72779a06..491660cd 100644 --- a/DocService/sources/ai/aiProxyHandler.js +++ b/DocService/sources/ai/aiProxyHandler.js @@ -341,6 +341,12 @@ async function getPluginSettings(ctx) { async function getPluginSettingsForInterface(ctx) { let pluginSettings = await getPluginSettings(ctx); + + // Create deep copy to avoid modifying cached config + if (pluginSettings) { + pluginSettings = JSON.parse(JSON.stringify(pluginSettings)); + } + //check empty settings if (pluginSettings && pluginSettings.actions) { let isEmptySettings = true; @@ -353,11 +359,11 @@ async function getPluginSettingsForInterface(ctx) { pluginSettings = undefined; } } - //remove keys from providers - create deep copy to avoid modifying cached config + + //remove keys from providers if (pluginSettings?.providers) { for (const key in pluginSettings.providers) { if (pluginSettings.providers[key]?.key) { - pluginSettings.providers[key] = JSON.parse(JSON.stringify(pluginSettings.providers[key])); pluginSettings.providers[key].key = ''; } }