chore(server): update backend configuration files

- pyproject.toml: update project dependencies and metadata
- config.py: update application configuration settings
- openapi.py: update OpenAPI documentation
This commit is contained in:
caoxiaozhu
2026-05-12 03:01:24 +00:00
parent 4792b5074f
commit 33826929ba
3 changed files with 33 additions and 11 deletions

View File

@@ -67,6 +67,18 @@ class Settings(BaseSettings):
log_dir: str = Field(default="logs", alias="LOG_DIR")
log_file_enabled: bool = Field(default=True, alias="LOG_FILE_ENABLED")
storage_root_dir: str = Field(default="storage", alias="STORAGE_ROOT_DIR")
ocr_python_bin: str = Field(default="", alias="OCR_PYTHON_BIN")
ocr_timeout_seconds: int = Field(default=180, alias="OCR_TIMEOUT_SECONDS")
ocr_max_file_size_mb: int = Field(default=20, alias="OCR_MAX_FILE_SIZE_MB")
ocr_language: str = Field(default="ch", alias="OCR_LANGUAGE")
ocr_text_detection_model: str = Field(
default="PP-OCRv5_mobile_det",
alias="OCR_TEXT_DETECTION_MODEL",
)
ocr_text_recognition_model: str = Field(
default="PP-OCRv5_mobile_rec",
alias="OCR_TEXT_RECOGNITION_MODEL",
)
@property
def resolved_database_url(self) -> str:
@@ -85,6 +97,10 @@ class Settings(BaseSettings):
path = SERVER_DIR / path
return path.resolve()
@property
def resolved_ocr_temp_dir(self) -> Path:
return (self.resolved_storage_root_dir / "ocr_temp").resolve()
def _resolve_env_files() -> tuple[Path, ...]:
env_files = Settings.model_config.get("env_file") or ()
return tuple(Path(item) for item in env_files)