From f85e97a9a0d6a6c368dc502b4814e2de06c8119c Mon Sep 17 00:00:00 2001 From: robbizbal Date: Wed, 13 Nov 2024 17:06:05 +0100 Subject: [PATCH] Update mask.js Refactoring ability to set custom values. - Stores them in localstore if set. - cleans them if checkbox is unset - add button to reset localstore --- src/static/scripts/mask.js | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/static/scripts/mask.js b/src/static/scripts/mask.js index c2e6b65..0ec3173 100644 --- a/src/static/scripts/mask.js +++ b/src/static/scripts/mask.js @@ -26,12 +26,16 @@ document.getElementById('LLMcustom').addEventListener('change', function() { const llmUrl = localStorage.getItem('LLMURL'); const llmModel = localStorage.getItem('LLMMODEL'); - // Set the input fields if values exist - if (llmUrl) { - document.getElementById('inputLLMurl').value = llmUrl; - } - if (llmModel) { - document.getElementById('inputLLMmodel').value = llmModel; + if (this.checked === true) { + if (llmUrl) { + document.getElementById('inputLLMurl').value = llmUrl; + } + if (llmModel) { + document.getElementById('inputLLMmodel').value = llmModel; + } + } else { + document.getElementById('inputLLMurl').value = ""; + document.getElementById('inputLLMmodel').value = ""; } });