modify: aibox_sophon_adapter
This commit is contained in:
@@ -0,0 +1,8 @@
|
||||
# board_ping — MQTT 心跳上报端点
|
||||
# 设备通过 MQTT 主题 /board_ping 上报系统状态信息
|
||||
# MQTT Bridge 自动路由到 chongming/aibox_sophon_adapter/board_ping
|
||||
|
||||
[MQTT]
|
||||
summary = "AI Box 设备心跳上报"
|
||||
docstring = "设备通过 MQTT 定期上报系统参数及状态信息,包含芯片温度、硬盘、内存、通道、任务、TPU 等"
|
||||
auth_required = false
|
||||
@@ -0,0 +1,16 @@
|
||||
[worker]
|
||||
name = "aibox_sophon_adapter"
|
||||
version = "0.1.0"
|
||||
description = "AI Box Sophon 设备适配器 — MQTT 心跳上报与设备状态监控"
|
||||
config_version = "1.0"
|
||||
defaults = { method = "GET", timeout = 30, auth_required = false, cacheable = false, internal = false }
|
||||
|
||||
[worker.registration]
|
||||
router_prefix = "/aibox"
|
||||
tags = ["aibox", "sophon", "adapter"]
|
||||
|
||||
# 心跳超时配置(秒),超过此时间未收到心跳视为离线
|
||||
[worker.heartbeat]
|
||||
interval = 5 # 设备上报间隔(秒)
|
||||
timeout = 15 # 超时阈值(秒),超过此时间未收到心跳视为离线
|
||||
check_interval = 10 # 服务端检查离线设备的间隔(秒)
|
||||
@@ -0,0 +1,13 @@
|
||||
# get_device — 查询单个设备详情
|
||||
|
||||
[GET]
|
||||
summary = "查询单个设备详情"
|
||||
docstring = "根据 BoardId 查询设备的完整心跳数据和在线状态"
|
||||
params = ["board_id: str"]
|
||||
auth_required = false
|
||||
|
||||
[GET.response_model]
|
||||
board_id = { type = "str", required = true }
|
||||
is_online = { type = "bool", required = true }
|
||||
last_ping_time = { type = "str", required = false }
|
||||
ping_data = { type = "dict", required = false }
|
||||
@@ -0,0 +1,11 @@
|
||||
# get_offline_devices — 查询离线/异常设备
|
||||
|
||||
[GET]
|
||||
summary = "查询离线/异常设备列表"
|
||||
docstring = "返回所有超过心跳超时时间未上报的设备列表"
|
||||
params = []
|
||||
auth_required = false
|
||||
|
||||
[GET.response_model]
|
||||
offline_devices = { type = "list[dict]", required = true }
|
||||
total = { type = "int", required = true }
|
||||
@@ -0,0 +1,11 @@
|
||||
# list_devices — 查询所有设备状态
|
||||
|
||||
[GET]
|
||||
summary = "查询所有设备状态"
|
||||
docstring = "返回所有已上报过心跳的设备及其在线状态和最后心跳时间"
|
||||
params = []
|
||||
auth_required = false
|
||||
|
||||
[GET.response_model]
|
||||
devices = { type = "list[dict]", required = true }
|
||||
total = { type = "int", required = true }
|
||||
+20
-3
@@ -18,9 +18,15 @@ count = 3
|
||||
|
||||
[workers.config]
|
||||
type = "doubao"
|
||||
api_key = " ark-b149df84-a057-4ca0-b1a0-82a22c4e3c70-33cde" # 或通过环境变量 VOLC_ACCESSKEY 提供
|
||||
base_url = "https://ark.cn-beijing.volces.com/api/v3"
|
||||
model = "doubao-seed-evolving"
|
||||
is_aicc = true # 是否启用 AICC 安全通信模式(端云互信)
|
||||
# api_key = "ark-b149df84-a057-4ca0-b1a0-82a22c4e3c70-33cde"
|
||||
# base_url = "https://ark.cn-beijing.volces.com/api/v3"
|
||||
# model = "doubao-seed-evolving"
|
||||
|
||||
# AICC 模式下 base_url 使用 APIGateway 地址,如:
|
||||
api_key = "db04d42e-71e3-4119-abee-12ecc7ef5c34"
|
||||
base_url = "https://sd77a0f4ummt3i4vnems0.apigateway-cn-beijing.volceapi.com/api/v3"
|
||||
model = "ep-20260721154333-fre3bey"
|
||||
|
||||
[[workers]]
|
||||
type = "auth"
|
||||
@@ -31,3 +37,14 @@ count = 3
|
||||
|
||||
[workers.config]
|
||||
type = "auth"
|
||||
|
||||
[[workers]]
|
||||
type = "aibox_sophon_adapter"
|
||||
module = "plugins.aibox_sophon_adapter"
|
||||
factory = "create_workers"
|
||||
cleanup = "cleanup"
|
||||
count = 1
|
||||
|
||||
[workers.config]
|
||||
type = "aibox_sophon_adapter"
|
||||
data_dir = "./data"
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
[POST]
|
||||
summary = "分析图片内容"
|
||||
docstring = "发送图片(base64或路径)到豆包视觉模型,返回描述"
|
||||
auth_required = false
|
||||
params = [
|
||||
"image_base64: str",
|
||||
"prompt: str"
|
||||
|
||||
@@ -8,3 +8,6 @@ defaults = { method = "POST", timeout = 30.0, auth_required = false }
|
||||
[worker.registration]
|
||||
router_prefix = "/doubao"
|
||||
tags = ["vision", "ai"]
|
||||
|
||||
# is_aicc = true 时启用 AICC 安全通信(端云互信),使用 AsyncOpenAI + AsyncSecureHttpClient
|
||||
# is_aicc = false 时使用标准 Ark SDK(AsyncArk),默认 false
|
||||
|
||||
@@ -24,3 +24,10 @@ auth_required = true
|
||||
result = { type = "float", required = true }
|
||||
operation = { type = "str", default = "add" }
|
||||
timestamp = { type = "float", required = false, default = 0.0 }
|
||||
|
||||
# --- MQTT 端点(不注册 HTTP 路由,仅通过 MQTT chongming/example/add 调用)---
|
||||
[MQTT]
|
||||
summary = "Add two numbers via MQTT"
|
||||
docstring = "通过 MQTT 主题 chongming/example/add 调用,载荷为 JSON"
|
||||
params = ["a: float", "b: float"]
|
||||
auth_required = false
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
# heartbeat 接口 — MQTT 心跳上报,无响应
|
||||
|
||||
[MQTT]
|
||||
summary = "Heartbeat ping (no response)"
|
||||
docstring = "通过 MQTT 主题 chongming/example/heartbeat 上报心跳,不返回响应"
|
||||
params = ["worker_id: str"]
|
||||
auth_required = false
|
||||
Reference in New Issue
Block a user