File size: 1,192 Bytes
a48d26f
 
 
 
939cea3
a48d26f
 
 
939cea3
 
a48d26f
939cea3
a48d26f
939cea3
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# config.py
import os
from dotenv import load_dotenv

# Load environment variables from .env file
load_dotenv()

class Config:
    # MySQL Configuration
    MYSQL_HOST = os.getenv('MYSQL_HOST', '127.0.0.1')
    MYSQL_USER = os.getenv('MYSQL_USER', 'root')
    MYSQL_PASSWORD = os.getenv('MYSQL_PASSWORD', 'nikhil')  # Default password, better to set in .env
    MYSQL_DB = os.getenv('MYSQL_DB', 'ragchatbot')
    
    # Application Configuration
    CHUNK_SIZE = int(os.getenv('CHUNK_SIZE', '300'))
    TOP_K_RESULTS = int(os.getenv('TOP_K_RESULTS', '5'))
    
    # Model Configuration
    EMBEDDING_MODEL = os.getenv('EMBEDDING_MODEL', 'sentence-transformers/all-MiniLM-L6-v2')
    
    # Upload Configuration
    UPLOAD_FOLDER = os.getenv('UPLOAD_FOLDER', 'uploads')
    MAX_CONTENT_LENGTH = int(os.getenv('MAX_CONTENT_LENGTH', '16777216'))  # 16MB
    ALLOWED_EXTENSIONS = {'txt', 'pdf', 'docx'}
    
    # Server Configuration
    SERVER_HOST = os.getenv('SERVER_HOST', '0.0.0.0')
    SERVER_PORT = int(os.getenv('SERVER_PORT', '7860'))
    
    # Database Configuration
    DB_POOL_SIZE = int(os.getenv('DB_POOL_SIZE', '5'))
    DB_POOL_TIMEOUT = int(os.getenv('DB_POOL_TIMEOUT', '30'))