This commit is contained in:
2026-09-04 14:51:35 +08:00
parent 54d840563b
commit 8d9c688991
9 changed files with 75 additions and 65 deletions
+7
View File
@@ -39,6 +39,10 @@ data_dir = "./data"
mediamtx_addr = "rtsp://127.0.0.1/channel" # MediaMTX 地址
link_path = "/data/bm-app" # 软链接路径
[workers.config.database]
type = "postgresql"
url = "postgresql+asyncpg://postgres:postgres@localhost:5432/aibox_sophon_adapter"
[workers.config.heartbeat]
interval = 5 # 设备上报间隔(秒)
timeout = 15 # 超时阈值(秒),超过此时间未收到心跳视为离线
@@ -103,6 +107,9 @@ max_records = 100 # 最多保留的告警记录数,设为 0 表示不限制
[workers.config.doubao_analysis]
enabled = false # 是否启用豆包 AI 分析告警图片
[workers.config.ip_sound_column]
enabled = false # 是否开启IP音柱报警
[workers.config.alarm_forward]
# enabled = false # 是否启用告警转发到外部平台
enabled = true # 是否启用告警转发到外部平台
+23
View File
@@ -0,0 +1,23 @@
# ip_sound_column Worker 插件配置
[worker]
[worker.defaults]
cacheable = false
timeout = 30
[worker.registration]
router_prefix = "/ip_sound_column"
# Worker 注册(app lifespan 据此发现并加载插件)
[workers]
cleanup = "cleanup"
count = 1
factory = "create_workers"
module = "plugins.ip_sound_column"
type = "ip_sound_column"
# 运行时配置(展平后传给 create_workers 的 config 参数)
[workers.config]
data_dir = "./data"
ip = "172.19.11.244"
volume = 50
+22
View File
@@ -0,0 +1,22 @@
# ip_sound_column.tts — ip 音柱 tts 播放
# 修改后需重新运行: uv run gen_models config/workers/ip_sound_column src/plugins/ip_sound_column
[POST]
cacheable = true
summary = "ip 音柱 tts 播放"
params = [
"command: str", # 播放命令 play_local_tts
"volume: int", # 播放音量 0-100
"play_count: int", # 播放次数
"queue: bool", # 是否排队播放
"sync_response: bool", # 是否同步响应
"play_interval: int", # 播放间隔,单位秒
"tts_pitch: int", # 播放音调,范围 0 ~ 100
"tts_speed: int", # 播放速度,范围 0 ~ 100
"tts_voice_name: string", # 播放声音名称
"tts_text: string", # 播放文本
]
internal = true
[POST.response_model]
command = { type = "str", required = true }
result = { type = "int", required = true }
-25
View File
@@ -1,25 +0,0 @@
# ====== 插件注册信息(Rust 参考插件 rsdemo) ======
# 与 Python SDK 共用同一套 TOML 端点定义格式(docs/plugin-wire-protocol.md §2),
# 由 chongming-worker-rs 解析并发布路由描述符。
[workers]
type = "rsdemo"
module = "rsdemo" # Rust 插件无 Python 模块概念,字段保留用于记录
factory = "create_workers"
cleanup = "cleanup"
count = 2
load_mode = "external" # 独立进程运行,经 Zenoh 注册路由
[worker]
name = "rsdemo"
version = "0.1.0"
description = "进程插件 Rust 参考实现(多语言演进规划阶段 1)"
config_version = "1.0"
defaults = { method = "GET", timeout = 30.0, auth_required = false, cacheable = false, internal = false }
[worker.registration]
router_prefix = "/rsdemo"
tags = ["rsdemo", "process-plugin", "rust"]
# ====== Worker 运行时配置(由 Rust SDK 展平后传给 handler) ======
[workers.config]
greeting_prefix = "Hello"
-11
View File
@@ -1,11 +0,0 @@
# rsdemo.echo —— POST 端点,演示 user_info 信封透传
[POST]
summary = "Rust 参考插件:回声(透传网关认证用户信息)"
params = ["msg: str"]
auth_required = true
[POST.response_model]
echo = { type = "str", required = true }
user_info = { type = "any", required = false }
worker_id = { type = "str", required = false, default = "" }
timestamp = { type = "float", required = true }
-5
View File
@@ -1,5 +0,0 @@
# rsdemo.error —— 恒抛业务异常,演示非流式错误回复格式
# ({"result":0.0,"operation":"error","error":...,"worker":...})
[GET]
summary = "Rust 参考插件:模拟业务异常"
auth_required = false
-10
View File
@@ -1,10 +0,0 @@
# rsdemo.hello —— 普通 GET 端点(对位 Python demo.hello)
[GET]
summary = "Rust 参考插件:问候"
params = ["name: str"]
auth_required = false
[GET.response_model]
greeting = { type = "str", required = true }
worker_id = { type = "str", required = false, default = "" }
timestamp = { type = "float", required = true }
-13
View File
@@ -1,13 +0,0 @@
# rsdemo.stream —— 流式端点(SSE,逐块多回复)
[POST]
summary = "Rust 参考插件:模拟 AI 流式输出(SSE,逐 token)"
docstring = "流式端点:Rust handler 返回流,逐块多回复推送,网关以 text/event-stream 转发。tokens > 50 时第 26 块抛错,演示 {\"error\": ...} 收尾块。"
auth_required = false
stream = true
# 流式超时模型: timeout = 流总寿命上限(zenoh query deadline)
timeout = 300.0
stream_idle_timeout = 10.0
params = [
"prompt: str",
"tokens: int"
]
+22
View File
@@ -1,15 +1,37 @@
{
// Zenoh 会话配置 —— 由 config.toml 的 [zenoh].json5_path 指定(见 src/chongming/app/core/lifespan_setup.py)
// 这是项目的zenoh 客户端会话配置,决定应用如何加入 zenoh 网络。
// 注意:此文件是应用侧(peer/client)配置,不是独立 router 的配置文件。
// mode —— 本节点的运行模式:
// "peer" : 既可作为客户端连接,也能参与对等组网(本项目默认,多进程间直连)
// "client" : 纯客户端,只连接 router,不自建对等网络
// "router" : 路由节点(仅独立 zenohd 使用,本项目不会以 router 身份启动)
// 本项目用 peer 即可;若已部署独立 Zenoh Router(如 deploy/docker-compose.yml 的 zenoh 服务),
// 也可保持 peer 通过下方 connect.endpoints 连接到 router。
mode: "peer",
connect: {
// connect.endpoints —— 本节点要主动连接的远端对等端/router 地址列表。
// 当前填 127.0.0.1:7447 指向本机(TCP 自连接模式,未接独立 router 时连到其他 peer)。
// 接入 docker 部署的 Zenoh Router 后:
// - 同机部署:保持 tcp/127.0.0.1:7447 即可(router 容器已把 7447 映射到宿主)
// - 跨机部署:改为 router 机器地址,如 "tcp/192.168.x.x:7447"
endpoints: ["tcp/127.0.0.1:7447"],
},
scouting: {
multicast: {
// 多播发现开关。关闭后不通过局域网 224.0.0.224:7446 自动发现对等端,
// 仅通过 connect.endpoints 显式连接。多实例/多机器下建议保持 false 避免互相发现串扰。
enabled: false,
},
},
transport: {
shared_memory: {
// 共享内存传输开关。开启后同机进程间通过共享内存零拷贝交换,性能更好。
// 若应用与 router 跨容器/跨机器部署,共享内存不可用,需改为 false(退化为 TCP 传输)。
enabled: true,
},
},