diff --git a/_locales/en/messages.json b/_locales/en/messages.json index 2cacac84..b02f8c67 100644 --- a/_locales/en/messages.json +++ b/_locales/en/messages.json @@ -1620,5 +1620,13 @@ "prefs_OptionText_chatgpt_web_br_replace_info": { "message": "Please note that any
tags in the AI's response will be replaced with line breaks.", "description": "" + }, + "prefs_OpenAIComp_ClearModelsList": { + "message": "Clear Models List", + "description": "" + }, + "OpenAIComp_ClearModelsList_Confirm": { + "message": "Are you sure you want to clear the Models List? This action cannot be undone.", + "description": "" } } \ No newline at end of file diff --git a/options/mzta-options.html b/options/mzta-options.html index 20286c50..f8c12e4b 100644 --- a/options/mzta-options.html +++ b/options/mzta-options.html @@ -410,7 +410,8 @@ diff --git a/options/mzta-options.js b/options/mzta-options.js index 9dcd6847..13604510 100644 --- a/options/mzta-options.js +++ b/options/mzta-options.js @@ -511,10 +511,22 @@ document.addEventListener('DOMContentLoaded', async () => { option.text = modelName; select_openai_comp_model.appendChild(option); select_openai_comp_model.value = modelName; - select_openai_comp_model.dispatchEvent(new Event('change', { bubbles: true })); + select_openai_comp_model.dispatchEvent(new Event('change', { bubbles: true })); } }); + document.getElementById('btnOpenAICompClearModelsList').addEventListener('click', () => { + if (!confirm(browser.i18n.getMessage('OpenAIComp_ClearModelsList_Confirm'))) { + return; + } + let select_openai_comp_model = document.getElementById('openai_comp_model'); + while (select_openai_comp_model.options.length > 0) { + select_openai_comp_model.remove(0); + } + select_openai_comp_model.value = ''; + select_openai_comp_model.dispatchEvent(new Event('change', { bubbles: true })); + }); + document.getElementById('btnGiveAllUrlsPermission_ollama_api').addEventListener('click', async () => { permission_all_urls = await messenger.permissions.request({ origins: [""] }); });