modify: 统一插件风格

This commit is contained in:
2026-08-14 16:04:39 +08:00
parent 56dd4f0ebb
commit 4fa066432d
10 changed files with 516 additions and 436 deletions
+7 -5
View File
@@ -87,10 +87,12 @@ sequenceDiagram
```text
src/plugins/aibox_sophon_adapter/
├── __init__.py # 插件入口:create_workers() 工厂 + cleanup()
│ # - 初始化 DB / StreamManager / 各 MQTT 客户端
│ # - _build_subscribe_routes() 构建订阅路由
│ # - 启动离线检查后台任务
├── __init__.py # 插件入口:AiboxSophonAdapterPlugin(Plugin 基类)
│ # - on_init: DB / StreamManager / MQTT 客户端 / 全局变量 / 后台任务
│ # - on_cleanup: 流控制器与 MQTT 客户端关闭(db/后台任务由基类处理)
├── mqtt_clients.py # MQTT 客户端能力组件(从 __init__ 抽取,统一"启动失败降级为 None"模式)
│ # - start_mqtt_forward / start_mqtt_subscribe / start_internal_mqtt
│ # - build_subscribe_routes() 构建订阅路由
├── global_var.py # 模块级全局变量(db / stream_manager / mqtt_* / 各配置)
├── routes.py # 自定义 FastAPI 路由(video_upload / video / alarm_report)
├── edge_app_controller.py # 外部 MQTT 请求-响应处理器(command 注册表分发)
@@ -356,7 +358,7 @@ tags = ["aibox_sophon_adapter", "sophon", "adapter"]
### 修改配置
编辑 `config/workers/aibox_sophon_adapter/config.toml` 后重启服务即可生效,无需重新生成模型
(运行时配置均在 `create_workers` 中读取)。
(运行时配置均在 `AiboxSophonAdapterPlugin.on_init` 中读取;MQTT 客户端启动逻辑见 `mqtt_clients.py`)。
---