Make it clear that you.com is free in case people run out of OpenAI credits (#238)

* Make it clear that you.com is free in case people run out of OpenAI credits

* Clear quota exceeded flag on new api key, minor refactoring

---------

Co-authored-by: Carl-Robert Linnupuu <carlrobertoh@gmail.com>
This commit is contained in:
keith siilats 2023-10-17 03:50:20 -04:00 committed by GitHub
parent 41b3956bf4
commit 4519b2ade6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 36 additions and 9 deletions

View file

@ -69,6 +69,11 @@ public class SettingsConfigurable implements Configurable {
var modelChanged = openAISettings.getModel().equals(serviceSelectionForm.getOpenAIModel()) ||
azureSettings.getModel().equals(serviceSelectionForm.getAzureModel());
var prevKey = OpenAICredentialsManager.getInstance().getApiKey();
if (prevKey != null && !prevKey.equals(serviceSelectionForm.getOpenAIApiKey())) {
OpenAISettingsState.getInstance().setOpenAIQuotaExceeded(false);
}
OpenAICredentialsManager.getInstance().setApiKey(serviceSelectionForm.getOpenAIApiKey());
AzureCredentialsManager.getInstance().setApiKey(serviceSelectionForm.getAzureOpenAIApiKey());
AzureCredentialsManager.getInstance()