2026-05-21 15:56:53 +08:00
|
|
|
# Demo Client
|
|
|
|
|
|
|
|
|
|
独立浏览器联调页,用于手动触发监控 API 的部分 `/client/*` 接口:开始/结束手术、查询结果等。语音待确认、TTS 与麦克风录音请使用同级的 [`../voice-confirmation/`](../voice-confirmation/) 或其它专用客户端。
|
|
|
|
|
|
|
|
|
|
## 结构
|
|
|
|
|
|
|
|
|
|
```
|
|
|
|
|
clients/demo-client/
|
2026-05-21 16:02:25 +08:00
|
|
|
start.sh
|
|
|
|
|
server.py
|
|
|
|
|
index.html
|
|
|
|
|
labels.yaml # 耗材类名快照(与 backend/app/resources/consumable_classifier_labels.yaml 同步)
|
|
|
|
|
fake_rtsp_from_file.py
|
2026-05-21 15:56:53 +08:00
|
|
|
```
|
|
|
|
|
|
|
|
|
|
**`labels.yaml`**:本目录自带副本,与后端解耦。后端类名变更时,请同步更新此文件。
|
|
|
|
|
|
|
|
|
|
## 运行
|
|
|
|
|
|
|
|
|
|
```bash
|
2026-05-21 16:02:25 +08:00
|
|
|
# 1) 启动 Docker 后端
|
|
|
|
|
cd backend && docker compose up -d --build
|
2026-05-21 15:56:53 +08:00
|
|
|
|
|
|
|
|
# 2) 在本目录启动 Demo 页
|
2026-05-21 16:02:25 +08:00
|
|
|
cd ../clients/demo-client && ./start.sh
|
2026-05-21 15:56:53 +08:00
|
|
|
|
|
|
|
|
# 3) 浏览器访问
|
|
|
|
|
open http://127.0.0.1:38081/
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
页面「服务端 Base URL」默认指向同主机 `:38080`;后端在其他机器时手动改为 `http://<GPU服务器IP>:38080`。
|
|
|
|
|
|
|
|
|
|
## 调试:无真实摄像头,用录好的视频模拟 RTSP
|
|
|
|
|
|
|
|
|
|
```bash
|
|
|
|
|
python3 fake_rtsp_from_file.py /path/to/recording.mp4 --port 18554 --path demo
|
|
|
|
|
```
|
|
|
|
|
|
2026-05-21 16:02:25 +08:00
|
|
|
容器内 API 访问宿主机 RTSP 应使用 `host.docker.internal`。详见 [`../../docs/video-backends.md`](../../docs/video-backends.md)。
|
2026-05-21 15:56:53 +08:00
|
|
|
|
|
|
|
|
## CORS
|
|
|
|
|
|
2026-05-21 16:02:25 +08:00
|
|
|
跨域访问 API 时,后端 `backend/.env` 需 `DEMO_CORS_ENABLED=true`;生产环境收窄 `DEMO_CORS_ORIGINS`。
|