apersona/backend/app/core/config.py

57 lines
1.6 KiB
Python

from pydantic_settings import BaseSettings
from typing import List
import os
from pathlib import Path
class Settings(BaseSettings):
# App Configuration
APP_NAME: str = "aPersona"
APP_VERSION: str = "1.0.0"
DEBUG: bool = True
API_V1_STR: str = "/api/v1"
# Security
SECRET_KEY: str = "your-secret-key-change-in-production"
ACCESS_TOKEN_EXPIRE_MINUTES: int = 60 * 24 * 8 # 8 days
ALGORITHM: str = "HS256"
# Database
DATABASE_URL: str = "sqlite:///./apersona.db"
# File Storage
UPLOAD_DIR: Path = Path("../data/uploads")
PROCESSED_DIR: Path = Path("../data/processed")
VECTOR_DB_DIR: Path = Path("../data/vectors")
MAX_FILE_SIZE: int = 100 * 1024 * 1024 # 100MB
# AI Configuration
OLLAMA_BASE_URL: str = "http://localhost:11434"
DEFAULT_LLM_MODEL: str = "mistral"
EMBEDDING_MODEL: str = "all-MiniLM-L6-v2"
VECTOR_COLLECTION_NAME: str = "apersona_documents"
# CORS
BACKEND_CORS_ORIGINS: List[str] = [
"http://localhost:3000",
"http://localhost:5173",
"http://127.0.0.1:3000",
"http://127.0.0.1:5173",
]
# Auto-Learning Configuration
LEARNING_UPDATE_INTERVAL: int = 3600 # 1 hour in seconds
MIN_INTERACTIONS_FOR_LEARNING: int = 10
FEEDBACK_WEIGHT: float = 0.1
def __init__(self, **kwargs):
super().__init__(**kwargs)
# Create directories if they don't exist
for directory in [self.UPLOAD_DIR, self.PROCESSED_DIR, self.VECTOR_DB_DIR]:
directory.mkdir(parents=True, exist_ok=True)
class Config:
env_file = ".env"
settings = Settings()