| from pathlib import Path | |
| from pydantic import BaseModel, Field, ConfigDict | |
| class AppSettings(BaseModel): | |
| """Configuración tipada de la app, cargable por variables de entorno (prefijo LLAMA_DEV_).""" | |
| model_config = ConfigDict(env_prefix="LLAMA_DEV_", arbitrary_types_allowed=True) | |
| OLLAMA_URL: str = Field(default="http://127.0.0.1:11434") | |
| MAX_FILE_SIZE: int = Field(default=25 * 1024 * 1024, description="Tamaño máximo por archivo (bytes)") | |
| MAX_TOTAL_UPLOAD: int = Field(default=100 * 1024 * 1024, description="Tamaño máximo total de archivos (bytes)") | |
| MAX_CHARS_PER_FILE: int = 40_000 | |
| MAX_CHAT_TURNS: int = 20 | |
| CONTEXT_HISTORY_TURNS: int = 5 | |
| HOST: str = "127.0.0.1" | |
| PORT: int = 7860 | |
| CHAT_SAVE_PATH: Path = Path("./saved_chats") | |
| CACHE_RESPONSES: bool = True | |
| CACHE_MAX_ITEMS: int = 128 | |
| settings = AppSettings() | |
| settings.CHAT_SAVE_PATH.mkdir(parents=True, exist_ok=True) | |