Files
problem-bank/backend/config.py
2026-03-06 15:52:34 +08:00

33 lines
999 B
Python

from pathlib import Path
from typing import Dict
from pydantic_settings import BaseSettings, SettingsConfigDict
class Settings(BaseSettings):
api_key: str = ""
model_name: str = "gpt-4.1"
openai_api_url: str = "https://api.openai.com/v1/responses"
jwt_secret_key: str = "change-me-in-env"
jwt_algorithm: str = "HS256"
access_token_expire_minutes: int = 60 * 12
admin_username: str = "admin"
admin_password: str = "admin123"
database_url: str = f"sqlite:///{Path(__file__).resolve().parent / 'problem_bank.db'}"
upload_dir: str = str(Path(__file__).resolve().parent / "uploads")
model_config = SettingsConfigDict(env_file=".env", env_file_encoding="utf-8")
@property
def type_map(self) -> Dict[str, str]:
return {
"单选题": "单选",
"多选题": "多选",
"不定项选择题": "不定项",
"填空题": "填空",
"解答题": "解答",
}
settings = Settings()