重组为 backend/clients/docs 三层结构,并清理 git 污染。

将后端迁入 backend/,完善根目录 .gitignore,删除误提交的 .mypy_cache 缓存文件。

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Kevin
2026-05-21 16:02:25 +08:00
parent 6bc6801df9
commit 1af442481e
142 changed files with 175 additions and 212 deletions

88
.gitignore vendored
View File

@@ -1,37 +1,77 @@
# Python-generated files # =============================================================================
__pycache__/ # Operation Room Monitor — root .gitignore
*.py[oc] # =============================================================================
build/
dist/
wheels/
*.egg-info
# Virtual environments # --- OS ---
.venv .DS_Store
.AppleDouble
.LSOverride
Thumbs.db
ehthumbs.db
Desktop.ini
# --- IDE / editors ---
.idea/
.vscode/
*.swp
*.swo
*~
.project
.classpath
.settings/
# Runtime consumption TSV (开发联调) # --- Environment & secrets (all layers) ---
logs/
# Environment
.env .env
.env.* .env.*
!.env.example !.env.example
!**/.env.example
backend/.env
backend/.env.*
!backend/.env.example
# Demo 一键联调写入的 RTSP 映射(可被覆盖) # --- Python caches (never commit) ---
.mypy_cache/
**/.mypy_cache/
**/__pycache__/
**/*.py[cod]
**/*$py.class
**/.pytest_cache/
**/.mypy_cache/
**/.ruff_cache/
**/.pycache-verify/
**/build/
**/wheels/
**/*.egg-info/
**/.coverage
**/htmlcov/
**/.tox/
**/.nox/
**/dist/
!clients/voice-confirmation/scripts/
# Backend runtime & caches
backend/logs/
backend/Ultralytics/
# Large model weights (deploy via mount or offline delivery)
backend/app/resources/actionformer_epoch_045.pth.tar
# --- Clients ---
clients/demo-client/.runtime/ clients/demo-client/.runtime/
clients/demo-client/labels.json clients/demo-client/labels.json
clients/voice-confirmation/dist/ clients/voice-confirmation/dist/
# IDE / OS # --- Docker ---
.idea/ **/.docker/
.vscode/
.DS_Store
# Ultralytics / YOLO: local cache and user settings (keep on machine only) # --- Logs & temp ---
*.log
*.tmp
*.temp
.cache/
# --- Legacy / local-only at repo root (pre-restructure) ---
.venv/
logs/
Ultralytics/ Ultralytics/
scripts/
#
# 5-6 ActionFormer checkpoint>100MB部署时挂载或离线下发不入库
app/resources/actionformer_epoch_045.pth.tar

View File

@@ -0,0 +1,41 @@
# Operation Room Monitor
手术室耗材监控:后端 APIGPU 推理)+ 独立浏览器客户端。
## 目录结构
```
.
├── backend/ # FastAPI + PostgreSQL + MinIO
│ ├── app/ # 业务与算法
│ ├── docker-compose.yml
│ ├── Dockerfile
│ ├── .env.example
│ └── ...
├── clients/ # 独立前端(手动部署)
│ ├── demo-client/ # 联调 Demo 页 (:38081)
│ └── voice-confirmation/ # 语音确认页 (:8080)
└── docs/ # 部署与接口文档
```
## 快速开始
```bash
# 1. 配置并启动后端(在 backend/ 目录)
cp backend/.env.example backend/.env # 编辑配置
cd backend && docker compose up -d --build
# 2. 启动客户端(各开终端)
cd clients/demo-client && ./start.sh
cd clients/voice-confirmation && ./start.sh
```
- API`http://<服务器IP>:38080`
- Demo`http://<服务器IP>:38081`
- 语音确认:`http://<服务器IP>:8080`
## 文档
- [Docker 部署](docs/Docker部署.md)
- [客户端接口说明](docs/客户端手术通信接口说明.md)
- [语音确认页使用指南](docs/部署版使用指南.md)

View File

@@ -1,4 +1,4 @@
# 复制为 `.env` 并按环境填写。后端通过 Docker Compose 部署`docker compose up -d --build` # 复制为 `backend/.env` 并按环境填写。在 `backend/` 目录执行`docker compose up -d --build`
# 详细说明见 docs/Docker部署.md 与 docs/video-backends.md。 # 详细说明见 docs/Docker部署.md 与 docs/video-backends.md。
# 算法、管线、归档路径、视觉/语音日志等非部署项见 `app/baked/algorithm.py` 与 `app/baked/pipeline.py`。 # 算法、管线、归档路径、视觉/语音日志等非部署项见 `app/baked/algorithm.py` 与 `app/baked/pipeline.py`。
# #

View File

@@ -193,7 +193,7 @@ class Settings(BaseSettings):
default="vision", default="vision",
validation_alias=AliasChoices("VIDEO_RESULT_DOCTOR_ID", "video_result_doctor_id"), validation_alias=AliasChoices("VIDEO_RESULT_DOCTOR_ID", "video_result_doctor_id"),
) )
#: 算法引用包目录(相对仓库根,如 ``refs/5.15``);可用环境变量 ``REFERENCE_BUNDLE_RELATIVE`` 覆盖。 #: 算法引用包目录(相对 backend 根目录,如 ``refs/5.15``);可用环境变量 ``REFERENCE_BUNDLE_RELATIVE`` 覆盖。
reference_bundle_relative: str = Field( reference_bundle_relative: str = Field(
default="refs/5.15", default="refs/5.15",
validation_alias=AliasChoices("REFERENCE_BUNDLE_RELATIVE", "reference_bundle_relative"), validation_alias=AliasChoices("REFERENCE_BUNDLE_RELATIVE", "reference_bundle_relative"),

View File

@@ -1,6 +1,6 @@
# Unified backend stack: FastAPI + PostgreSQL + MinIO (GPU via NVIDIA Container Toolkit). # Unified backend stack: FastAPI + PostgreSQL + MinIO (GPU via NVIDIA Container Toolkit).
# Deploy: docker compose up -d --build # Deploy from this directory: docker compose up -d --build
# Client pages: clients/demo-client/start.sh, clients/voice-confirmation/start.sh # Client pages (repo root): ../clients/demo-client/start.sh, ../clients/voice-confirmation/start.sh
services: services:
db: db:
image: m.daocloud.io/docker.io/library/postgres:16-alpine image: m.daocloud.io/docker.io/library/postgres:16-alpine

View File

Before

Width:  |  Height:  |  Size: 451 KiB

After

Width:  |  Height:  |  Size: 451 KiB

View File

Before

Width:  |  Height:  |  Size: 91 KiB

After

Width:  |  Height:  |  Size: 91 KiB

View File

Before

Width:  |  Height:  |  Size: 130 KiB

After

Width:  |  Height:  |  Size: 130 KiB

Some files were not shown because too many files have changed in this diff Show More