2023-05-15 08:51:32 +08:00
|
|
|
import os
|
|
|
|
|
|
|
|
import dotenv
|
|
|
|
|
|
|
|
dotenv.load_dotenv()
|
|
|
|
|
|
|
|
DEFAULTS = {
|
2024-04-25 22:26:45 +08:00
|
|
|
'EDITION': 'SELF_HOSTED',
|
2023-05-15 08:51:32 +08:00
|
|
|
'DB_USERNAME': 'postgres',
|
|
|
|
'DB_PASSWORD': '',
|
|
|
|
'DB_HOST': 'localhost',
|
|
|
|
'DB_PORT': '5432',
|
|
|
|
'DB_DATABASE': 'dify',
|
2023-12-08 13:22:04 +08:00
|
|
|
'DB_CHARSET': '',
|
2023-05-15 08:51:32 +08:00
|
|
|
'REDIS_HOST': 'localhost',
|
|
|
|
'REDIS_PORT': '6379',
|
|
|
|
'REDIS_DB': '0',
|
2023-05-17 15:40:21 +08:00
|
|
|
'REDIS_USE_SSL': 'False',
|
2023-05-15 08:51:32 +08:00
|
|
|
'OAUTH_REDIRECT_PATH': '/console/api/oauth/authorize',
|
|
|
|
'OAUTH_REDIRECT_INDEX_PATH': '/',
|
2023-07-14 11:19:26 +08:00
|
|
|
'CONSOLE_WEB_URL': 'https://cloud.dify.ai',
|
|
|
|
'CONSOLE_API_URL': 'https://cloud.dify.ai',
|
|
|
|
'SERVICE_API_URL': 'https://api.dify.ai',
|
|
|
|
'APP_WEB_URL': 'https://udify.app',
|
2023-11-13 22:05:46 +08:00
|
|
|
'FILES_URL': '',
|
2024-03-26 10:18:26 +08:00
|
|
|
'S3_ADDRESS_STYLE': 'auto',
|
2023-05-15 08:51:32 +08:00
|
|
|
'STORAGE_TYPE': 'local',
|
|
|
|
'STORAGE_LOCAL_PATH': 'storage',
|
|
|
|
'CHECK_UPDATE_URL': 'https://updates.dify.ai',
|
|
|
|
'DEPLOY_ENV': 'PRODUCTION',
|
2024-05-15 15:27:15 +08:00
|
|
|
'SQLALCHEMY_DATABASE_URI_SCHEME': 'postgresql',
|
2023-05-15 08:51:32 +08:00
|
|
|
'SQLALCHEMY_POOL_SIZE': 30,
|
2024-04-08 18:51:46 +08:00
|
|
|
'SQLALCHEMY_MAX_OVERFLOW': 10,
|
2023-08-12 00:57:00 +08:00
|
|
|
'SQLALCHEMY_POOL_RECYCLE': 3600,
|
2024-05-16 17:07:21 +08:00
|
|
|
'SQLALCHEMY_POOL_PRE_PING': 'False',
|
2023-05-15 08:51:32 +08:00
|
|
|
'SQLALCHEMY_ECHO': 'False',
|
|
|
|
'SENTRY_TRACES_SAMPLE_RATE': 1.0,
|
|
|
|
'SENTRY_PROFILES_SAMPLE_RATE': 1.0,
|
|
|
|
'WEAVIATE_GRPC_ENABLED': 'True',
|
2023-06-13 14:49:40 +08:00
|
|
|
'WEAVIATE_BATCH_SIZE': 100,
|
2024-01-04 10:58:47 +08:00
|
|
|
'QDRANT_CLIENT_TIMEOUT': 20,
|
2024-04-28 15:33:32 +08:00
|
|
|
'QDRANT_GRPC_ENABLED': 'False',
|
2024-04-29 15:28:34 +08:00
|
|
|
'QDRANT_GRPC_PORT': '6334',
|
2023-05-15 08:51:32 +08:00
|
|
|
'CELERY_BACKEND': 'database',
|
|
|
|
'LOG_LEVEL': 'INFO',
|
2024-04-20 08:59:49 +08:00
|
|
|
'LOG_FILE': '',
|
|
|
|
'LOG_FORMAT': '%(asctime)s.%(msecs)03d %(levelname)s [%(threadName)s] [%(filename)s:%(lineno)d] - %(message)s',
|
|
|
|
'LOG_DATEFORMAT': '%Y-%m-%d %H:%M:%S',
|
2023-08-12 00:57:00 +08:00
|
|
|
'HOSTED_OPENAI_QUOTA_LIMIT': 200,
|
2024-01-17 15:02:27 +08:00
|
|
|
'HOSTED_OPENAI_TRIAL_ENABLED': 'False',
|
2024-02-23 16:48:58 +08:00
|
|
|
'HOSTED_OPENAI_TRIAL_MODELS': 'gpt-3.5-turbo,gpt-3.5-turbo-1106,gpt-3.5-turbo-instruct,gpt-3.5-turbo-16k,gpt-3.5-turbo-16k-0613,gpt-3.5-turbo-0613,gpt-3.5-turbo-0125,text-davinci-003',
|
2023-08-12 00:57:00 +08:00
|
|
|
'HOSTED_OPENAI_PAID_ENABLED': 'False',
|
2024-04-10 22:55:46 +08:00
|
|
|
'HOSTED_OPENAI_PAID_MODELS': 'gpt-4,gpt-4-turbo-preview,gpt-4-turbo-2024-04-09,gpt-4-1106-preview,gpt-4-0125-preview,gpt-3.5-turbo,gpt-3.5-turbo-16k,gpt-3.5-turbo-16k-0613,gpt-3.5-turbo-1106,gpt-3.5-turbo-0613,gpt-3.5-turbo-0125,gpt-3.5-turbo-instruct,text-davinci-003',
|
2023-08-12 00:57:00 +08:00
|
|
|
'HOSTED_AZURE_OPENAI_ENABLED': 'False',
|
|
|
|
'HOSTED_AZURE_OPENAI_QUOTA_LIMIT': 200,
|
2023-08-17 16:56:20 +08:00
|
|
|
'HOSTED_ANTHROPIC_QUOTA_LIMIT': 600000,
|
2024-01-17 15:02:27 +08:00
|
|
|
'HOSTED_ANTHROPIC_TRIAL_ENABLED': 'False',
|
2023-08-12 00:57:00 +08:00
|
|
|
'HOSTED_ANTHROPIC_PAID_ENABLED': 'False',
|
2023-09-12 10:26:12 +08:00
|
|
|
'HOSTED_MODERATION_ENABLED': 'False',
|
|
|
|
'HOSTED_MODERATION_PROVIDERS': '',
|
2024-04-08 18:51:46 +08:00
|
|
|
'HOSTED_FETCH_APP_TEMPLATES_MODE': 'remote',
|
|
|
|
'HOSTED_FETCH_APP_TEMPLATES_REMOTE_DOMAIN': 'https://tmpl.dify.ai',
|
2023-08-16 23:14:27 +08:00
|
|
|
'CLEAN_DAY_SETTING': 30,
|
|
|
|
'UPLOAD_FILE_SIZE_LIMIT': 15,
|
|
|
|
'UPLOAD_FILE_BATCH_LIMIT': 5,
|
2023-11-13 22:05:46 +08:00
|
|
|
'UPLOAD_IMAGE_FILE_SIZE_LIMIT': 10,
|
|
|
|
'OUTPUT_MODERATION_BUFFER_SIZE': 300,
|
2023-11-21 11:50:06 +08:00
|
|
|
'MULTIMODAL_SEND_IMAGE_FORMAT': 'base64',
|
2023-12-18 23:24:06 +08:00
|
|
|
'INVITE_EXPIRY_HOURS': 72,
|
2023-12-20 15:37:57 +08:00
|
|
|
'BILLING_ENABLED': 'False',
|
|
|
|
'CAN_REPLACE_LOGO': 'False',
|
2023-12-18 23:24:06 +08:00
|
|
|
'ETL_TYPE': 'dify',
|
2024-02-22 23:31:57 +08:00
|
|
|
'KEYWORD_STORE': 'jieba',
|
2024-03-26 10:11:43 +08:00
|
|
|
'BATCH_UPLOAD_LIMIT': 20,
|
2024-04-16 13:36:28 +08:00
|
|
|
'CODE_EXECUTION_ENDPOINT': 'http://sandbox:8194',
|
|
|
|
'CODE_EXECUTION_API_KEY': 'dify-sandbox',
|
2024-03-26 10:11:43 +08:00
|
|
|
'TOOL_ICON_CACHE_MAX_AGE': 3600,
|
2024-04-09 15:39:36 +08:00
|
|
|
'MILVUS_DATABASE': 'default',
|
2024-04-01 20:19:30 +08:00
|
|
|
'KEYWORD_DATA_SOURCE_TYPE': 'database',
|
2024-04-18 17:33:32 +08:00
|
|
|
'INNER_API': 'False',
|
|
|
|
'ENTERPRISE_ENABLED': 'False',
|
2024-05-20 13:20:27 +08:00
|
|
|
'INDEXING_MAX_SEGMENTATION_TOKENS_LENGTH': 1000,
|
2024-05-24 15:27:12 +08:00
|
|
|
'WORKFLOW_MAX_EXECUTION_STEPS': 50,
|
|
|
|
'WORKFLOW_MAX_EXECUTION_TIME': 600,
|
2023-05-15 08:51:32 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
def get_env(key):
|
|
|
|
return os.environ.get(key, DEFAULTS.get(key))
|
|
|
|
|
|
|
|
|
|
|
|
def get_bool_env(key):
|
2024-01-17 15:02:27 +08:00
|
|
|
value = get_env(key)
|
|
|
|
return value.lower() == 'true' if value is not None else False
|
2023-05-15 08:51:32 +08:00
|
|
|
|
|
|
|
|
|
|
|
def get_cors_allow_origins(env, default):
|
|
|
|
cors_allow_origins = []
|
|
|
|
if get_env(env):
|
|
|
|
for origin in get_env(env).split(','):
|
|
|
|
cors_allow_origins.append(origin)
|
|
|
|
else:
|
|
|
|
cors_allow_origins = [default]
|
|
|
|
|
|
|
|
return cors_allow_origins
|
|
|
|
|
|
|
|
|
|
|
|
class Config:
|
|
|
|
"""Application configuration class."""
|
|
|
|
|
|
|
|
def __init__(self):
|
2023-11-13 22:05:46 +08:00
|
|
|
# ------------------------
|
|
|
|
# General Configurations.
|
|
|
|
# ------------------------
|
2024-05-14 03:18:26 +08:00
|
|
|
self.CURRENT_VERSION = "0.6.8"
|
2023-05-15 08:51:32 +08:00
|
|
|
self.COMMIT_SHA = get_env('COMMIT_SHA')
|
2024-04-25 22:26:45 +08:00
|
|
|
self.EDITION = get_env('EDITION')
|
2023-05-15 08:51:32 +08:00
|
|
|
self.DEPLOY_ENV = get_env('DEPLOY_ENV')
|
|
|
|
self.TESTING = False
|
|
|
|
self.LOG_LEVEL = get_env('LOG_LEVEL')
|
2024-04-20 08:59:49 +08:00
|
|
|
self.LOG_FILE = get_env('LOG_FILE')
|
|
|
|
self.LOG_FORMAT = get_env('LOG_FORMAT')
|
|
|
|
self.LOG_DATEFORMAT = get_env('LOG_DATEFORMAT')
|
2023-05-15 08:51:32 +08:00
|
|
|
|
2023-11-13 22:05:46 +08:00
|
|
|
# The backend URL prefix of the console API.
|
|
|
|
# used to concatenate the login authorization callback or notion integration callback.
|
2024-01-18 14:44:37 +08:00
|
|
|
self.CONSOLE_API_URL = get_env('CONSOLE_API_URL')
|
2023-11-13 22:05:46 +08:00
|
|
|
|
|
|
|
# The front-end URL prefix of the console web.
|
|
|
|
# used to concatenate some front-end addresses and for CORS configuration use.
|
2024-01-18 14:44:37 +08:00
|
|
|
self.CONSOLE_WEB_URL = get_env('CONSOLE_WEB_URL')
|
2023-11-13 22:05:46 +08:00
|
|
|
|
|
|
|
# WebApp Url prefix.
|
|
|
|
# used to display WebAPP API Base Url to the front-end.
|
2024-01-18 14:44:37 +08:00
|
|
|
self.APP_WEB_URL = get_env('APP_WEB_URL')
|
2023-11-13 22:05:46 +08:00
|
|
|
|
|
|
|
# Service API Url prefix.
|
|
|
|
# used to display Service API Base Url to the front-end.
|
2024-01-18 14:44:37 +08:00
|
|
|
self.SERVICE_API_URL = get_env('SERVICE_API_URL')
|
2023-11-13 22:05:46 +08:00
|
|
|
|
|
|
|
# File preview or download Url prefix.
|
|
|
|
# used to display File preview or download Url to the front-end or as Multi-model inputs;
|
|
|
|
# Url is signed and has expiration time.
|
|
|
|
self.FILES_URL = get_env('FILES_URL') if get_env('FILES_URL') else self.CONSOLE_API_URL
|
|
|
|
|
2023-05-15 08:51:32 +08:00
|
|
|
# Your App secret key will be used for securely signing the session cookie
|
|
|
|
# Make sure you are changing this key for your deployment with a strong key.
|
|
|
|
# You can generate a strong key using `openssl rand -base64 42`.
|
|
|
|
# Alternatively you can set it with `SECRET_KEY` environment variable.
|
|
|
|
self.SECRET_KEY = get_env('SECRET_KEY')
|
|
|
|
|
2024-04-18 17:33:32 +08:00
|
|
|
# Enable or disable the inner API.
|
|
|
|
self.INNER_API = get_bool_env('INNER_API')
|
|
|
|
# The inner API key is used to authenticate the inner API.
|
|
|
|
self.INNER_API_KEY = get_env('INNER_API_KEY')
|
|
|
|
|
2023-11-13 22:05:46 +08:00
|
|
|
# cors settings
|
|
|
|
self.CONSOLE_CORS_ALLOW_ORIGINS = get_cors_allow_origins(
|
|
|
|
'CONSOLE_CORS_ALLOW_ORIGINS', self.CONSOLE_WEB_URL)
|
|
|
|
self.WEB_API_CORS_ALLOW_ORIGINS = get_cors_allow_origins(
|
|
|
|
'WEB_API_CORS_ALLOW_ORIGINS', '*')
|
|
|
|
|
|
|
|
# check update url
|
|
|
|
self.CHECK_UPDATE_URL = get_env('CHECK_UPDATE_URL')
|
|
|
|
|
|
|
|
# ------------------------
|
|
|
|
# Database Configurations.
|
|
|
|
# ------------------------
|
|
|
|
db_credentials = {
|
|
|
|
key: get_env(key) for key in
|
2023-12-08 13:13:21 +08:00
|
|
|
['DB_USERNAME', 'DB_PASSWORD', 'DB_HOST', 'DB_PORT', 'DB_DATABASE', 'DB_CHARSET']
|
2023-11-13 22:05:46 +08:00
|
|
|
}
|
2024-05-15 15:27:15 +08:00
|
|
|
self.SQLALCHEMY_DATABASE_URI_SCHEME = get_env('SQLALCHEMY_DATABASE_URI_SCHEME')
|
2023-11-13 22:05:46 +08:00
|
|
|
|
2023-12-08 13:22:04 +08:00
|
|
|
db_extras = f"?client_encoding={db_credentials['DB_CHARSET']}" if db_credentials['DB_CHARSET'] else ""
|
|
|
|
|
2024-05-15 15:27:15 +08:00
|
|
|
self.SQLALCHEMY_DATABASE_URI = f"{self.SQLALCHEMY_DATABASE_URI_SCHEME}://{db_credentials['DB_USERNAME']}:{db_credentials['DB_PASSWORD']}@{db_credentials['DB_HOST']}:{db_credentials['DB_PORT']}/{db_credentials['DB_DATABASE']}{db_extras}"
|
2023-11-13 22:05:46 +08:00
|
|
|
self.SQLALCHEMY_ENGINE_OPTIONS = {
|
|
|
|
'pool_size': int(get_env('SQLALCHEMY_POOL_SIZE')),
|
2024-04-08 18:51:46 +08:00
|
|
|
'max_overflow': int(get_env('SQLALCHEMY_MAX_OVERFLOW')),
|
2024-05-16 17:07:21 +08:00
|
|
|
'pool_recycle': int(get_env('SQLALCHEMY_POOL_RECYCLE')),
|
|
|
|
'pool_pre_ping': get_bool_env('SQLALCHEMY_POOL_PRE_PING')
|
2023-11-13 22:05:46 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
self.SQLALCHEMY_ECHO = get_bool_env('SQLALCHEMY_ECHO')
|
|
|
|
|
|
|
|
# ------------------------
|
|
|
|
# Redis Configurations.
|
|
|
|
# ------------------------
|
2023-05-15 08:51:32 +08:00
|
|
|
self.REDIS_HOST = get_env('REDIS_HOST')
|
|
|
|
self.REDIS_PORT = get_env('REDIS_PORT')
|
2023-05-17 15:40:21 +08:00
|
|
|
self.REDIS_USERNAME = get_env('REDIS_USERNAME')
|
2023-05-15 08:51:32 +08:00
|
|
|
self.REDIS_PASSWORD = get_env('REDIS_PASSWORD')
|
|
|
|
self.REDIS_DB = get_env('REDIS_DB')
|
2023-05-17 15:40:21 +08:00
|
|
|
self.REDIS_USE_SSL = get_bool_env('REDIS_USE_SSL')
|
2023-05-15 08:51:32 +08:00
|
|
|
|
2023-11-13 22:05:46 +08:00
|
|
|
# ------------------------
|
|
|
|
# Celery worker Configurations.
|
|
|
|
# ------------------------
|
|
|
|
self.CELERY_BROKER_URL = get_env('CELERY_BROKER_URL')
|
|
|
|
self.CELERY_BACKEND = get_env('CELERY_BACKEND')
|
|
|
|
self.CELERY_RESULT_BACKEND = 'db+{}'.format(self.SQLALCHEMY_DATABASE_URI) \
|
|
|
|
if self.CELERY_BACKEND == 'database' else self.CELERY_BROKER_URL
|
|
|
|
self.BROKER_USE_SSL = self.CELERY_BROKER_URL.startswith('rediss://')
|
|
|
|
|
|
|
|
# ------------------------
|
|
|
|
# File Storage Configurations.
|
|
|
|
# ------------------------
|
2023-05-15 08:51:32 +08:00
|
|
|
self.STORAGE_TYPE = get_env('STORAGE_TYPE')
|
|
|
|
self.STORAGE_LOCAL_PATH = get_env('STORAGE_LOCAL_PATH')
|
|
|
|
self.S3_ENDPOINT = get_env('S3_ENDPOINT')
|
|
|
|
self.S3_BUCKET_NAME = get_env('S3_BUCKET_NAME')
|
|
|
|
self.S3_ACCESS_KEY = get_env('S3_ACCESS_KEY')
|
|
|
|
self.S3_SECRET_KEY = get_env('S3_SECRET_KEY')
|
|
|
|
self.S3_REGION = get_env('S3_REGION')
|
2024-03-26 10:18:26 +08:00
|
|
|
self.S3_ADDRESS_STYLE = get_env('S3_ADDRESS_STYLE')
|
2024-03-20 20:49:58 +08:00
|
|
|
self.AZURE_BLOB_ACCOUNT_NAME = get_env('AZURE_BLOB_ACCOUNT_NAME')
|
|
|
|
self.AZURE_BLOB_ACCOUNT_KEY = get_env('AZURE_BLOB_ACCOUNT_KEY')
|
|
|
|
self.AZURE_BLOB_CONTAINER_NAME = get_env('AZURE_BLOB_CONTAINER_NAME')
|
|
|
|
self.AZURE_BLOB_ACCOUNT_URL = get_env('AZURE_BLOB_ACCOUNT_URL')
|
2024-05-24 15:27:12 +08:00
|
|
|
self.ALIYUN_OSS_BUCKET_NAME = get_env('ALIYUN_OSS_BUCKET_NAME')
|
|
|
|
self.ALIYUN_OSS_ACCESS_KEY = get_env('ALIYUN_OSS_ACCESS_KEY')
|
|
|
|
self.ALIYUN_OSS_SECRET_KEY = get_env('ALIYUN_OSS_SECRET_KEY')
|
|
|
|
self.ALIYUN_OSS_ENDPOINT = get_env('ALIYUN_OSS_ENDPOINT')
|
|
|
|
self.ALIYUN_OSS_REGION = get_env('ALIYUN_OSS_REGION')
|
|
|
|
self.ALIYUN_OSS_AUTH_VERSION = get_env('ALIYUN_OSS_AUTH_VERSION')
|
2024-04-27 18:26:52 +08:00
|
|
|
self.GOOGLE_STORAGE_BUCKET_NAME = get_env('GOOGLE_STORAGE_BUCKET_NAME')
|
|
|
|
self.GOOGLE_STORAGE_SERVICE_ACCOUNT_JSON_BASE64 = get_env('GOOGLE_STORAGE_SERVICE_ACCOUNT_JSON_BASE64')
|
2023-05-15 08:51:32 +08:00
|
|
|
|
2023-11-13 22:05:46 +08:00
|
|
|
# ------------------------
|
|
|
|
# Vector Store Configurations.
|
2024-05-10 17:20:30 +08:00
|
|
|
# Currently, only support: qdrant, milvus, zilliz, weaviate, relyt, pgvector
|
2023-11-13 22:05:46 +08:00
|
|
|
# ------------------------
|
2023-05-15 08:51:32 +08:00
|
|
|
self.VECTOR_STORE = get_env('VECTOR_STORE')
|
2024-02-22 23:31:57 +08:00
|
|
|
self.KEYWORD_STORE = get_env('KEYWORD_STORE')
|
2023-05-15 08:51:32 +08:00
|
|
|
# qdrant settings
|
|
|
|
self.QDRANT_URL = get_env('QDRANT_URL')
|
|
|
|
self.QDRANT_API_KEY = get_env('QDRANT_API_KEY')
|
2024-01-03 22:23:04 +08:00
|
|
|
self.QDRANT_CLIENT_TIMEOUT = get_env('QDRANT_CLIENT_TIMEOUT')
|
2024-04-28 15:33:32 +08:00
|
|
|
self.QDRANT_GRPC_ENABLED = get_env('QDRANT_GRPC_ENABLED')
|
|
|
|
self.QDRANT_GRPC_PORT = get_env('QDRANT_GRPC_PORT')
|
2023-05-15 08:51:32 +08:00
|
|
|
|
2023-11-13 22:05:46 +08:00
|
|
|
# milvus / zilliz setting
|
2023-10-10 21:56:24 +08:00
|
|
|
self.MILVUS_HOST = get_env('MILVUS_HOST')
|
|
|
|
self.MILVUS_PORT = get_env('MILVUS_PORT')
|
|
|
|
self.MILVUS_USER = get_env('MILVUS_USER')
|
|
|
|
self.MILVUS_PASSWORD = get_env('MILVUS_PASSWORD')
|
|
|
|
self.MILVUS_SECURE = get_env('MILVUS_SECURE')
|
2024-04-09 15:39:36 +08:00
|
|
|
self.MILVUS_DATABASE = get_env('MILVUS_DATABASE')
|
2023-10-10 21:56:24 +08:00
|
|
|
|
2023-11-13 22:05:46 +08:00
|
|
|
# weaviate settings
|
|
|
|
self.WEAVIATE_ENDPOINT = get_env('WEAVIATE_ENDPOINT')
|
|
|
|
self.WEAVIATE_API_KEY = get_env('WEAVIATE_API_KEY')
|
|
|
|
self.WEAVIATE_GRPC_ENABLED = get_bool_env('WEAVIATE_GRPC_ENABLED')
|
|
|
|
self.WEAVIATE_BATCH_SIZE = int(get_env('WEAVIATE_BATCH_SIZE'))
|
2023-10-10 21:56:24 +08:00
|
|
|
|
2024-04-15 11:52:34 +08:00
|
|
|
# relyt settings
|
|
|
|
self.RELYT_HOST = get_env('RELYT_HOST')
|
|
|
|
self.RELYT_PORT = get_env('RELYT_PORT')
|
|
|
|
self.RELYT_USER = get_env('RELYT_USER')
|
|
|
|
self.RELYT_PASSWORD = get_env('RELYT_PASSWORD')
|
|
|
|
self.RELYT_DATABASE = get_env('RELYT_DATABASE')
|
|
|
|
|
2024-04-29 11:58:17 +08:00
|
|
|
# pgvecto rs settings
|
|
|
|
self.PGVECTO_RS_HOST = get_env('PGVECTO_RS_HOST')
|
|
|
|
self.PGVECTO_RS_PORT = get_env('PGVECTO_RS_PORT')
|
|
|
|
self.PGVECTO_RS_USER = get_env('PGVECTO_RS_USER')
|
|
|
|
self.PGVECTO_RS_PASSWORD = get_env('PGVECTO_RS_PASSWORD')
|
|
|
|
self.PGVECTO_RS_DATABASE = get_env('PGVECTO_RS_DATABASE')
|
|
|
|
|
2024-05-10 17:20:30 +08:00
|
|
|
# pgvector settings
|
|
|
|
self.PGVECTOR_HOST = get_env('PGVECTOR_HOST')
|
|
|
|
self.PGVECTOR_PORT = get_env('PGVECTOR_PORT')
|
|
|
|
self.PGVECTOR_USER = get_env('PGVECTOR_USER')
|
|
|
|
self.PGVECTOR_PASSWORD = get_env('PGVECTOR_PASSWORD')
|
|
|
|
self.PGVECTOR_DATABASE = get_env('PGVECTOR_DATABASE')
|
|
|
|
|
2023-11-13 22:05:46 +08:00
|
|
|
# ------------------------
|
|
|
|
# Mail Configurations.
|
|
|
|
# ------------------------
|
2023-07-14 11:19:26 +08:00
|
|
|
self.MAIL_TYPE = get_env('MAIL_TYPE')
|
|
|
|
self.MAIL_DEFAULT_SEND_FROM = get_env('MAIL_DEFAULT_SEND_FROM')
|
|
|
|
self.RESEND_API_KEY = get_env('RESEND_API_KEY')
|
2024-01-10 18:15:02 +08:00
|
|
|
self.RESEND_API_URL = get_env('RESEND_API_URL')
|
2024-02-07 18:08:41 +08:00
|
|
|
# SMTP settings
|
|
|
|
self.SMTP_SERVER = get_env('SMTP_SERVER')
|
|
|
|
self.SMTP_PORT = get_env('SMTP_PORT')
|
|
|
|
self.SMTP_USERNAME = get_env('SMTP_USERNAME')
|
|
|
|
self.SMTP_PASSWORD = get_env('SMTP_PASSWORD')
|
|
|
|
self.SMTP_USE_TLS = get_bool_env('SMTP_USE_TLS')
|
2024-05-24 15:27:12 +08:00
|
|
|
|
2023-11-21 11:50:06 +08:00
|
|
|
# ------------------------
|
2024-04-25 22:26:45 +08:00
|
|
|
# Workspace Configurations.
|
2023-11-21 11:50:06 +08:00
|
|
|
# ------------------------
|
|
|
|
self.INVITE_EXPIRY_HOURS = int(get_env('INVITE_EXPIRY_HOURS'))
|
2023-07-14 11:19:26 +08:00
|
|
|
|
2023-11-13 22:05:46 +08:00
|
|
|
# ------------------------
|
|
|
|
# Sentry Configurations.
|
|
|
|
# ------------------------
|
2023-05-15 08:51:32 +08:00
|
|
|
self.SENTRY_DSN = get_env('SENTRY_DSN')
|
|
|
|
self.SENTRY_TRACES_SAMPLE_RATE = float(get_env('SENTRY_TRACES_SAMPLE_RATE'))
|
|
|
|
self.SENTRY_PROFILES_SAMPLE_RATE = float(get_env('SENTRY_PROFILES_SAMPLE_RATE'))
|
|
|
|
|
2023-11-13 22:05:46 +08:00
|
|
|
# ------------------------
|
|
|
|
# Business Configurations.
|
|
|
|
# ------------------------
|
2023-05-15 08:51:32 +08:00
|
|
|
|
2023-11-13 22:05:46 +08:00
|
|
|
# multi model send image format, support base64, url, default is base64
|
|
|
|
self.MULTIMODAL_SEND_IMAGE_FORMAT = get_env('MULTIMODAL_SEND_IMAGE_FORMAT')
|
2023-05-15 08:51:32 +08:00
|
|
|
|
2023-11-13 22:05:46 +08:00
|
|
|
# Dataset Configurations.
|
|
|
|
self.CLEAN_DAY_SETTING = get_env('CLEAN_DAY_SETTING')
|
2023-05-15 08:51:32 +08:00
|
|
|
|
2023-11-13 22:05:46 +08:00
|
|
|
# File upload Configurations.
|
|
|
|
self.UPLOAD_FILE_SIZE_LIMIT = int(get_env('UPLOAD_FILE_SIZE_LIMIT'))
|
|
|
|
self.UPLOAD_FILE_BATCH_LIMIT = int(get_env('UPLOAD_FILE_BATCH_LIMIT'))
|
|
|
|
self.UPLOAD_IMAGE_FILE_SIZE_LIMIT = int(get_env('UPLOAD_IMAGE_FILE_SIZE_LIMIT'))
|
2023-05-15 08:51:32 +08:00
|
|
|
|
2023-11-13 22:05:46 +08:00
|
|
|
# Moderation in app Configurations.
|
|
|
|
self.OUTPUT_MODERATION_BUFFER_SIZE = int(get_env('OUTPUT_MODERATION_BUFFER_SIZE'))
|
|
|
|
|
|
|
|
# Notion integration setting
|
|
|
|
self.NOTION_CLIENT_ID = get_env('NOTION_CLIENT_ID')
|
|
|
|
self.NOTION_CLIENT_SECRET = get_env('NOTION_CLIENT_SECRET')
|
|
|
|
self.NOTION_INTEGRATION_TYPE = get_env('NOTION_INTEGRATION_TYPE')
|
|
|
|
self.NOTION_INTERNAL_SECRET = get_env('NOTION_INTERNAL_SECRET')
|
|
|
|
self.NOTION_INTEGRATION_TOKEN = get_env('NOTION_INTEGRATION_TOKEN')
|
2023-05-15 08:51:32 +08:00
|
|
|
|
2023-11-13 22:05:46 +08:00
|
|
|
# ------------------------
|
|
|
|
# Platform Configurations.
|
|
|
|
# ------------------------
|
2024-04-25 22:26:45 +08:00
|
|
|
self.GITHUB_CLIENT_ID = get_env('GITHUB_CLIENT_ID')
|
|
|
|
self.GITHUB_CLIENT_SECRET = get_env('GITHUB_CLIENT_SECRET')
|
|
|
|
self.GOOGLE_CLIENT_ID = get_env('GOOGLE_CLIENT_ID')
|
|
|
|
self.GOOGLE_CLIENT_SECRET = get_env('GOOGLE_CLIENT_SECRET')
|
|
|
|
self.OAUTH_REDIRECT_PATH = get_env('OAUTH_REDIRECT_PATH')
|
|
|
|
|
2023-08-12 00:57:00 +08:00
|
|
|
self.HOSTED_OPENAI_API_KEY = get_env('HOSTED_OPENAI_API_KEY')
|
|
|
|
self.HOSTED_OPENAI_API_BASE = get_env('HOSTED_OPENAI_API_BASE')
|
|
|
|
self.HOSTED_OPENAI_API_ORGANIZATION = get_env('HOSTED_OPENAI_API_ORGANIZATION')
|
2024-01-17 15:02:27 +08:00
|
|
|
self.HOSTED_OPENAI_TRIAL_ENABLED = get_bool_env('HOSTED_OPENAI_TRIAL_ENABLED')
|
2024-02-23 16:12:43 +08:00
|
|
|
self.HOSTED_OPENAI_TRIAL_MODELS = get_env('HOSTED_OPENAI_TRIAL_MODELS')
|
2023-08-17 16:56:20 +08:00
|
|
|
self.HOSTED_OPENAI_QUOTA_LIMIT = int(get_env('HOSTED_OPENAI_QUOTA_LIMIT'))
|
2023-08-12 00:57:00 +08:00
|
|
|
self.HOSTED_OPENAI_PAID_ENABLED = get_bool_env('HOSTED_OPENAI_PAID_ENABLED')
|
2024-02-23 16:12:43 +08:00
|
|
|
self.HOSTED_OPENAI_PAID_MODELS = get_env('HOSTED_OPENAI_PAID_MODELS')
|
2023-08-12 00:57:00 +08:00
|
|
|
|
|
|
|
self.HOSTED_AZURE_OPENAI_ENABLED = get_bool_env('HOSTED_AZURE_OPENAI_ENABLED')
|
|
|
|
self.HOSTED_AZURE_OPENAI_API_KEY = get_env('HOSTED_AZURE_OPENAI_API_KEY')
|
|
|
|
self.HOSTED_AZURE_OPENAI_API_BASE = get_env('HOSTED_AZURE_OPENAI_API_BASE')
|
2023-08-17 16:56:20 +08:00
|
|
|
self.HOSTED_AZURE_OPENAI_QUOTA_LIMIT = int(get_env('HOSTED_AZURE_OPENAI_QUOTA_LIMIT'))
|
2023-08-12 00:57:00 +08:00
|
|
|
|
|
|
|
self.HOSTED_ANTHROPIC_API_BASE = get_env('HOSTED_ANTHROPIC_API_BASE')
|
|
|
|
self.HOSTED_ANTHROPIC_API_KEY = get_env('HOSTED_ANTHROPIC_API_KEY')
|
2024-01-17 15:02:27 +08:00
|
|
|
self.HOSTED_ANTHROPIC_TRIAL_ENABLED = get_bool_env('HOSTED_ANTHROPIC_TRIAL_ENABLED')
|
2023-08-17 16:56:20 +08:00
|
|
|
self.HOSTED_ANTHROPIC_QUOTA_LIMIT = int(get_env('HOSTED_ANTHROPIC_QUOTA_LIMIT'))
|
2023-08-12 00:57:00 +08:00
|
|
|
self.HOSTED_ANTHROPIC_PAID_ENABLED = get_bool_env('HOSTED_ANTHROPIC_PAID_ENABLED')
|
2024-01-17 15:02:27 +08:00
|
|
|
|
|
|
|
self.HOSTED_MINIMAX_ENABLED = get_bool_env('HOSTED_MINIMAX_ENABLED')
|
|
|
|
self.HOSTED_SPARK_ENABLED = get_bool_env('HOSTED_SPARK_ENABLED')
|
|
|
|
self.HOSTED_ZHIPUAI_ENABLED = get_bool_env('HOSTED_ZHIPUAI_ENABLED')
|
2023-08-12 00:57:00 +08:00
|
|
|
|
2023-09-12 10:26:12 +08:00
|
|
|
self.HOSTED_MODERATION_ENABLED = get_bool_env('HOSTED_MODERATION_ENABLED')
|
|
|
|
self.HOSTED_MODERATION_PROVIDERS = get_env('HOSTED_MODERATION_PROVIDERS')
|
|
|
|
|
2024-04-08 18:51:46 +08:00
|
|
|
# fetch app templates mode, remote, builtin, db(only for dify SaaS), default: remote
|
|
|
|
self.HOSTED_FETCH_APP_TEMPLATES_MODE = get_env('HOSTED_FETCH_APP_TEMPLATES_MODE')
|
|
|
|
self.HOSTED_FETCH_APP_TEMPLATES_REMOTE_DOMAIN = get_env('HOSTED_FETCH_APP_TEMPLATES_REMOTE_DOMAIN')
|
|
|
|
|
2023-12-18 23:24:06 +08:00
|
|
|
self.ETL_TYPE = get_env('ETL_TYPE')
|
|
|
|
self.UNSTRUCTURED_API_URL = get_env('UNSTRUCTURED_API_URL')
|
2024-05-20 13:14:17 +08:00
|
|
|
self.UNSTRUCTURED_API_KEY = get_env('UNSTRUCTURED_API_KEY')
|
2023-12-20 15:37:57 +08:00
|
|
|
self.BILLING_ENABLED = get_bool_env('BILLING_ENABLED')
|
|
|
|
self.CAN_REPLACE_LOGO = get_bool_env('CAN_REPLACE_LOGO')
|
2023-12-18 23:24:06 +08:00
|
|
|
|
2024-02-22 17:16:22 +08:00
|
|
|
self.BATCH_UPLOAD_LIMIT = get_env('BATCH_UPLOAD_LIMIT')
|
|
|
|
|
2024-04-08 18:51:46 +08:00
|
|
|
self.CODE_EXECUTION_ENDPOINT = get_env('CODE_EXECUTION_ENDPOINT')
|
|
|
|
self.CODE_EXECUTION_API_KEY = get_env('CODE_EXECUTION_API_KEY')
|
|
|
|
|
2024-03-05 14:45:22 +08:00
|
|
|
self.API_COMPRESSION_ENABLED = get_bool_env('API_COMPRESSION_ENABLED')
|
2024-03-26 10:11:43 +08:00
|
|
|
self.TOOL_ICON_CACHE_MAX_AGE = get_env('TOOL_ICON_CACHE_MAX_AGE')
|
2024-03-05 14:45:22 +08:00
|
|
|
|
2024-04-01 20:19:30 +08:00
|
|
|
self.KEYWORD_DATA_SOURCE_TYPE = get_env('KEYWORD_DATA_SOURCE_TYPE')
|
2024-04-18 17:33:32 +08:00
|
|
|
self.ENTERPRISE_ENABLED = get_bool_env('ENTERPRISE_ENABLED')
|
2024-05-20 13:20:27 +08:00
|
|
|
|
|
|
|
# ------------------------
|
|
|
|
# Indexing Configurations.
|
|
|
|
# ------------------------
|
|
|
|
self.INDEXING_MAX_SEGMENTATION_TOKENS_LENGTH = get_env('INDEXING_MAX_SEGMENTATION_TOKENS_LENGTH')
|
2024-05-24 15:27:12 +08:00
|
|
|
|
|
|
|
self.WORKFLOW_MAX_EXECUTION_STEPS = get_env('WORKFLOW_MAX_EWORKFLOW_MAX_EXECUTION_STEPSXECUTION_STEPS')
|
|
|
|
self.WORKFLOW_MAX_EXECUTION_TIME = get_env('WORKFLOW_MAX_EXECUTION_TIME')
|