From 6e2b5f268ddfdb62dfeee8f2fcbe699f300a6ccc Mon Sep 17 00:00:00 2001 From: Mic Date: Thu, 22 May 2025 00:36:00 +0200 Subject: [PATCH] Add confirmation dialog for applying OpenAI compatible configurations. see #378 --- _locales/en/messages.json | 9 +++++++++ options/mzta-options.js | 3 +++ 2 files changed, 12 insertions(+) diff --git a/_locales/en/messages.json b/_locales/en/messages.json index 746ddff6..df826eff 100644 --- a/_locales/en/messages.json +++ b/_locales/en/messages.json @@ -1518,5 +1518,14 @@ "Custom": { "message": "Custom", "description": "" + }, + "OpenAIComp_Configs_ConfirmApply": { + "message": "Are you sure you want to apply the configuration \"$config_name$\"?", + "description": "", + "placeholders": { + "config_name": { + "content": "$1" + } + } } } \ No newline at end of file diff --git a/options/mzta-options.js b/options/mzta-options.js index 2dfcbcf6..0b4d1e28 100644 --- a/options/mzta-options.js +++ b/options/mzta-options.js @@ -853,6 +853,9 @@ document.addEventListener('DOMContentLoaded', async () => { let selectedOption = select_openai_comp_services_shortcut.options[select_openai_comp_services_shortcut.selectedIndex]; const config = openAICompConfigs.find(cfg => cfg.id === selectedOption.value); if (config) { + if (!confirm(browser.i18n.getMessage('OpenAIComp_Configs_ConfirmApply', config.name))) { + return; + } document.getElementById('openai_comp_host').value = config.host || ''; // Clear all options from the select except the first (placeholder) one const openaiCompModelSelect = document.getElementById('openai_comp_model');