""" Configuration settings for the AI service. """ import os import os.path # Try to load environment variables from .env file try: from dotenv import load_dotenv dotenv_path = os.path.join(os.path.dirname(__file__), '.env') load_dotenv(dotenv_path=dotenv_path) except ImportError: print("Warning: python-dotenv not installed. Using environment variables directly.") class Config: """Base configuration.""" # API configuration API_HOST = os.environ.get('API_HOST', '0.0.0.0') API_PORT = int(os.environ.get('API_PORT', 5252)) PUBLIC_URL = os.environ.get('PUBLIC_URL', '') # Public URL for webhooks # OpenWebUI configuration OPENWEBUI_URL = os.environ.get('OPENWEBUI_URL', 'http://104.225.217.215:8080') OPENWEBUI_API_KEY = os.environ.get('OPENWEBUI_API_KEY', '') # Ollama configuration OLLAMA_API_URL = os.environ.get('OLLAMA_API_URL', 'http://127.0.0.1:11434') DEFAULT_MODEL = os.environ.get('DEFAULT_MODEL', 'llama3.1') API_TIMEOUT = int(os.environ.get('API_TIMEOUT', 300)) # Default timeout of 5 minutes (300 seconds) # Document processing CHUNK_SIZE = int(os.environ.get('CHUNK_SIZE', 1000)) CHUNK_OVERLAP = int(os.environ.get('CHUNK_OVERLAP', 200)) # Bot configuration BOT_ENABLED = os.environ.get('BOT_ENABLED', 'true').lower() == 'true' BOT_SYSTEM_PROMPT = os.environ.get('BOT_SYSTEM_PROMPT', 'You are a helpful AI assistant.') BOT_TEMPERATURE = float(os.environ.get('BOT_TEMPERATURE', '0.7')) BOT_MAX_TOKENS = int(os.environ.get('BOT_MAX_TOKENS', '2048')) BOT_TOP_P = float(os.environ.get('BOT_TOP_P', '0.9')) BOT_TRIGGERS = os.environ.get('BOT_TRIGGERS', '@ai,@bot,@assistant,@chatbot').split(',') BOT_RESPOND_TO_ALL = os.environ.get('BOT_RESPOND_TO_ALL', 'false').lower() == 'true' config = Config()