Add confirmation dialog for applying OpenAI compatible configurations. see #378
This commit is contained in:
parent
98d62b9a82
commit
6e2b5f268d
2 changed files with 12 additions and 0 deletions
|
|
@ -1518,5 +1518,14 @@
|
||||||
"Custom": {
|
"Custom": {
|
||||||
"message": "Custom",
|
"message": "Custom",
|
||||||
"description": ""
|
"description": ""
|
||||||
|
},
|
||||||
|
"OpenAIComp_Configs_ConfirmApply": {
|
||||||
|
"message": "Are you sure you want to apply the configuration \"$config_name$\"?",
|
||||||
|
"description": "",
|
||||||
|
"placeholders": {
|
||||||
|
"config_name": {
|
||||||
|
"content": "$1"
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -853,6 +853,9 @@ document.addEventListener('DOMContentLoaded', async () => {
|
||||||
let selectedOption = select_openai_comp_services_shortcut.options[select_openai_comp_services_shortcut.selectedIndex];
|
let selectedOption = select_openai_comp_services_shortcut.options[select_openai_comp_services_shortcut.selectedIndex];
|
||||||
const config = openAICompConfigs.find(cfg => cfg.id === selectedOption.value);
|
const config = openAICompConfigs.find(cfg => cfg.id === selectedOption.value);
|
||||||
if (config) {
|
if (config) {
|
||||||
|
if (!confirm(browser.i18n.getMessage('OpenAIComp_Configs_ConfirmApply', config.name))) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
document.getElementById('openai_comp_host').value = config.host || '';
|
document.getElementById('openai_comp_host').value = config.host || '';
|
||||||
// Clear all options from the select except the first (placeholder) one
|
// Clear all options from the select except the first (placeholder) one
|
||||||
const openaiCompModelSelect = document.getElementById('openai_comp_model');
|
const openaiCompModelSelect = document.getElementById('openai_comp_model');
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue