From d3b16640b99afcfc6b16027de5448551398ea64d Mon Sep 17 00:00:00 2001 From: Jordan Wages Date: Wed, 16 Jul 2025 19:43:24 -0500 Subject: [PATCH] Handle endpoint changes without restart --- background.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/background.js b/background.js index 06683e2..c7579d0 100644 --- a/background.js +++ b/background.js @@ -417,6 +417,20 @@ async function clearCacheForMessages(idsInput) { aiRules = normalizeRules(newRules); logger.aiLog("aiRules updated from storage change", { debug: true }, aiRules); } + if (changes.endpoint || changes.templateName || changes.customTemplate || changes.customSystemPrompt || changes.aiParams || changes.debugLogging) { + const config = {}; + if (changes.endpoint) config.endpoint = changes.endpoint.newValue; + if (changes.templateName) config.templateName = changes.templateName.newValue; + if (changes.customTemplate) config.customTemplate = changes.customTemplate.newValue; + if (changes.customSystemPrompt) config.customSystemPrompt = changes.customSystemPrompt.newValue; + if (changes.aiParams) config.aiParams = changes.aiParams.newValue; + if (changes.debugLogging) { + config.debugLogging = changes.debugLogging.newValue === true; + logger.setDebug(config.debugLogging); + } + await AiClassifier.setConfig(config); + logger.aiLog("AiClassifier config updated from storage change", { debug: true }, config); + } if (changes.htmlToMarkdown) { htmlToMarkdown = changes.htmlToMarkdown.newValue === true; logger.aiLog("htmlToMarkdown updated from storage change", { debug: true }, htmlToMarkdown);