Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Anything Llm
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
mirrored_repos
MachineLearning
Mintplex Labs
Anything Llm
Commits
8c7379cd
Unverified
Commit
8c7379cd
authored
11 months ago
by
Timothy Carambat
Committed by
GitHub
11 months ago
Browse files
Options
Downloads
Patches
Plain Diff
persist provider keys between toggle providers (#1041)
parent
5ef53736
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
server/models/systemSettings.js
+116
-219
116 additions, 219 deletions
server/models/systemSettings.js
with
116 additions
and
219 deletions
server/models/systemSettings.js
+
116
−
219
View file @
8c7379cd
...
@@ -33,236 +33,133 @@ const SystemSettings = {
...
@@ -33,236 +33,133 @@ const SystemSettings = {
const
llmProvider
=
process
.
env
.
LLM_PROVIDER
;
const
llmProvider
=
process
.
env
.
LLM_PROVIDER
;
const
vectorDB
=
process
.
env
.
VECTOR_DB
;
const
vectorDB
=
process
.
env
.
VECTOR_DB
;
return
{
return
{
// --------------------------------------------------------
// General Settings
// --------------------------------------------------------
RequiresAuth
:
!!
process
.
env
.
AUTH_TOKEN
,
RequiresAuth
:
!!
process
.
env
.
AUTH_TOKEN
,
AuthToken
:
!!
process
.
env
.
AUTH_TOKEN
,
AuthToken
:
!!
process
.
env
.
AUTH_TOKEN
,
JWTSecret
:
!!
process
.
env
.
JWT_SECRET
,
JWTSecret
:
!!
process
.
env
.
JWT_SECRET
,
StorageDir
:
process
.
env
.
STORAGE_DIR
,
StorageDir
:
process
.
env
.
STORAGE_DIR
,
MultiUserMode
:
await
this
.
isMultiUserMode
(),
MultiUserMode
:
await
this
.
isMultiUserMode
(),
VectorDB
:
vectorDB
,
DisableTelemetry
:
process
.
env
.
DISABLE_TELEMETRY
||
"
false
"
,
HasExistingEmbeddings
:
await
this
.
hasEmbeddings
(),
// --------------------------------------------------------
// Embedder Provider Selection Settings & Configs
// --------------------------------------------------------
EmbeddingEngine
:
process
.
env
.
EMBEDDING_ENGINE
,
EmbeddingEngine
:
process
.
env
.
EMBEDDING_ENGINE
,
HasExistingEmbeddings
:
await
this
.
hasEmbeddings
(),
EmbeddingBasePath
:
process
.
env
.
EMBEDDING_BASE_PATH
,
EmbeddingBasePath
:
process
.
env
.
EMBEDDING_BASE_PATH
,
EmbeddingModelPref
:
process
.
env
.
EMBEDDING_MODEL_PREF
,
EmbeddingModelPref
:
process
.
env
.
EMBEDDING_MODEL_PREF
,
EmbeddingModelMaxChunkLength
:
EmbeddingModelMaxChunkLength
:
process
.
env
.
EMBEDDING_MODEL_MAX_CHUNK_LENGTH
,
process
.
env
.
EMBEDDING_MODEL_MAX_CHUNK_LENGTH
,
LocalAiApiKey
:
!!
process
.
env
.
LOCAL_AI_API_KEY
,
DisableTelemetry
:
process
.
env
.
DISABLE_TELEMETRY
||
"
false
"
,
// --------------------------------------------------------
...(
vectorDB
===
"
pinecone
"
// VectorDB Provider Selection Settings & Configs
?
{
// --------------------------------------------------------
PineConeKey
:
!!
process
.
env
.
PINECONE_API_KEY
,
VectorDB
:
vectorDB
,
PineConeIndex
:
process
.
env
.
PINECONE_INDEX
,
// Pinecone DB Keys
}
PineConeKey
:
!!
process
.
env
.
PINECONE_API_KEY
,
:
{}),
PineConeIndex
:
process
.
env
.
PINECONE_INDEX
,
...(
vectorDB
===
"
chroma
"
?
{
// Chroma DB Keys
ChromaEndpoint
:
process
.
env
.
CHROMA_ENDPOINT
,
ChromaEndpoint
:
process
.
env
.
CHROMA_ENDPOINT
,
ChromaApiHeader
:
process
.
env
.
CHROMA_API_HEADER
,
ChromaApiHeader
:
process
.
env
.
CHROMA_API_HEADER
,
ChromaApiKey
:
!!
process
.
env
.
CHROMA_API_KEY
,
ChromaApiKey
:
!!
process
.
env
.
CHROMA_API_KEY
,
}
:
{}),
// Weaviate DB Keys
...(
vectorDB
===
"
weaviate
"
WeaviateEndpoint
:
process
.
env
.
WEAVIATE_ENDPOINT
,
?
{
WeaviateApiKey
:
process
.
env
.
WEAVIATE_API_KEY
,
WeaviateEndpoint
:
process
.
env
.
WEAVIATE_ENDPOINT
,
WeaviateApiKey
:
process
.
env
.
WEAVIATE_API_KEY
,
// QDrant DB Keys
}
QdrantEndpoint
:
process
.
env
.
QDRANT_ENDPOINT
,
:
{}),
QdrantApiKey
:
process
.
env
.
QDRANT_API_KEY
,
...(
vectorDB
===
"
qdrant
"
?
{
// Milvus DB Keys
QdrantEndpoint
:
process
.
env
.
QDRANT_ENDPOINT
,
MilvusAddress
:
process
.
env
.
MILVUS_ADDRESS
,
QdrantApiKey
:
process
.
env
.
QDRANT_API_KEY
,
MilvusUsername
:
process
.
env
.
MILVUS_USERNAME
,
}
MilvusPassword
:
!!
process
.
env
.
MILVUS_PASSWORD
,
:
{}),
...(
vectorDB
===
"
milvus
"
// Zilliz DB Keys
?
{
ZillizEndpoint
:
process
.
env
.
ZILLIZ_ENDPOINT
,
MilvusAddress
:
process
.
env
.
MILVUS_ADDRESS
,
ZillizApiToken
:
process
.
env
.
ZILLIZ_API_TOKEN
,
MilvusUsername
:
process
.
env
.
MILVUS_USERNAME
,
MilvusPassword
:
!!
process
.
env
.
MILVUS_PASSWORD
,
// AstraDB Keys
}
AstraDBApplicationToken
:
process
?.
env
?.
ASTRA_DB_APPLICATION_TOKEN
,
:
{}),
AstraDBEndpoint
:
process
?.
env
?.
ASTRA_DB_ENDPOINT
,
...(
vectorDB
===
"
zilliz
"
?
{
// --------------------------------------------------------
ZillizEndpoint
:
process
.
env
.
ZILLIZ_ENDPOINT
,
// LLM Provider Selection Settings & Configs
ZillizApiToken
:
process
.
env
.
ZILLIZ_API_TOKEN
,
// --------------------------------------------------------
}
:
{}),
...(
vectorDB
===
"
astra
"
?
{
AstraDBApplicationToken
:
process
?.
env
?.
ASTRA_DB_APPLICATION_TOKEN
,
AstraDBEndpoint
:
process
?.
env
?.
ASTRA_DB_ENDPOINT
,
}
:
{}),
LLMProvider
:
llmProvider
,
LLMProvider
:
llmProvider
,
...(
llmProvider
===
"
openai
"
// OpenAI Keys
?
{
OpenAiKey
:
!!
process
.
env
.
OPEN_AI_KEY
,
OpenAiKey
:
!!
process
.
env
.
OPEN_AI_KEY
,
OpenAiModelPref
:
process
.
env
.
OPEN_MODEL_PREF
||
"
gpt-3.5-turbo
"
,
OpenAiModelPref
:
process
.
env
.
OPEN_MODEL_PREF
||
"
gpt-3.5-turbo
"
,
}
// Azure + OpenAI Keys
:
{}),
AzureOpenAiEndpoint
:
process
.
env
.
AZURE_OPENAI_ENDPOINT
,
AzureOpenAiKey
:
!!
process
.
env
.
AZURE_OPENAI_KEY
,
...(
llmProvider
===
"
azure
"
AzureOpenAiModelPref
:
process
.
env
.
OPEN_MODEL_PREF
,
?
{
AzureOpenAiEmbeddingModelPref
:
process
.
env
.
EMBEDDING_MODEL_PREF
,
AzureOpenAiEndpoint
:
process
.
env
.
AZURE_OPENAI_ENDPOINT
,
AzureOpenAiTokenLimit
:
process
.
env
.
AZURE_OPENAI_TOKEN_LIMIT
||
4096
,
AzureOpenAiKey
:
!!
process
.
env
.
AZURE_OPENAI_KEY
,
AzureOpenAiModelPref
:
process
.
env
.
OPEN_MODEL_PREF
,
// Anthropic Keys
AzureOpenAiEmbeddingModelPref
:
process
.
env
.
EMBEDDING_MODEL_PREF
,
AnthropicApiKey
:
!!
process
.
env
.
ANTHROPIC_API_KEY
,
AzureOpenAiTokenLimit
:
process
.
env
.
AZURE_OPENAI_TOKEN_LIMIT
||
4096
,
AnthropicModelPref
:
process
.
env
.
ANTHROPIC_MODEL_PREF
||
"
claude-2
"
,
}
:
{}),
// Gemini Keys
GeminiLLMApiKey
:
!!
process
.
env
.
GEMINI_API_KEY
,
...(
llmProvider
===
"
anthropic
"
GeminiLLMModelPref
:
process
.
env
.
GEMINI_LLM_MODEL_PREF
||
"
gemini-pro
"
,
?
{
AnthropicApiKey
:
!!
process
.
env
.
ANTHROPIC_API_KEY
,
// LMStudio Keys
AnthropicModelPref
:
process
.
env
.
ANTHROPIC_MODEL_PREF
||
"
claude-2
"
,
LMStudioBasePath
:
process
.
env
.
LMSTUDIO_BASE_PATH
,
LMStudioTokenLimit
:
process
.
env
.
LMSTUDIO_MODEL_TOKEN_LIMIT
,
// For embedding credentials when Anthropic is selected.
LMStudioModelPref
:
process
.
env
.
LMSTUDIO_MODEL_PREF
,
OpenAiKey
:
!!
process
.
env
.
OPEN_AI_KEY
,
AzureOpenAiEndpoint
:
process
.
env
.
AZURE_OPENAI_ENDPOINT
,
// LocalAI Keys
AzureOpenAiKey
:
!!
process
.
env
.
AZURE_OPENAI_KEY
,
LocalAiApiKey
:
!!
process
.
env
.
LOCAL_AI_API_KEY
,
AzureOpenAiEmbeddingModelPref
:
process
.
env
.
EMBEDDING_MODEL_PREF
,
LocalAiBasePath
:
process
.
env
.
LOCAL_AI_BASE_PATH
,
}
LocalAiModelPref
:
process
.
env
.
LOCAL_AI_MODEL_PREF
,
:
{}),
LocalAiTokenLimit
:
process
.
env
.
LOCAL_AI_MODEL_TOKEN_LIMIT
,
...(
llmProvider
===
"
gemini
"
// Ollama LLM Keys
?
{
OllamaLLMBasePath
:
process
.
env
.
OLLAMA_BASE_PATH
,
GeminiLLMApiKey
:
!!
process
.
env
.
GEMINI_API_KEY
,
OllamaLLMModelPref
:
process
.
env
.
OLLAMA_MODEL_PREF
,
GeminiLLMModelPref
:
OllamaLLMTokenLimit
:
process
.
env
.
OLLAMA_MODEL_TOKEN_LIMIT
,
process
.
env
.
GEMINI_LLM_MODEL_PREF
||
"
gemini-pro
"
,
// TogetherAI Keys
// For embedding credentials when Gemini is selected.
TogetherAiApiKey
:
!!
process
.
env
.
TOGETHER_AI_API_KEY
,
OpenAiKey
:
!!
process
.
env
.
OPEN_AI_KEY
,
TogetherAiModelPref
:
process
.
env
.
TOGETHER_AI_MODEL_PREF
,
AzureOpenAiEndpoint
:
process
.
env
.
AZURE_OPENAI_ENDPOINT
,
AzureOpenAiKey
:
!!
process
.
env
.
AZURE_OPENAI_KEY
,
// Perplexity AI Keys
AzureOpenAiEmbeddingModelPref
:
process
.
env
.
EMBEDDING_MODEL_PREF
,
PerplexityApiKey
:
!!
process
.
env
.
PERPLEXITY_API_KEY
,
}
PerplexityModelPref
:
process
.
env
.
PERPLEXITY_MODEL_PREF
,
:
{}),
// OpenRouter Keys
...(
llmProvider
===
"
lmstudio
"
OpenRouterApiKey
:
!!
process
.
env
.
OPENROUTER_API_KEY
,
?
{
OpenRouterModelPref
:
process
.
env
.
OPENROUTER_MODEL_PREF
,
LMStudioBasePath
:
process
.
env
.
LMSTUDIO_BASE_PATH
,
LMStudioTokenLimit
:
process
.
env
.
LMSTUDIO_MODEL_TOKEN_LIMIT
,
// Mistral AI (API) Keys
LMStudioModelPref
:
process
.
env
.
LMSTUDIO_MODEL_PREF
,
MistralApiKey
:
!!
process
.
env
.
MISTRAL_API_KEY
,
MistralModelPref
:
process
.
env
.
MISTRAL_MODEL_PREF
,
// For embedding credentials when lmstudio is selected.
OpenAiKey
:
!!
process
.
env
.
OPEN_AI_KEY
,
// Groq AI API Keys
AzureOpenAiEndpoint
:
process
.
env
.
AZURE_OPENAI_ENDPOINT
,
GroqApiKey
:
!!
process
.
env
.
GROQ_API_KEY
,
AzureOpenAiKey
:
!!
process
.
env
.
AZURE_OPENAI_KEY
,
GroqModelPref
:
process
.
env
.
GROQ_MODEL_PREF
,
AzureOpenAiEmbeddingModelPref
:
process
.
env
.
EMBEDDING_MODEL_PREF
,
}
// Native LLM Keys
:
{}),
NativeLLMModelPref
:
process
.
env
.
NATIVE_LLM_MODEL_PREF
,
...(
llmProvider
===
"
localai
"
NativeLLMTokenLimit
:
process
.
env
.
NATIVE_LLM_MODEL_TOKEN_LIMIT
,
?
{
LocalAiBasePath
:
process
.
env
.
LOCAL_AI_BASE_PATH
,
// HuggingFace Dedicated Inference
LocalAiModelPref
:
process
.
env
.
LOCAL_AI_MODEL_PREF
,
HuggingFaceLLMEndpoint
:
process
.
env
.
HUGGING_FACE_LLM_ENDPOINT
,
LocalAiTokenLimit
:
process
.
env
.
LOCAL_AI_MODEL_TOKEN_LIMIT
,
HuggingFaceLLMAccessToken
:
!!
process
.
env
.
HUGGING_FACE_LLM_API_KEY
,
HuggingFaceLLMTokenLimit
:
process
.
env
.
HUGGING_FACE_LLM_TOKEN_LIMIT
,
// For embedding credentials when localai is selected.
OpenAiKey
:
!!
process
.
env
.
OPEN_AI_KEY
,
// --------------------------------------------------------
AzureOpenAiEndpoint
:
process
.
env
.
AZURE_OPENAI_ENDPOINT
,
// Whisper (Audio transcription) Selection Settings & Configs
AzureOpenAiKey
:
!!
process
.
env
.
AZURE_OPENAI_KEY
,
// - Currently the only 3rd party is OpenAI, so is OPEN_AI_KEY is set
AzureOpenAiEmbeddingModelPref
:
process
.
env
.
EMBEDDING_MODEL_PREF
,
// - then it can be shared.
}
// --------------------------------------------------------
:
{}),
...(
llmProvider
===
"
ollama
"
?
{
OllamaLLMBasePath
:
process
.
env
.
OLLAMA_BASE_PATH
,
OllamaLLMModelPref
:
process
.
env
.
OLLAMA_MODEL_PREF
,
OllamaLLMTokenLimit
:
process
.
env
.
OLLAMA_MODEL_TOKEN_LIMIT
,
// For embedding credentials when ollama is selected.
OpenAiKey
:
!!
process
.
env
.
OPEN_AI_KEY
,
AzureOpenAiEndpoint
:
process
.
env
.
AZURE_OPENAI_ENDPOINT
,
AzureOpenAiKey
:
!!
process
.
env
.
AZURE_OPENAI_KEY
,
AzureOpenAiEmbeddingModelPref
:
process
.
env
.
EMBEDDING_MODEL_PREF
,
}
:
{}),
...(
llmProvider
===
"
togetherai
"
?
{
TogetherAiApiKey
:
!!
process
.
env
.
TOGETHER_AI_API_KEY
,
TogetherAiModelPref
:
process
.
env
.
TOGETHER_AI_MODEL_PREF
,
// For embedding credentials when ollama is selected.
OpenAiKey
:
!!
process
.
env
.
OPEN_AI_KEY
,
AzureOpenAiEndpoint
:
process
.
env
.
AZURE_OPENAI_ENDPOINT
,
AzureOpenAiKey
:
!!
process
.
env
.
AZURE_OPENAI_KEY
,
AzureOpenAiEmbeddingModelPref
:
process
.
env
.
EMBEDDING_MODEL_PREF
,
}
:
{}),
...(
llmProvider
===
"
perplexity
"
?
{
PerplexityApiKey
:
!!
process
.
env
.
PERPLEXITY_API_KEY
,
PerplexityModelPref
:
process
.
env
.
PERPLEXITY_MODEL_PREF
,
// For embedding credentials when ollama is selected.
OpenAiKey
:
!!
process
.
env
.
OPEN_AI_KEY
,
AzureOpenAiEndpoint
:
process
.
env
.
AZURE_OPENAI_ENDPOINT
,
AzureOpenAiKey
:
!!
process
.
env
.
AZURE_OPENAI_KEY
,
AzureOpenAiEmbeddingModelPref
:
process
.
env
.
EMBEDDING_MODEL_PREF
,
}
:
{}),
...(
llmProvider
===
"
openrouter
"
?
{
OpenRouterApiKey
:
!!
process
.
env
.
OPENROUTER_API_KEY
,
OpenRouterModelPref
:
process
.
env
.
OPENROUTER_MODEL_PREF
,
// For embedding credentials when ollama is selected.
OpenAiKey
:
!!
process
.
env
.
OPEN_AI_KEY
,
AzureOpenAiEndpoint
:
process
.
env
.
AZURE_OPENAI_ENDPOINT
,
AzureOpenAiKey
:
!!
process
.
env
.
AZURE_OPENAI_KEY
,
AzureOpenAiEmbeddingModelPref
:
process
.
env
.
EMBEDDING_MODEL_PREF
,
}
:
{}),
...(
llmProvider
===
"
mistral
"
?
{
MistralApiKey
:
!!
process
.
env
.
MISTRAL_API_KEY
,
MistralModelPref
:
process
.
env
.
MISTRAL_MODEL_PREF
,
// For embedding credentials when mistral is selected.
OpenAiKey
:
!!
process
.
env
.
OPEN_AI_KEY
,
AzureOpenAiEndpoint
:
process
.
env
.
AZURE_OPENAI_ENDPOINT
,
AzureOpenAiKey
:
!!
process
.
env
.
AZURE_OPENAI_KEY
,
AzureOpenAiEmbeddingModelPref
:
process
.
env
.
EMBEDDING_MODEL_PREF
,
}
:
{}),
...(
llmProvider
===
"
groq
"
?
{
GroqApiKey
:
!!
process
.
env
.
GROQ_API_KEY
,
GroqModelPref
:
process
.
env
.
GROQ_MODEL_PREF
,
// For embedding credentials when groq is selected.
OpenAiKey
:
!!
process
.
env
.
OPEN_AI_KEY
,
AzureOpenAiEndpoint
:
process
.
env
.
AZURE_OPENAI_ENDPOINT
,
AzureOpenAiKey
:
!!
process
.
env
.
AZURE_OPENAI_KEY
,
AzureOpenAiEmbeddingModelPref
:
process
.
env
.
EMBEDDING_MODEL_PREF
,
}
:
{}),
...(
llmProvider
===
"
native
"
?
{
NativeLLMModelPref
:
process
.
env
.
NATIVE_LLM_MODEL_PREF
,
NativeLLMTokenLimit
:
process
.
env
.
NATIVE_LLM_MODEL_TOKEN_LIMIT
,
// For embedding credentials when native is selected.
OpenAiKey
:
!!
process
.
env
.
OPEN_AI_KEY
,
AzureOpenAiEndpoint
:
process
.
env
.
AZURE_OPENAI_ENDPOINT
,
AzureOpenAiKey
:
!!
process
.
env
.
AZURE_OPENAI_KEY
,
AzureOpenAiEmbeddingModelPref
:
process
.
env
.
EMBEDDING_MODEL_PREF
,
}
:
{}),
...(
llmProvider
===
"
huggingface
"
?
{
HuggingFaceLLMEndpoint
:
process
.
env
.
HUGGING_FACE_LLM_ENDPOINT
,
HuggingFaceLLMAccessToken
:
!!
process
.
env
.
HUGGING_FACE_LLM_API_KEY
,
HuggingFaceLLMTokenLimit
:
process
.
env
.
HUGGING_FACE_LLM_TOKEN_LIMIT
,
// For embedding credentials when Anthropic is selected.
OpenAiKey
:
!!
process
.
env
.
OPEN_AI_KEY
,
AzureOpenAiEndpoint
:
process
.
env
.
AZURE_OPENAI_ENDPOINT
,
AzureOpenAiKey
:
!!
process
.
env
.
AZURE_OPENAI_KEY
,
AzureOpenAiEmbeddingModelPref
:
process
.
env
.
EMBEDDING_MODEL_PREF
,
}
:
{}),
WhisperProvider
:
process
.
env
.
WHISPER_PROVIDER
||
"
local
"
,
WhisperProvider
:
process
.
env
.
WHISPER_PROVIDER
||
"
local
"
,
};
};
},
},
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment