feat: user_provided token for plugins, temp remove user_provided azure creds for Plugins until solution is made

This commit is contained in:
Danny Avila 2023-07-06 13:18:06 -04:00 committed by Danny Avila
parent 5b30ab5d43
commit 5ad0ef331f
7 changed files with 29 additions and 18 deletions

View file

@ -167,11 +167,16 @@ const ask = async ({ text, endpoint, endpointOption, parentMessageId = null, con
...endpointOption
};
if (process.env.PLUGINS_USE_AZURE === 'true') {
let oaiApiKey = req.body?.token ?? process.env.OPENAI_API_KEY;
if (process.env.PLUGINS_USE_AZURE) {
clientOptions.azure = getAzureCredentials();
oaiApiKey = clientOptions.azure.azureOpenAIApiKey;
}
const oaiApiKey = req.body?.token ?? process.env.OPENAI_API_KEY;
if (oaiApiKey && oaiApiKey.includes('azure') && !clientOptions.azure) {
clientOptions.azure = JSON.parse(req.body?.token) ?? getAzureCredentials();
oaiApiKey = clientOptions.azure.azureOpenAIApiKey;
}
const chatAgent = new PluginsClient(oaiApiKey, clientOptions);
const onAgentAction = (action) => {