Initial commit
This commit is contained in:
0
hsbg_ai/backend/config/__init__.py
Normal file
0
hsbg_ai/backend/config/__init__.py
Normal file
67
hsbg_ai/backend/config/settings.py
Normal file
67
hsbg_ai/backend/config/settings.py
Normal file
@@ -0,0 +1,67 @@
|
||||
"""Configuration centralisée via Pydantic Settings."""
|
||||
from functools import lru_cache
|
||||
from pydantic_settings import BaseSettings
|
||||
from pydantic import field_validator
|
||||
from typing import List
|
||||
|
||||
|
||||
class Settings(BaseSettings):
|
||||
# Serveur
|
||||
backend_host: str = "127.0.0.1"
|
||||
backend_port: int = 8000
|
||||
debug: bool = True
|
||||
secret_key: str = "changeme"
|
||||
|
||||
# Base de données
|
||||
database_url: str = "sqlite:///./data/hsbg_ai.db"
|
||||
|
||||
# LLM
|
||||
llm_provider: str = "ollama"
|
||||
llm_base_url: str = "http://localhost:11434"
|
||||
llm_model: str = "llama3.2"
|
||||
llm_fallback_model: str = "mistral"
|
||||
llm_timeout: int = 30
|
||||
llm_max_tokens: int = 2048
|
||||
llm_temperature: float = 0.1
|
||||
|
||||
# Vision
|
||||
vision_enabled: bool = True
|
||||
screenshot_interval: float = 2.0
|
||||
tesseract_path: str = "/usr/bin/tesseract"
|
||||
|
||||
# Apprentissage
|
||||
learning_enabled: bool = True
|
||||
learning_rate: float = 0.001
|
||||
learning_batch_size: int = 32
|
||||
learning_auto_save: bool = True
|
||||
learning_save_interval: int = 300
|
||||
|
||||
# Frontend
|
||||
frontend_host: str = "127.0.0.1"
|
||||
frontend_port: int = 3000
|
||||
cors_origins: List[str] = ["http://localhost:3000", "http://127.0.0.1:3000"]
|
||||
|
||||
# Logs
|
||||
log_level: str = "INFO"
|
||||
log_file: str = "./logs/hsbg_ai.log"
|
||||
|
||||
# Data
|
||||
hsbg_data_path: str = "./data/hsbg"
|
||||
current_patch: str = "30.2"
|
||||
|
||||
@field_validator("cors_origins", mode="before")
|
||||
@classmethod
|
||||
def parse_cors(cls, v):
|
||||
if isinstance(v, str):
|
||||
return [x.strip() for x in v.split(",")]
|
||||
return v
|
||||
|
||||
class Config:
|
||||
env_file = ".env"
|
||||
env_file_encoding = "utf-8"
|
||||
case_sensitive = False
|
||||
|
||||
|
||||
@lru_cache()
|
||||
def get_settings() -> Settings:
|
||||
return Settings()
|
||||
Reference in New Issue
Block a user