25 lines
643 B
Python
25 lines
643 B
Python
from functools import lru_cache
|
|
|
|
from pydantic_settings import BaseSettings, SettingsConfigDict
|
|
|
|
|
|
class Settings(BaseSettings):
|
|
model_config = SettingsConfigDict(env_prefix="DASH_", env_file=".env", extra="ignore")
|
|
|
|
host: str = "127.0.0.1"
|
|
port: int = 8501
|
|
sample_interval: float = 2.0
|
|
retention_minutes: int = 60
|
|
|
|
llama_base_url: str = "http://127.0.0.1:8080"
|
|
llama_api_key: str = ""
|
|
llama_timeout: float = 4.0
|
|
|
|
@property
|
|
def history_maxlen(self) -> int:
|
|
return max(10, int(self.retention_minutes * 60 / self.sample_interval))
|
|
|
|
|
|
@lru_cache
|
|
def get_settings() -> Settings:
|
|
return Settings()
|