Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

追加: エンジン情報取得 API にドキュメントを追加 #1223

Merged
merged 1 commit into from
May 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 5 additions & 3 deletions voicevox_engine/app/routers/engine_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,12 @@ def generate_engine_info_router(

@router.get("/version", tags=["その他"])
async def version() -> str:
"""エンジンのバージョンを取得します。"""
return __version__

@router.get("/core_versions", response_model=list[str], tags=["その他"])
async def core_versions() -> Response:
"""利用可能なコアのバージョン一覧を取得します。"""
return Response(
content=json.dumps(list(cores.keys())),
media_type="application/json",
Expand All @@ -33,9 +35,8 @@ async def core_versions() -> Response:
@router.get(
"/supported_devices", response_model=SupportedDevicesInfo, tags=["その他"]
)
def supported_devices(
core_version: str | None = None,
) -> Response:
def supported_devices(core_version: str | None = None) -> Response:
"""対応デバイスの一覧を取得します。"""
supported_devices = get_core(core_version).supported_devices
if supported_devices is None:
raise HTTPException(status_code=422, detail="非対応の機能です。")
Expand All @@ -46,6 +47,7 @@ def supported_devices(

@router.get("/engine_manifest", response_model=EngineManifest, tags=["その他"])
async def engine_manifest() -> EngineManifest:
"""エンジンマニフェストを取得します。"""
return engine_manifest_data

return router