safesight/docs/implementation/auto-config-plan.md
tian 007a996c37 docs: 规范化文档目录结构
- 根 docs/ 保留产品入口文档(README/部署手册/检查表/离线部署)
- 按内容归类到子目录:
  requirements/(需求) design/(设计/接口/方案/UI) architecture/(架构)
  implementation/(实施/计划/跟踪) bugfix/(缺陷记录) testing/(测试)
  guides/(操作指南:配置/模型/命令/依赖/调试) archive/(源码片段归档)
- 删除 superpowers 目录(edge 与 control 两处, 含历史设计草稿)
- 更新 docs/README.md 导航与新结构一致
2026-08-02 11:28:51 +08:00

51 lines
2.1 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# 管控台一键自动配置 实施计划
> 创建日期2026-05-12
> 目标:管控台勾选功能 + 分配视频源 → 自动生成配置并下发,零用户输入
## 实施步骤
| # | 内容 | 状态 |
|---|------|------|
| 1 | `FeatureRegistry` + 模板选择算法 + 测试 | ✅ |
| 2 | `template_composer.go` DAG 合并 + 测试 | ✅ |
| 3 | `auto_config.go` 完整流水线 + 测试 | ✅ |
| 4 | 改造 `actionConsoleSave`wire `AutoConfigService``main.go` | ✅ |
| 5 | 增强 `console.html` 表单交互 | ✅ |
| 6 | 集成测试(测试设备 10.0.0.81 端到端) | ✅ |
## 集成测试结果
| 检查项 | 结果 |
|--------|------|
| 模板选择 | `std_workshop_face_recognition_shoe_alarm` ✅ |
| 自动场景模板 | `auto_d12a4719c...` ✅ |
| 识别单元 | `cam1`, `cam2` (名称=视频源名) ✅ |
| RTSP 地址 | `rtsp://10.0.0.49:8554/cam` ✅ |
| HLS 路径 | `./web/hls/cam1/index.m3u8` ✅ |
| 配置下发 | 设备 config 已更新 ✅ |
| Media Server | 运行中,正在处理摄像头画面 ✅ |
| HLS 生成 | `index.m3u8` 已有 TS 片段 ✅ |
| HLS 代理 | `/ui/hls/.../index.m3u8` 正常返回 ✅ |
## 新增文件
- `internal/service/auto_config.go` — FeatureRegistry + AutoConfigService 流水线
- `internal/service/auto_config_test.go` — 模板选择算法测试
- `internal/service/template_composer.go` — 多模板 DAG 浅合并
- `internal/service/template_composer_test.go` — 合并逻辑测试
- `docs/auto-config-plan.md` — 本文档
## 修改文件
- `internal/web/ui.go` — UI struct 增加 autoConfig 字段 + actionConsoleSave 重写
- `internal/web/ui/templates/console.html` — 表单字段 + 视频源分配交互
- `cmd/managerd/main.go` — 创建并注入 AutoConfigService
## 核心原则
- **全自动派生**识别单元名称、通道号、HLS/RTSP 路径全部自动生成 = 视频源名
- **模板组合**:多功能 → 先查已有组合模板 → 没有则浅合并原子模板
- **中文名自动转安全名**`deriveSafeInstanceName` 将中文视频源名转为合法 ASCII 标识
- **暂不做 NPU 预警**