Files
operating-room-monitor-server/clients/demo-client/README.md
Kevin 1af442481e 重组为 backend/clients/docs 三层结构,并清理 git 污染。
将后端迁入 backend/,完善根目录 .gitignore,删除误提交的 .mypy_cache 缓存文件。

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-05-21 16:02:25 +08:00

1.4 KiB
Executable File

Demo Client

独立浏览器联调页,用于手动触发监控 API 的部分 /client/* 接口:开始/结束手术、查询结果等。语音待确认、TTS 与麦克风录音请使用同级的 ../voice-confirmation/ 或其它专用客户端。

结构

clients/demo-client/
  start.sh
  server.py
  index.html
  labels.yaml               # 耗材类名快照(与 backend/app/resources/consumable_classifier_labels.yaml 同步)
  fake_rtsp_from_file.py

labels.yaml:本目录自带副本,与后端解耦。后端类名变更时,请同步更新此文件。

运行

# 1) 启动 Docker 后端
cd backend && docker compose up -d --build

# 2) 在本目录启动 Demo 页
cd ../clients/demo-client && ./start.sh

# 3) 浏览器访问
open http://127.0.0.1:38081/

页面「服务端 Base URL」默认指向同主机 :38080;后端在其他机器时手动改为 http://<GPU服务器IP>:38080

调试:无真实摄像头,用录好的视频模拟 RTSP

python3 fake_rtsp_from_file.py /path/to/recording.mp4 --port 18554 --path demo

容器内 API 访问宿主机 RTSP 应使用 host.docker.internal。详见 ../../docs/video-backends.md

CORS

跨域访问 API 时,后端 backend/.envDEMO_CORS_ENABLED=true;生产环境收窄 DEMO_CORS_ORIGINS