31 lines
1.2 KiB
Python
31 lines
1.2 KiB
Python
|
|
from fastapi import APIRouter, Depends, Query
|
||
|
|
from sqlalchemy.orm import Session
|
||
|
|
|
||
|
|
from app.core.response import ApiResponse, ok
|
||
|
|
from app.core.user_context import UserContext, get_user_context
|
||
|
|
from app.db.session import get_db
|
||
|
|
from app.schemas.training_config import TrainingConfigOptionsResponse, TrainingConfigRecommendedResponse
|
||
|
|
from app.services.training_config_service import TrainingConfigService
|
||
|
|
|
||
|
|
router = APIRouter()
|
||
|
|
|
||
|
|
|
||
|
|
@router.get("/recommended", response_model=ApiResponse[TrainingConfigRecommendedResponse])
|
||
|
|
def get_recommended_training_config(
|
||
|
|
case_id: int = Query(..., ge=1),
|
||
|
|
_: UserContext = Depends(get_user_context),
|
||
|
|
db: Session = Depends(get_db),
|
||
|
|
):
|
||
|
|
"""推荐配置信息:返回训练页默认病人初始化配置。"""
|
||
|
|
return ok(TrainingConfigService(db).get_recommended(case_id))
|
||
|
|
|
||
|
|
|
||
|
|
@router.get("/options", response_model=ApiResponse[TrainingConfigOptionsResponse])
|
||
|
|
def get_training_config_options(
|
||
|
|
case_id: int = Query(..., ge=1),
|
||
|
|
_: UserContext = Depends(get_user_context),
|
||
|
|
db: Session = Depends(get_db),
|
||
|
|
):
|
||
|
|
"""训练配置信息:返回训练页自定义病人初始化配置选项。"""
|
||
|
|
return ok(TrainingConfigService(db).get_options(case_id))
|