Spaces:
Sleeping

File size: 979 Bytes
869d534
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
34
35
# config.py
from pathlib import Path
from pydantic_settings import BaseSettings
from functools import lru_cache

class Settings(BaseSettings):
    # Base configuration
    ENVIRONMENT: str = "local"
    DEBUG: bool = False
    DATA_DIR: Path = Path("./data")
    
    # API Keys and External Services
    SAMBANOVA_API_KEY: str
    PUSH_TO_HUB: bool = False
    
    # Paths and Files
    DATA_FILE: Path = DATA_DIR / "logged_data.csv"
    
    def __init__(self, **kwargs):
        super().__init__(**kwargs)
        # Set data file based on environment
        if not self.DATA_FILE:
            self.DATA_FILE = self.DATA_DIR / f"feedback_{self.ENVIRONMENT}.csv"
        
        # Ensure data directory exists
        self.DATA_DIR.mkdir(parents=True, exist_ok=True)
    
    class Config:
        env_file = ".env"
        env_file_encoding = "utf-8"

@lru_cache()
def get_settings():
    """Cached settings to avoid reading .env file multiple times"""
    return Settings()