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

@@ -8,17 +8,18 @@ version = "0.1.0"
description = "Backend service for X-Financial reimbursement and approval platform."
readme = "README.md"
requires-python = ">=3.11"
dependencies = [
"fastapi>=0.115.0,<1.0.0",
"uvicorn[standard]>=0.30.0,<1.0.0",
"sqlalchemy>=2.0.36,<3.0.0",
"alembic>=1.14.0,<2.0.0",
"psycopg[binary]>=3.2.0,<4.0.0",
"PyJWT>=2.9.0,<3.0.0",
"pydantic-settings>=2.6.0,<3.0.0",
"python-dotenv>=1.0.1,<2.0.0",
"email-validator>=2.2.0,<3.0.0",
]
dependencies = [
"fastapi>=0.115.0,<1.0.0",
"uvicorn[standard]>=0.30.0,<1.0.0",
"sqlalchemy>=2.0.36,<3.0.0",
"alembic>=1.14.0,<2.0.0",
"psycopg[binary]>=3.2.0,<4.0.0",
"PyJWT>=2.9.0,<3.0.0",
"pydantic-settings>=2.6.0,<3.0.0",
"python-dotenv>=1.0.1,<2.0.0",
"email-validator>=2.2.0,<3.0.0",
"python-multipart>=0.0.20,<1.0.0",
]
[project.optional-dependencies]
dev = [

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)

View File

@@ -27,6 +27,7 @@ X-Financial 后端 OpenAPI 文档。
- 员工目录
- 报销单
- 知识库与 ONLYOFFICE
- OCR 票据识别
- 语义本体解析
- Orchestrator 统一调度
- 系统设置与模型连通性
@@ -59,6 +60,10 @@ OPENAPI_TAGS = [
"name": "knowledge",
"description": "知识库文件管理、内容访问与 ONLYOFFICE 集成接口。",
},
{
"name": "ocr",
"description": "票据图片与 PDF 的 OCR 识别接口,当前默认对接 PaddleOCR mobile 运行时。",
},
{
"name": "ontology",
"description": "Day 3 语义本体解析接口,把自然语言问题稳定转换为 8 个核心字段。",