You've already forked DataMate
Develop py update schema (#37)
* feature: implement endpoints with multi-level response models * refactor: move `/health` and `/config` endpoints to system module, remove example from base schemas * refactor: remove unused get_standard_response_model()
This commit is contained in:
36
runtime/datamate-python/app/module/system/interface/about.py
Normal file
36
runtime/datamate-python/app/module/system/interface/about.py
Normal file
@@ -0,0 +1,36 @@
|
||||
from fastapi import APIRouter
|
||||
from typing import Dict, Any
|
||||
from app.core.config import settings
|
||||
from app.module.shared.schema import StandardResponse
|
||||
|
||||
from ..schema import ConfigResponse, HealthResponse
|
||||
|
||||
router = APIRouter()
|
||||
|
||||
@router.get("/health", response_model=StandardResponse[HealthResponse])
|
||||
async def health_check():
|
||||
"""健康检查端点"""
|
||||
|
||||
return StandardResponse(
|
||||
code=200,
|
||||
message="success",
|
||||
data=HealthResponse(
|
||||
status="healthy",
|
||||
service="Label Studio Adapter",
|
||||
version=settings.app_version
|
||||
)
|
||||
)
|
||||
|
||||
@router.get("/config", response_model=StandardResponse[ConfigResponse])
|
||||
async def get_config():
|
||||
"""获取配置信息"""
|
||||
return StandardResponse(
|
||||
code=200,
|
||||
message="success",
|
||||
data=ConfigResponse(
|
||||
app_name=settings.app_name,
|
||||
version=settings.app_version,
|
||||
label_studio_url=settings.label_studio_base_url,
|
||||
debug=settings.debug
|
||||
)
|
||||
)
|
||||
Reference in New Issue
Block a user