42 lines
1.1 KiB
Python
42 lines
1.1 KiB
Python
from functools import lru_cache
|
|
from typing import Optional
|
|
|
|
from pydantic_settings import BaseSettings, SettingsConfigDict
|
|
|
|
|
|
class Settings(BaseSettings):
|
|
model_config = SettingsConfigDict(
|
|
env_file=".env",
|
|
env_file_encoding="utf-8",
|
|
extra="ignore",
|
|
)
|
|
|
|
# Application
|
|
app_name: str = "PromptCR-Lab"
|
|
debug: bool = False
|
|
|
|
# Database (psycopg2 preferred; fall back to psycopg3 if not built)
|
|
database_url: str = "postgresql+psycopg://postgres:postgres@localhost:5432/promptcr"
|
|
|
|
# Model API keys (loaded from environment, never hardcoded)
|
|
deepseek_api_key: Optional[str] = None
|
|
deepseek_base_url: str = "https://api.deepseek.com/v1"
|
|
deepseek_model: str = "deepseek-chat"
|
|
|
|
kimi_api_key: Optional[str] = None
|
|
kimi_base_url: str = "https://api.moonshot.cn/v1"
|
|
kimi_model: str = "moonshot-v1-8k"
|
|
|
|
qwen_api_key: Optional[str] = None
|
|
qwen_base_url: str = "https://dashscope.aliyuncs.com/compatible-mode/v1"
|
|
qwen_model: str = "qwen-turbo"
|
|
|
|
# Defaults
|
|
default_model_concurrency: int = 5
|
|
default_max_retries: int = 3
|
|
|
|
|
|
@lru_cache
|
|
def get_settings() -> Settings:
|
|
return Settings()
|