Skip to content

Commit

Permalink
Update popup.js with user input handling
Browse files Browse the repository at this point in the history
  • Loading branch information
leonid20000 committed Jun 29, 2023
1 parent 5c2a82d commit bbeefd3
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions odin-chrome-extension/popup.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,14 @@ document.addEventListener('DOMContentLoaded', function() {


settingsBtn.addEventListener('click', function() {
const settingValue = prompt('Enter a valid API Key to be able to use the language model:');
// Send the setting value to the background script
chrome.runtime.sendMessage({ action: 'setSetting', value: settingValue });
// Re-enable the startBtn after sending the setting value
startBtn.disabled = false;
startBtn.textContent = 'Start';
const settingValue = prompt('Enter the API Key for your preferred language model (currently gpt-turbo-3.5):');
if(settingValue){
// Send the setting value to the background script
chrome.runtime.sendMessage({ action: 'setSetting', value: settingValue });
// Re-enable the startBtn after sending the setting value
startBtn.disabled = false;
startBtn.textContent = 'Start';
}

});
});

0 comments on commit bbeefd3

Please sign in to comment.