|
|
|
@@ -297,6 +297,38 @@ async def get_ble_ai_metadata(floor: Optional[int] = Query(default=None)): |
|
|
|
return {"items": items, "count": len(items)} |
|
|
|
|
|
|
|
|
|
|
|
@app.get("/ble-ai/maps", tags=["BLE-AI"], dependencies=[Depends(get_current_user)]) |
|
|
|
async def get_ble_ai_maps(): |
|
|
|
maps_dir = config_env.BLE_AI_MAPS_DIR |
|
|
|
if not os.path.isdir(maps_dir): |
|
|
|
raise HTTPException(status_code=404, detail="Maps directory not found") |
|
|
|
|
|
|
|
items = [] |
|
|
|
for file_name in sorted(os.listdir(maps_dir), key=str.lower): |
|
|
|
if not file_name.lower().endswith(".png"): |
|
|
|
continue |
|
|
|
|
|
|
|
file_path = os.path.join(maps_dir, file_name) |
|
|
|
if not os.path.isfile(file_path): |
|
|
|
continue |
|
|
|
|
|
|
|
with open(file_path, "rb") as f: |
|
|
|
encoded = base64.b64encode(f.read()).decode("ascii") |
|
|
|
|
|
|
|
items.append( |
|
|
|
{ |
|
|
|
"name": file_name, |
|
|
|
"mime_type": "image/png", |
|
|
|
"content_base64": encoded, |
|
|
|
} |
|
|
|
) |
|
|
|
|
|
|
|
if not items: |
|
|
|
raise HTTPException(status_code=404, detail="No PNG maps found") |
|
|
|
|
|
|
|
return {"items": items, "count": len(items)} |
|
|
|
|
|
|
|
|
|
|
|
@app.get("/openapi.json/", tags=["Documentation"]) |
|
|
|
async def get_open_api_endpoint(): |
|
|
|
#async def get_open_api_endpoint(current_user: User = Depends(get_current_active_user)): |
|
|
|
|