feat(api): GET /api/models/recipes proxy to Open3DModel
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
430e342c48
commit
5d9166ed77
2 files changed
+28
No files matched your search
@@ -0,0 +1,26 @@
|
|||||||
|
"""Proxy minimale verso Open3DModel — evita di esporre l'api_key al browser.
|
||||||
|
|
||||||
|
Per ora un solo endpoint: GET /api/models/recipes -> lista ricette caricate
|
||||||
|
in Open3DModel.
|
||||||
|
"""
|
||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
|
from typing import Any
|
||||||
|
|
||||||
|
from fastapi import APIRouter, HTTPException
|
||||||
|
|
||||||
|
from ..clients import Open3DModelError, Open3DModelUnavailable
|
||||||
|
from . import _deps
|
||||||
|
|
||||||
|
router = APIRouter()
|
||||||
|
|
||||||
|
|
||||||
|
@router.get("/recipes")
|
||||||
|
def list_recipes() -> dict[str, Any]:
|
||||||
|
try:
|
||||||
|
recs = _deps.open3dmodel().list_recipes()
|
||||||
|
except Open3DModelUnavailable as e:
|
||||||
|
raise HTTPException(status_code=502, detail=f"Open3DModel unreachable: {e}")
|
||||||
|
except Open3DModelError as e:
|
||||||
|
raise HTTPException(status_code=502, detail=f"Open3DModel error: {e.code}: {e.message}")
|
||||||
|
return {"recipes": recs}
|
||||||
@@ -15,6 +15,7 @@ from .api import (
|
|||||||
config_routes,
|
config_routes,
|
||||||
grasp_routes,
|
grasp_routes,
|
||||||
home_routes,
|
home_routes,
|
||||||
|
models_routes,
|
||||||
perception_routes,
|
perception_routes,
|
||||||
posture_routes,
|
posture_routes,
|
||||||
robot_routes,
|
robot_routes,
|
||||||
@@ -40,6 +41,7 @@ app.include_router(agent_routes.router, prefix="/api/agent", tags=["agent"])
|
|||||||
app.include_router(calibration_routes.router, prefix="/api/calibration", tags=["calibration"])
|
app.include_router(calibration_routes.router, prefix="/api/calibration", tags=["calibration"])
|
||||||
app.include_router(perception_routes.router, prefix="/api/perception", tags=["perception"])
|
app.include_router(perception_routes.router, prefix="/api/perception", tags=["perception"])
|
||||||
app.include_router(grasp_routes.router, prefix="/api/grasp", tags=["grasp"])
|
app.include_router(grasp_routes.router, prefix="/api/grasp", tags=["grasp"])
|
||||||
|
app.include_router(models_routes.router, prefix="/api/models", tags=["models"])
|
||||||
app.include_router(wrist_routes.router, prefix="/api/wrist", tags=["wrist"])
|
app.include_router(wrist_routes.router, prefix="/api/wrist", tags=["wrist"])
|
||||||
app.include_router(posture_routes.router, prefix="/api/posture", tags=["posture"])
|
app.include_router(posture_routes.router, prefix="/api/posture", tags=["posture"])
|
||||||
app.include_router(robot_routes.router, prefix="/api/robot", tags=["robot"])
|
app.include_router(robot_routes.router, prefix="/api/robot", tags=["robot"])
|
||||||
|
|||||||
Reference in new issue
Block a user