from os import environ, path from datetime import timedelta import redis basedir = path.abspath(path.dirname(__file__)) class Config(object): DEBUG = False DEVELOPMENT = False SECRET_KEY = '97867c1491bea5ee6a8e8436eb11bf2ba6a69ff53ab1b17ecba450d0f2e572e1' SESSION_COOKIE_SECURE = False SESSION_COOKIE_HTTPONLY = True WTF_CSRF_ENABLED = True # flask-security-too settings # SECURITY_URL_PREFIX = '/admin' SECURITY_LOGIN_URL = '/admin/login' SECURITY_LOGOUT_URL = '/admin/logout' # SECURITY_REGISTER_URL = '/admin/register' # SECURITY_RESET_URL = '/admin/reset' # SECURITY_CHANGE_URL = '/admin/change' # SECURITY_POST_LOGIN_VIEW = '/admin/user/tenant_overview' # SECURITY_POST_LOGOUT_VIEW = '/admin' # SECURITY_POST_REGISTER_VIEW = '/admin/user/tenant_overview' # SECURITY_POST_RESET_VIEW = '/admin/login' # SECURITY_POST_CHANGE_VIEW = '/admin/login' # SECURITY_BLUEPRINT_NAME = 'security_bp' SECURITY_PASSWORD_SALT = '228614859439123264035565568761433607235' REMEMBER_COOKIE_SAMESITE = 'strict' SESSION_COOKIE_SAMESITE = 'strict' SECURITY_CONFIRMABLE = True SECURITY_TRACKABLE = True SECURITY_PASSWORD_COMPLEXITY_CHECKER = 'zxcvbn' SECURITY_POST_LOGIN_VIEW = '/user/tenant_overview' SECURITY_RECOVERABLE = True SECURITY_EMAIL_SENDER = "eveai_super@flow-it.net" # Ensure Flask-Security-Too is handling CSRF tokens when behind a proxy SECURITY_CSRF_PROTECT_MECHANISMS = ['session'] SECURITY_CSRF_COOKIE_NAME = 'XSRF-TOKEN' SECURITY_CSRF_HEADER = 'X-XSRF-TOKEN' WTF_CSRF_CHECK_DEFAULT = False # flask-mailman settings MAIL_SERVER = 'mail.flow-it.net' MAIL_PORT = 587 MAIL_USE_TLS = True MAIL_USE_SSL = False MAIL_DEFAULT_SENDER = ('eveAI Admin', 'eveai_admin@flow-it.net') # file upload settings MAX_CONTENT_LENGTH = 16 * 1024 * 1024 UPLOAD_EXTENSIONS = ['.txt', '.pdf', '.png', '.jpg', '.jpeg', '.gif'] # supported languages SUPPORTED_LANGUAGES = ['en', 'fr', 'nl', 'de', 'es'] # supported LLMs SUPPORTED_EMBEDDINGS = ['openai.text-embedding-3-small', 'mistral.mistral-embed'] SUPPORTED_LLMS = ['openai.gpt-4o', 'openai.gpt-4-turbo', 'openai.gpt-3.5-turbo', 'mistral.mistral-large-2402'] # Celery settings CELERY_TASK_SERIALIZER = 'json' CELERY_RESULT_SERIALIZER = 'json' CELERY_ACCEPT_CONTENT = ['json'] CELERY_TIMEZONE = 'UTC' CELERY_ENABLE_UTC = True # Chunk Definition, Embedding dependent OAI_TE3S_MIN_CHUNK_SIZE = 2000 OAI_TE3S_MAX_CHUNK_SIZE = 3000 # LLM TEMPLATES GPT4_SUMMARY_TEMPLATE = """Write a concise summary of the text in the same language as the provided text. Text is delimited between triple backquotes. ```{text}```""" GPT3_5_SUMMARY_TEMPLATE = """Write a concise summary of the text in the same language as the provided text. Text is delimited between triple backquotes. ```{text}```""" GPT4_RAG_TEMPLATE = """Answer the question based on the following context, both delimited between triple backquotes in the same language as question. If the question cannot be answered using the text, say "I don't know" in the same language as the question. Context: ```{context}``` Question: ```{question}```""" GPT3_5_RAG_TEMPLATE = """Answer the question based on the following context, both delimited between triple backquotes in the same language as question. If the question cannot be answered using the text, say "I don't know" in the same language as the question. Context: ```{context}``` Question: ```{question}```""" # SocketIO settings # SOCKETIO_ASYNC_MODE = 'threading' SOCKETIO_ASYNC_MODE = 'gevent' # Session Settings SESSION_TYPE = 'redis' SESSION_PERMANENT = False SESSION_USE_SIGNER = True PERMANENT_SESSION_LIFETIME = timedelta(minutes=60) SESSION_REFRESH_EACH_REQUEST = True class DevConfig(Config): DEVELOPMENT = True DEBUG = True FLASK_DEBUG = True PYCHARM_DEBUG = False SQLALCHEMY_DATABASE_URI = 'postgresql+pg8000://josako@localhost:5432/eveAI' SQLALCHEMY_BINDS = {'public': 'postgresql+pg8000://josako@localhost:5432/eveAI'} EXPLAIN_TEMPLATE_LOADING = False # Define the nginx prefix used for the specific apps EVEAI_APP_LOCATION_PREFIX = '/admin' EVEAI_CHAT_LOCATION_PREFIX = '/chat' # flask-mailman settings MAIL_USERNAME = 'eveai_super@flow-it.net' MAIL_PASSWORD = '$6xsWGbNtx$CFMQZqc*' # file upload settings UPLOAD_FOLDER = '/Volumes/OWC4M2_1/Development/eveAI/file_store' # Celery settings # eveai_app Redis Settings CELERY_BROKER_URL = 'redis://localhost:6379/0' CELERY_RESULT_BACKEND = 'redis://localhost:6379/0' # eveai_chat Redis Settings CELERY_BROKER_URL_CHAT = 'redis://localhost:6379/3' CELERY_RESULT_BACKEND_CHAT = 'redis://localhost:6379/3' # OpenAI API Keys OPENAI_API_KEY = 'sk-proj-8R0jWzwjL7PeoPyMhJTZT3BlbkFJLb6HfRB2Hr9cEVFWEhU7' # Unstructured settings UNSTRUCTURED_API_KEY = 'pDgCrXumYhM3CNvjvwV8msMldXC3uw' UNSTRUCTURED_BASE_URL = 'https://flowitbv-16c4us0m.api.unstructuredapp.io' UNSTRUCTURED_FULL_URL = 'https://flowitbv-16c4us0m.api.unstructuredapp.io/general/v0/general' # SocketIO settings SOCKETIO_MESSAGE_QUEUE = 'redis://localhost:6379/1' SOCKETIO_CORS_ALLOWED_ORIGINS = '*' SOCKETIO_LOGGER = True SOCKETIO_ENGINEIO_LOGGER = True # Google Cloud settings GC_PROJECT_NAME = 'eveai-420711' GC_LOCATION = 'europe-west1' GC_KEY_RING = 'eveai-chat' GC_CRYPTO_KEY = 'envelope-encryption-key' # JWT settings JWT_SECRET_KEY = 'bsdMkmQ8ObfMD52yAFg4trrvjgjMhuIqg2fjDpD/JqvgY0ccCcmlsEnVFmR79WPiLKEA3i8a5zmejwLZKl4v9Q==' # Session settings SESSION_REDIS = redis.from_url('redis://localhost:6379/2') class ProdConfig(Config): DEVELOPMENT = False DEBUG = False # SQLALCHEMY_DATABASE_URI = environ.get('SQLALCHEMY_DATABASE_URI') or \ # 'sqlite:///' + os.path.join(basedir, 'db.sqlite') config = { 'dev': DevConfig(), 'prod': ProdConfig(), 'default': DevConfig(), }