Initial commit: FishServer monorepo (FishAction, FishMeasure, fish_api)

Made-with: Cursor
This commit is contained in:
zaiun xu
2026-04-08 19:32:23 +08:00
commit 9df21f80ef
180 changed files with 96298 additions and 0 deletions

View File

@@ -0,0 +1,55 @@
from __future__ import annotations
from fastapi import APIRouter
from app.state import app_state
router = APIRouter(prefix="/api/v1/biomass", tags=["biomass"])
@router.get("/real/camera/")
async def get_real_camera():
"""双目实时结果(轮询最新一次 FishMeasure 完成快照)。"""
m = app_state.last_measure
if m.error:
return {
"code": 500,
"msg": m.error,
"data": {
"result": [],
"video_left": "",
"video_right": "",
},
}
return {
"code": 200,
"msg": "成功",
"data": {
"result": m.result,
"video_left": m.video_left,
"video_right": m.video_right,
},
}
@router.get("/health/result/")
async def get_health_result():
"""行为 / 健康结果(轮询最新一次 FishAction 完成快照)。"""
h = app_state.last_health
if h.error:
return {
"code": 500,
"msg": h.error,
"data": {
"behavior_result": "",
"health_result": "",
},
}
return {
"code": 200,
"msg": "成功",
"data": {
"behavior_result": h.behavior_result,
"health_result": h.health_result,
},
}