disabling btn fetch models and selected models if apikey is empty. see #92

This commit is contained in:
mic 2024-07-23 23:45:06 +02:00
parent 93afbb2490
commit 7eeb50b5b6

View file

@ -108,10 +108,17 @@ function showConnectionOptions() {
function warnAPIKeyEmpty() { function warnAPIKeyEmpty() {
let apiKeyInput = document.getElementById('api_key_chatgpt'); let apiKeyInput = document.getElementById('api_key_chatgpt');
let btnFetchModels = document.getElementById('btnUpdateChatGPTModels');
let modelChatGPT = document.getElementById('model_chatgpt');
if(apiKeyInput.value === ''){ if(apiKeyInput.value === ''){
apiKeyInput.style.border = '2px solid red'; apiKeyInput.style.border = '2px solid red';
btnFetchModels.disabled = true;
modelChatGPT.disabled = true;
modelChatGPT.selectedIndex = -1;
}else{ }else{
apiKeyInput.style.border = 'none'; apiKeyInput.style.border = 'none';
btnFetchModels.disabled = false;
modelChatGPT.disabled = false;
} }
} }