🧹 Clean Up OpenAI Config and Show 'Set Azure Key' for Plugins (#1649)

* refactor(gptPlugins): prevent edge case where exact word `azure` could be found in azure api Key detection when not an azure key

* refactor(SetKeyDialog): cleanup OpenAI config, show \'set azure key\' when `PLUGINS_USE_AZURE` env var is enabled
This commit is contained in:
Danny Avila 2024-01-26 09:27:20 -05:00 committed by GitHub
parent fcbaa74e4a
commit 0edfa0483e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 14 additions and 29 deletions

View file

@ -60,7 +60,7 @@ const initializeClient = async ({ req, res, endpointOption }) => {
let apiKey = isUserProvided ? userKey : credentials[endpoint];
if (useAzure || (apiKey && apiKey.includes('azure') && !clientOptions.azure)) {
if (useAzure || (apiKey && apiKey.includes('{"azure') && !clientOptions.azure)) {
clientOptions.azure = isUserProvided ? JSON.parse(userKey) : getAzureCredentials();
apiKey = clientOptions.azure.azureOpenAIApiKey;
}