mirror of
https://github.com/danny-avila/LibreChat.git
synced 2025-12-17 08:50:15 +01:00
* feat: use AWS cascading default providers if credentials are omitted Environment variables exposed via process.env SSO credentials from token cache Web identity token credentials Shared credentials and config ini files The EC2/ECS Instance Metadata Service The default credential provider will invoke one provider at a time and only continue to the next if no credentials have been located. For example, if the process finds values defined via the AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY environment variables, the files at ~/.aws/credentials and ~/.aws/config will not be read, nor will any messages be sent to the Instance Metadata Service. * fix: usage check in OpenAIClient * refactor: Improve usage check in OpenAIClient
54 lines
1.8 KiB
JavaScript
54 lines
1.8 KiB
JavaScript
const { EModelEndpoint } = require('librechat-data-provider');
|
|
const { isUserProvided, generateConfig } = require('~/server/utils');
|
|
|
|
const {
|
|
OPENAI_API_KEY: openAIApiKey,
|
|
AZURE_ASSISTANTS_API_KEY: azureAssistantsApiKey,
|
|
ASSISTANTS_API_KEY: assistantsApiKey,
|
|
AZURE_API_KEY: azureOpenAIApiKey,
|
|
ANTHROPIC_API_KEY: anthropicApiKey,
|
|
CHATGPT_TOKEN: chatGPTToken,
|
|
BINGAI_TOKEN: bingToken,
|
|
PLUGINS_USE_AZURE,
|
|
GOOGLE_KEY: googleKey,
|
|
OPENAI_REVERSE_PROXY,
|
|
AZURE_OPENAI_BASEURL,
|
|
ASSISTANTS_BASE_URL,
|
|
AZURE_ASSISTANTS_BASE_URL,
|
|
} = process.env ?? {};
|
|
|
|
const useAzurePlugins = !!PLUGINS_USE_AZURE;
|
|
|
|
const userProvidedOpenAI = useAzurePlugins
|
|
? isUserProvided(azureOpenAIApiKey)
|
|
: isUserProvided(openAIApiKey);
|
|
|
|
module.exports = {
|
|
config: {
|
|
openAIApiKey,
|
|
azureOpenAIApiKey,
|
|
useAzurePlugins,
|
|
userProvidedOpenAI,
|
|
googleKey,
|
|
[EModelEndpoint.bingAI]: generateConfig(bingToken),
|
|
[EModelEndpoint.anthropic]: generateConfig(anthropicApiKey),
|
|
[EModelEndpoint.chatGPTBrowser]: generateConfig(chatGPTToken),
|
|
[EModelEndpoint.openAI]: generateConfig(openAIApiKey, OPENAI_REVERSE_PROXY),
|
|
[EModelEndpoint.azureOpenAI]: generateConfig(azureOpenAIApiKey, AZURE_OPENAI_BASEURL),
|
|
[EModelEndpoint.assistants]: generateConfig(
|
|
assistantsApiKey,
|
|
ASSISTANTS_BASE_URL,
|
|
EModelEndpoint.assistants,
|
|
),
|
|
[EModelEndpoint.azureAssistants]: generateConfig(
|
|
azureAssistantsApiKey,
|
|
AZURE_ASSISTANTS_BASE_URL,
|
|
EModelEndpoint.azureAssistants,
|
|
),
|
|
[EModelEndpoint.bedrock]: generateConfig(
|
|
process.env.BEDROCK_AWS_SECRET_ACCESS_KEY ?? process.env.BEDROCK_AWS_DEFAULT_REGION,
|
|
),
|
|
/* key will be part of separate config */
|
|
[EModelEndpoint.agents]: generateConfig(process.env.I_AM_A_TEAPOT),
|
|
},
|
|
};
|