2026-11-16 16:35:22 +08:00
/ * *
* 文件说明 : 定义流程设计器可用的节点 、 表单字段及下拉选项等静态配置 。
* 作用范围 : 仅服务于流程设计器模块 。
* /
import cameraSvg from './icon/camera.svg'
import videoSvg from './icon/video.svg'
import loopSvg from './icon/loop.svg'
import stopLoopSvg from './icon/stopLoop.svg'
import switchSvg from './icon/switch.svg'
import microphoneSvg from './icon/microphone.svg'
import sleepSvg from './icon/sleep.svg'
import planSvg from './icon/plan.svg'
import dialogueSvg from './icon/dialogue.svg'
import audioSvg from './icon/audio.svg'
import touchSvg from './icon/touch.svg'
import expressionSvg from './icon/expression.svg'
import { DEFAULT _CHAT _SYSTEM _PROMPT } from './chatPrompt.js'
const pointOutputChildren = ( ) => [
{ name : 'x' , type : 'number' , desc : 'X坐标' } ,
{ name : 'y' , type : 'number' , desc : 'Y坐标' } ,
{ name : 'z' , type : 'number' , desc : 'Z坐标' } ,
]
const poseOutputChildren = ( ) => [
... pointOutputChildren ( ) ,
{ name : 'rx' , type : 'number' , desc : 'RX旋转( 弧度) ' } ,
{ name : 'ry' , type : 'number' , desc : 'RY旋转( 弧度) ' } ,
{ name : 'rz' , type : 'number' , desc : 'RZ旋转( 弧度) ' } ,
]
/ * *
* 处理与 http method options 相关的状态或数据 , 该影响范围仅限当前模块 。
* /
const httpMethodOptions = ( ) => {
return [ {
value : 'POST' ,
label : 'POST'
} , {
value : 'GET' ,
label : 'GET'
} , {
value : 'PUT' ,
label : 'PUT'
} , {
value : 'DELETE' ,
label : 'DELETE'
} ]
}
/ * *
* 处理与 express options 相关的状态或数据 , 该影响范围仅限当前模块 。
* /
2026-11-25 10:07:09 +08:00
const headParam = ( name , input = '' , desc = '' ) => ( {
name , type : 'input' , input , desc , disabled : true ,
} )
const headNumber = ( name , desc = '' ) => ( {
... headParam ( name , undefined , desc ) , input : undefined , componentType : 'number' , step : 0.01 , stepStrictly : false ,
} )
const headDuration = ( ) => ( {
... headNumber ( 'transitionDurationS' , '秒' ) , input : 0.5 , min : 0.2 , max : 5 ,
} )
const headOutput = ( [ name , type , desc ] ) => ( { name , type , desc , disabled : true } )
const headJointNodes = [
{ name : '查询头部关节状态' , action : 'BIO_HEAD_JOINT_GET_STATE' , desc : '读取关节配置、最近确认的目标和预设表情' , nodeParams : [ ] ,
outputParams : [ [ "connected" , "boolean" , "串口连接状态" ] , [ "jointInfo" , "array<object>" , "关节配置与限位" ] , [ "targets" , "array<object>" , "最近获确认的命令目标" ] , [ "lastCommandOutcome" , "string" , "最近命令结果" ] , [ "lastError" , "string" , "最近错误" ] , [ "positionFeedbackAvailable" , "boolean" , "是否提供真实位置反馈" ] , [ "expressions" , "array<object>" , "配置中的预设表情" ] , [ "expressionBaselineReady" , "boolean" , "表情过渡基准是否就绪" ] , [ "hardwareEmergencyStopAvailable" , "boolean" , "是否有硬件急停" ] ] . map ( headOutput ) } ,
{ name : '头部关节运动' , action : 'BIO_HEAD_JOINT_MOVE' , desc : '向指定关节下发弧度目标,确认不代表机械到位' , nodeParams : [ headParam ( 'targets' , '' , 'JSON 数组,例如 [{"id":"关节ID","positionRad":0}]' ) ] } ,
{ name : '头部关节回零' , action : 'BIO_HEAD_JOINT_HOME' , desc : '移动到设备配置的 home 位置' , nodeParams : [ ] } ,
{ name : '重连头部设备' , action : 'BIO_HEAD_JOINT_RECONNECT' , desc : '重开连接并探测设备,不下发位置目标' , nodeParams : [ ] } ,
{ name : '设置头部运动模式' , action : 'BIO_HEAD_JOINT_MODE' , desc : '选择立即、S 曲线或跟随' , nodeParams : [ { ... headParam ( 'mode' , 0 ) , componentType : 'select' , selectOptions : [ { label : '立即' , value : 0 } , { label : 'S 曲线' , value : 1 } , { label : '跟随' , value : 2 } ] } ] } ,
{ name : '设置头部关节约束' , action : 'BIO_HEAD_JOINT_CONSTRAINTS' , desc : '设置关节最大速度、加速度与加加速度' , nodeParams : [ headParam ( 'id' ) , headNumber ( 'maxVelocityRadS' , 'rad/s' ) , headNumber ( 'maxAccelerationRadS2' , 'rad/s²' ) , headNumber ( 'maxJerkRadS3' , 'rad/s³' ) ] } ,
{ name : '设置头部位置增益' , action : 'BIO_HEAD_JOINT_POSITION_GAIN' , desc : '设置指定关节的增益, 0 是有效值' , nodeParams : [ headParam ( 'id' ) , headParam ( 'gain' , '' , '输入增益, 0 是有效值' ) ] } ,
{ name : '设置头部更新周期' , action : 'BIO_HEAD_JOINT_UPDATE_PERIOD' , desc : '设置设备更新周期,单位毫秒' , nodeParams : [ { ... headNumber ( 'periodMs' , 'ms' ) , step : 1 , min : 1 , max : 4294967295 } ] } ,
{ name : '设置头部关节表情' , action : 'BIO_HEAD_JOINT_SET_EXPRESSION' , desc : '过渡到完整的五关节目标' , nodeParams : [ headParam ( 'targets' , '' , '五个不同关节组成的 JSON 数组,包含 id 和 positionRad' ) , headDuration ( ) ] } ,
{ name : '播放头部预设表情' , action : 'BIO_HEAD_JOINT_PLAY_EXPRESSION' , desc : '精确使用预设 ID 或名称,两者只填一个' , nodeParams : [ { ... headParam ( 'expressionId' , '' , 'ID 与名称只填一个' ) , required : false } , { ... headParam ( 'expressionName' , '' , 'ID 与名称只填一个' ) , required : false } , headDuration ( ) ] ,
outputParams : [ [ 'expressionId' , 'string' , '预设 ID' ] , [ 'expressionName' , 'string' , '预设名称' ] ] . map ( headOutput ) } ,
{ name : '取消后续头部表情帧' , action : 'BIO_HEAD_JOINT_CANCEL_EXPRESSION' , desc : '取消尚未发送的表情帧,不会停止已下发的动作' , nodeParams : [ ] } ,
] . map ( node => ( { icon : expressionSvg , type : 'serviceNode' , nodeType : 'EDGE' , outputType : 'json' , ... node } ) )
const neckNodes = [
{
name : '查询颈部关节配置' , action : 'ARM_NECK_GET_INFO' , desc : '读取设备型号、关节顺序和可用的位置限位' ,
outputParams : [
[ 'deviceId' , 'string' , '设备 ID' ] , [ 'model' , 'string' , '型号' ] , [ 'dof' , 'number' , '关节数' ] ,
[ 'jointNames' , 'array<string>' , '关节顺序' ] ,
] . map ( headOutput ) . concat ( {
... headOutput ( [ 'jointLimits' , 'array<object>' , '关节限位' ] ) ,
children : [
[ 'jointName' , 'string' , '关节名称' ] , [ 'available' , 'boolean' , '限位是否可用' ] ,
[ 'lowerRad' , 'number' , '下限( rad) ' ] , [ 'upperRad' , 'number' , '上限( rad) ' ] ,
[ 'source' , 'string' , '限位来源' ] ,
] . map ( headOutput ) ,
} ) ,
} ,
{
name : '查询颈部关节状态' , action : 'ARM_NECK_GET_JOINT_STATE' , desc : '读取三个关节的实际角度和反馈' ,
outputParams : [
[ 'jointNames' , 'array<string>' , '关节顺序' ] , [ 'positionRad' , 'array<number>' , '角度( rad) ' ] ,
[ 'velocityRadS' , 'array<number>' , '角速度( rad/s) ' ] , [ 'effortNm' , 'array<number>' , '力矩( N·m) ' ] ,
[ 'currentMa' , 'array<number>' , '电流( mA) ' ] , [ 'timestampS' , 'number' , '边端读取时间( Unix 秒)' ] ,
] . map ( headOutput ) ,
} ,
{
name : '查询颈部运行状态' , action : 'ARM_NECK_GET_STATE' , desc : '读取连接、上电、运行和保护状态' ,
outputParams : [
[ 'connected' , 'boolean' , '已连接' ] , [ 'poweredOn' , 'boolean' , '已上电' ] , [ 'moving' , 'boolean' , '运动中' ] ,
[ 'fault' , 'boolean' , '故障' ] , [ 'protectiveStopped' , 'boolean' , '保护停止' ] ,
[ 'emergencyStopped' , 'boolean' , '急停状态' ] , [ 'robotMode' , 'string' , '运行模式' ] ,
[ 'safetyMode' , 'string' , '安全模式' ] , [ 'controlMode' , 'string' , '控制模式' ] ,
] . map ( headOutput ) ,
} ,
{
name : '颈部三轴关节运动' , action : 'ARM_NECK_MOVE_J' , desc : '按设备上报的关节顺序填写三个目标角度( rad) ' ,
nodeParams : [
{ ... headParam ( 'target' , '' , '按设备关节顺序填写三个弧度值组成的 JSON 数组' ) , required : true } ,
{ ... headNumber ( 'velocity' , '可选, rad/s' ) , input : 0.25 } ,
{ ... headNumber ( 'acceleration' , '可选, rad/s²' ) , input : 0.5 } ,
] ,
} ,
{ name : '停止颈部运动' , action : 'ARM_NECK_STOP' , desc : '请求边端停止当前颈部运动' } ,
{ name : '开启颈部使能' , action : 'ARM_NECK_ENABLE' , desc : '调用边端为颈部设备上电并使能' } ,
{ name : '关闭颈部使能' , action : 'ARM_NECK_DISABLE' , desc : '调用边端关闭颈部设备使能' } ,
] . map ( node => ( {
icon : expressionSvg , type : 'serviceNode' , nodeType : 'EDGE' , outputType : 'json' ,
nodeParams : [ ] , outputParams : [ ] , ... node ,
} ) )
2026-11-16 16:35:22 +08:00
const expressOptions = ( ) => {
return [ {
value : 1 ,
label : '高兴'
} , {
value : 2 ,
label : '惊讶'
} , {
value : 3 ,
label : '愤怒'
} , {
value : 4 ,
label : '悲伤'
} , {
value : 5 ,
label : '睡觉'
} , {
value : 6 ,
label : '打哈欠'
} ]
}
/ * *
* AI 评估仅提供触控任务 ; 沿用原 touch 编码 , 避免改变后端非语音评估协议 。
* @ returns { Array } 当前独立项目支持的评估任务类型
* /
const taskTypeOptions = ( ) => {
return [ {
value : 'touch' ,
label : '触控交互'
} ]
}
/ * *
* 处理与 inspection event types 相关的状态或数据 , 该影响范围仅限当前模块 。
* /
const inspectionEventTypes = ( ) => {
return [ {
value : 'No-Glove' ,
label : '没戴手套'
} , {
value : 'No-Helmet-Glove' ,
label : '没戴头盔'
} ]
}
export const collapseList = [
{
collapseTitle : "相机" ,
nodeList : [
{
icon : cameraSvg ,
name : "开启相机" ,
type : "serviceNode" ,
desc : "在获取相机照片时,需要先启动相机" ,
action : 'CAMERA_START' ,
nodeType : 'EDGE' ,
nodeParams : [ ] ,
outputParams : [ ] ,
outputType : 'json'
} ,
{
icon : cameraSvg ,
name : "获取图片" ,
type : "serviceNode" ,
desc : "获取相机拍摄的照片" ,
action : 'CAMERA_GETRGBIMAGE' ,
nodeType : 'EDGE' ,
nodeParams : [ ] ,
outputType : 'img' ,
outputParams : [ { name : 'imageUrl' , type : 'array<string>' , desc : '图片地址数组' , children : [ ] , disabled : true } ]
} ,
{
icon : cameraSvg ,
name : "关闭相机" ,
type : "serviceNode" ,
desc : "获取相机照片后,关闭该相机" ,
action : 'CAMERA_STOP' ,
nodeType : 'EDGE' ,
nodeParams : [ ] ,
outputParams : [ ] ,
outputType : 'json'
} ,
{
icon : videoSvg ,
name : "开启录像" ,
type : "serviceNode" ,
desc : "开启摄像头,并开始录像" ,
action : 'CAMERA_RECORDING_START' ,
nodeType : 'EDGE' ,
nodeParams : [ ] ,
outputParams : [ ] ,
outputType : 'json'
} ,
{
icon : videoSvg ,
name : "结束录像" ,
type : "serviceNode" ,
desc : "停止录像,并关闭摄像头" ,
action : 'CAMERA_RECORDING_STOP' ,
nodeType : 'EDGE' ,
nodeParams : [ ] ,
outputType : 'video' ,
outputParams : [ { name : 'videoUrl' , type : 'array<string>' , children : [ ] , desc : '视频播放地址数组' , disabled : true } ]
}
] ,
} ,
{
collapseTitle : "功能" ,
nodeList : [
{
icon : loopSvg ,
name : "循环" ,
type : "loop" ,
action : 'START_LOOP' ,
desc : "实现对列表对象循环执行一系列任务" ,
nodeParams : [ { name : "loopNum" , type : "input" , input : null , quote : "" } ] ,
outputParams : [ ] ,
outputType : 'json'
} ,
{
icon : planSvg ,
name : "子流程" ,
type : "subFlow" ,
action : 'SUB_FLOW' ,
nodeType : 'NONE' ,
desc : "执行同一项目中已发布的工作流" ,
subFlow : { } ,
nodeParams : [ ] ,
outputParams : [ ] ,
outputType : 'json'
} ,
{
icon : stopLoopSvg ,
name : "结束循环" ,
type : "stopLoop" ,
action : 'STOP_LOOP' ,
desc : "用于立即终止当前所在的循环,跳出循环体" ,
} ,
{
icon : switchSvg ,
name : "分支" ,
type : "branch" ,
action : 'BRANCH' ,
desc : "连接多个下游分支,根据设定的条件按照顺序查找的方式来匹配运行的分支,如果匹配到某条件则只运行该条件对应的分支,否则继续匹配下一条件直至结束" ,
} ,
{
icon : sleepSvg ,
name : "睡眠" ,
type : "sleep" ,
desc : "用于睡眠整个流程,表示延迟多少毫秒" ,
action : 'sleep' ,
nodeParams : [
{ name : "delayMs" , type : "input" , componentType : 'number' , input : 0 , disabled : true }
] ,
outputParams : [ ] ,
outputType : 'json'
} ,
{
icon : expressionSvg ,
name : "HTTP请求" ,
type : "http" ,
desc : "HTTP请求" ,
action : 'HTTP' ,
nodeType : 'HTTP' ,
nodeParams : [
{ name : "config" , type : "input" , input : "" , children : [
{ name : "url" , type : "input" , input : "" , disabled : true , required : true } ,
{ name : "method" , type : "input" , input : "POST" , componentType : 'select' , selectOptions : httpMethodOptions ( ) , disabled : true } ,
{ name : "timeout" , type : "input" , input : "10000" , componentType : 'number' , required : false , disabled : true }
] , disabled : true , required : true } ,
{ name : "headers" , type : "input" , input : "" , children : [
{ name : "" , type : "input" , input : "" }
] , disabled : true , required : true } ,
{ name : "params" , type : "input" , input : "" , children : [
{ name : "" , type : "input" , input : "" }
] , disabled : true , required : true } ,
{ name : "body" , type : "input" , input : "" , children : [
{ name : 'bodyType' , type : "input" , input : "json" , disabled : true } ,
{ name : 'json' , type : "input" , input : '{"a": 123}' } ,
{ name : 'formData' , type : "input" , input : "" , children : [ ] }
] , required : true } ,
] ,
outputType : 'json' ,
outputParams : [ { name : 'result' , type : 'Object' , children : [ ] , desc : 'HTTP请求结果' } ]
} ,
{
icon : expressionSvg ,
name : "代码" ,
type : "code" ,
desc : "js代码" ,
action : 'CODE' ,
canAddFormItem : true ,
nodeParams : [
{ name : "input" , type : "input" , input : "" , required : true } ,
{ name : "code" , type : "input" , input : `
// 方法定义不能修改
/ * *
* 处理与 r 相关的状态或数据 , 该影响范围仅限当前模块 。
* @ param { * } params 待处理的参数集合
* /
function handler ( params ) {
// 返回值是一个可序列化成 json 的 dict 或 object
const result = {
type : 2 ,
message : params . input
}
return result
}
` , required: true }
] ,
outputType : 'json' ,
outputParams : [ { name : 'result' , type : 'object' , children : [
{ name : 'type' , type : 'number' , desc : '占位属性' } ,
{ name : 'message' , type : 'string' , desc : '占位属性' }
] , desc : 'js节点返回' } ]
} ,
{
icon : microphoneSvg ,
name : "获取当前循环对象" ,
type : "currentLoop" ,
desc : "获取当前循环对象" ,
action : 'GET_CURRENT_OBJECT' ,
nodeParams : [
{ name : "array" , type : "input" , input : "" }
] ,
outputType : 'json' ,
outputParams : [
{ name : 'index' , type : 'number' , desc : '索引' } ,
{ name : 'object' , type : 'object' , children : [
{ name : 'test' , type : 'string' , desc : '占位属性' }
] , desc : '当前循环对象' , }
]
} ,
] ,
} ,
{
collapseTitle : "机器人" ,
nodeList : [
{
icon : cameraSvg ,
name : "视觉定位执行" ,
type : "visionLocate" ,
desc : "同帧获取RGBD图像, 分析目标并计算工具TCP和机械臂法兰位姿" ,
action : 'VISION_LOCATE_TARGET' ,
nodeType : 'EDGE' ,
nodeParams : [
{ name : "cameraDeviceId" , type : "input" , input : "" , required : true } ,
{ name : "armDeviceId" , type : "input" , input : "" , required : true } ,
{ name : "toolCode" , type : "input" , input : "" , required : true } ,
{ name : "profileCode" , type : "input" , input : "common.image_analysis.v1" , required : true } ,
{ name : "prompt" , type : "input" , input : "定位目标中心点" , required : true } ,
{ name : "analysisMode" , type : "input" , input : "ACCURATE" } ,
{ name : "mountType" , type : "input" , input : "EYE_IN_HAND" , componentType : "select" , selectOptions : [
{ value : "EYE_IN_HAND" , label : "末端相机" } , { value : "EYE_TO_HAND" , label : "固定相机" }
] } ,
{ name : "approachDistanceMm" , type : "input" , componentType : "number" , input : 10 , min : 1 , max : 20 } ,
{ name : "pressDistanceMm" , type : "input" , componentType : "number" , input : 0 , min : 0 , max : 20 , step : 0.1 } ,
{ name : "normalSampleRadius" , type : "input" , componentType : "number" , input : 12 , min : 3 , max : 40 } ,
{ name : "confidenceThreshold" , type : "input" , componentType : "number" , input : 0.7 , min : 0 , max : 1 , step : 0.01 } ,
{ name : "minDepth" , type : "input" , componentType : "number" , input : 0.05 , min : 0.01 , step : 0.05 } ,
{ name : "maxDepth" , type : "input" , componentType : "number" , input : 5 , min : 0.1 , step : 0.1 } ,
{ name : "maxMovement" , type : "input" , componentType : "number" , input : 0.5 , min : 0.01 , step : 0.01 } ,
{ name : "autoMove" , type : "input" , componentType : "switch" , input : false , disabled : true }
] ,
outputType : 'json' ,
outputParams : [
{ name : 'objectPoint' , type : 'object' , children : pointOutputChildren ( ) } ,
{ name : 'surfaceNormal' , type : 'object' , children : pointOutputChildren ( ) } ,
{ name : 'approachTcpPose' , type : 'object' , children : poseOutputChildren ( ) } ,
{ name : 'contactTcpPose' , type : 'object' , children : poseOutputChildren ( ) } ,
{ name : 'approachFlangePose' , type : 'object' , children : poseOutputChildren ( ) } ,
{ name : 'contactFlangePose' , type : 'object' , children : poseOutputChildren ( ) } ,
{ name : 'pixel' , type : 'object' , children : [ ] } ,
{ name : 'depth' , type : 'number' } ,
{ name : 'depthUnitScale' , type : 'number' } ,
{ name : 'intrinsics' , type : 'object' , children : [ ] }
]
} ,
{
icon : videoSvg ,
name : "AGV控制" ,
type : "serviceNode" ,
desc : "控制机器人的底盘" ,
action : 'AGV_MOVE_TO_POINT' ,
nodeType : 'EDGE' ,
nodeParams : [
{ name : "x" , type : "input" , input : "" , disabled : true } ,
{ name : "y" , type : "input" , input : "" , disabled : true } ,
{ name : "theta" , type : "input" , input : "" , disabled : true } ,
{ name : "blockedTimeoutMs" , type : "input" , componentType : "number" , input : 60000 , min : 1 , required : true , disabled : true } ,
] ,
outputType : 'json'
} ,
{
icon : videoSvg ,
name : "AGV站点导航" ,
type : "serviceNode" ,
desc : "从AGV站点列表选择目标站点并导航" ,
action : 'AGV_MOVE_TO_STATION' ,
nodeType : 'EDGE' ,
nodeParams : [
{ name : "stationId" , type : "input" , input : "" , componentType : 'select' , selectOptions : [ ] , forceSelect : true , disabled : true } ,
{ name : "blockedTimeoutMs" , type : "input" , componentType : "number" , input : 60000 , min : 1 , required : true , disabled : true }
] ,
outputType : 'json'
} ,
{
icon : cameraSvg ,
name : "通用指令" ,
type : "deviceUniversal" ,
desc : "执行设备通用指令" ,
// show: __PROJECT_NAME__ === 'aima',
action : 'DEVICE_EXECUTE_JSON_COMMAND' ,
nodeType : 'EDGE' ,
nodeParams : [
{ name : "requestJson" , type : "input" , input : ` {
"a" : 123
} ` , required: false, disabled: true },
] ,
outputParams : [ ] ,
outputType : 'json'
} ,
{
icon : planSvg ,
name : "动作队列" ,
type : "actionQueue" ,
desc : "在边缘端按顺序连续执行多个动作" ,
// show: __PROJECT_NAME__ === 'aima',
action : 'SYSTEM_EXECUTE_ACTION_QUEUE' ,
nodeType : 'EDGE' ,
nodeParams : [
{ name : "actionId" , type : "input" , input : "" , required : false } ,
{ name : "totalTimeoutMs" , type : "input" , componentType : 'number' , input : 60000 , required : true } ,
{ name : "steps" , type : "input" , input : [ ] , required : true } ,
] ,
outputParams : [
{ name : 'actionId' , type : 'string' , desc : '动作队列标识' } ,
{ name : 'completedSteps' , type : 'number' , desc : '已完成步骤数' } ,
{ name : 'result' , type : 'string' , desc : '执行结果' } ,
] ,
outputType : 'json'
} ,
{
icon : videoSvg ,
name : "机械臂" ,
type : "serviceNode" ,
desc : "控制机器人的手臂" ,
action : 'ARM_MOVE_TO_POINT' ,
nodeType : 'EDGE' ,
nodeParams : [
{ name : "x" , type : "input" , input : "" , disabled : true } ,
{ name : "y" , type : "input" , input : "" , disabled : true } ,
{ name : "z" , type : "input" , input : "" , disabled : true } ,
{ name : "rx" , type : "input" , input : "" , disabled : true } ,
{ name : "ry" , type : "input" , input : "" , disabled : true } ,
{ name : "rz" , type : "input" , input : "" , disabled : true } ,
{ name : "velocity" , type : "input" , componentType : 'number' , max : 5 , step : 0.01 , input : 0.1 , disabled : true } ,
{ name : "acceleration" , type : "input" , componentType : 'number' , max : 5 , step : 0.01 , input : 0.2 , disabled : true } ,
] ,
outputType : 'json'
} ,
{
icon : videoSvg ,
name : "机械臂关节运动" ,
type : "serviceNode" ,
desc : "通过关节空间插值运动到目标关节位置" ,
action : 'ARM_MOVE_TO_J' ,
nodeType : 'EDGE' ,
nodeParams : [
{ name : "target" , type : "input" , input : "[0, 0, 0, 0, 0, 0]" , disabled : true } ,
{ name : "velocity" , type : "input" , componentType : 'number' , max : 5 , step : 0.01 , input : 0.1 , disabled : true } ,
{ name : "acceleration" , type : "input" , componentType : 'number' , max : 5 , step : 0.01 , input : 0.2 , disabled : true } ,
] ,
outputType : 'json'
} ,
// 使能状态由两个独立节点显式控制。节点本身不接收参数,也不依赖前一运动节点的隐式使能,
// 因而可在流程开始、异常恢复或任务收尾位置按业务需要自由编排。
{
icon : videoSvg ,
name : "开启机械臂使能" ,
type : "serviceNode" ,
desc : "开启机械臂使能,后续运动节点不会自动使能" ,
action : 'ARM_ENABLE' ,
nodeType : 'EDGE' ,
nodeParams : [ ] ,
outputParams : [ ] ,
outputType : 'json'
} ,
// 关闭节点与开启节点使用不同 action, 边缘执行器据此下发去使能指令;
// 空 outputParams 表示该节点只负责设备状态切换,不向后续节点暴露业务输出。
{
icon : videoSvg ,
name : "关闭机械臂使能" ,
type : "serviceNode" ,
desc : "关闭机械臂使能" ,
action : 'ARM_DISABLE' ,
nodeType : 'EDGE' ,
nodeParams : [ ] ,
outputParams : [ ] ,
outputType : 'json'
} ,
{
icon : cameraSvg ,
name : "开始监听报警事件" ,
type : "serviceNode" ,
desc : "开始监听报警事件" ,
action : 'INSPECTION_ALERT_LISTEN_START' ,
nodeType : 'EDGE' ,
nodeParams : [
{ name : "robotId" , type : "input" , input : "" , disabled : true } ,
{ name : "eventTypes" , type : "input" , input : "" , componentType : 'select' , selectOptions : inspectionEventTypes ( ) , disabled : true }
] ,
outputParams : [ ] ,
outputType : 'json'
} ,
{
icon : cameraSvg ,
name : "结束监听报警事件" ,
type : "serviceNode" ,
desc : "结束监听报警事件" ,
action : 'INSPECTION_ALERT_LISTEN_STOP' ,
nodeType : 'EDGE' ,
nodeParams : [
{ name : "robotId" , type : "input" , input : "" , disabled : true } ,
{ name : "eventTypes" , type : "input" , input : "" , componentType : 'select' , selectOptions : inspectionEventTypes ( ) , disabled : true }
] ,
outputParams : [ ] ,
outputType : 'json'
} ,
{
icon : dialogueSvg ,
name : "巡检仪表读数识别" ,
type : "recognize" ,
desc : "巡检仪表读数识别" ,
action : 'INSPECTION_METER_RECOGNIZE' ,
nodeType : "LLM" ,
outputType : 'json' ,
nodeParams : [
{ name : 'imageUrl' , type : "input" , input : "" , disabled : true } ,
{ name : 'resultName' , type : "input" , input : "" , disabled : true } ,
{ name : "alarmRules" , type : "input" , input : [ ] , disabled : true }
] ,
outputParams : [ ]
} ,
{
icon : cameraSvg ,
name : "人工巡检判断" ,
type : "serviceNode" ,
desc : "创建人工巡检判断任务" ,
action : 'INSPECTION_MANUAL_REVIEW_CREATE' ,
nodeType : 'EDGE' ,
nodeParams : [
{ name : "resultName" , type : "input" , input : "" , disabled : true } ,
{ name : "videoUrl" , type : "input" , input : "" , required : false , disabled : true } ,
{ name : "imageUrl" , type : "input" , input : "" , required : false , disabled : true } ,
{ name : "reviewCriteria" , type : "input" , input : "" , disabled : true } ,
{ name : "defaultAlarmLevel" , type : "input" , componentType : 'number' , max : 3 , step : 1 , input : 1 , disabled : true } ,
] ,
outputParams : [ ] ,
outputType : 'json'
} ,
] ,
} ,
2026-11-25 10:07:09 +08:00
{ collapseTitle : '颈部' , nodeList : neckNodes } ,
2026-11-16 16:35:22 +08:00
{
collapseTitle : "音频" ,
nodeList : [
{
icon : microphoneSvg ,
name : "启动麦克风" ,
type : "serviceNode" ,
desc : "用于启动麦克风的节点" ,
action : 'MICROPHONE_START' ,
nodeType : 'EDGE' ,
nodeParams : [ ] ,
outputType : 'json'
} ,
{
icon : microphoneSvg ,
name : "停止麦克风" ,
type : "serviceNode" ,
desc : "用于停止麦克风的节点" ,
action : 'MICROPHONE_STOP' ,
nodeType : 'EDGE' ,
nodeParams : [ ] ,
outputType : 'audio' ,
outputParams : [ { name : 'audioUrl' , type : 'array<string>' , children : [ ] , desc : '录音播放地址数组' , disabled : true } ]
} ,
{
icon : audioSvg ,
name : "播放音频" ,
type : "serviceNode" ,
desc : "用于播放音频的节点" ,
action : 'SPEAKER_PLAYAUDIO' ,
nodeType : 'EDGE' ,
nodeParams : [
{ name : "audioPath" , type : "input" , input : "" , disabled : true }
] ,
outputType : 'json'
} ,
] ,
} ,
{
collapseTitle : "大模型" ,
nodeList : [
{
icon : microphoneSvg ,
name : "声音类型检测" ,
type : "mediaAnalysis" ,
desc : "判断录音是否属于指定的声音类型" ,
action : "AUDIO_EVENT_CLASSIFY" ,
nodeType : "LLM" ,
nodeParams : [
{ name : "profileCode" , type : "input" , input : "aima.power_state.v1" , required : true , disabled : true } ,
{ name : "expectedLabel" , type : "input" , input : "" , required : true , disabled : true } ,
{ name : "expectedLabelName" , type : "input" , input : "" , required : false , disabled : true } ,
{ name : "audioUrl" , type : "quote" , input : "" , quote : "" , required : true , disabled : true } ,
{ name : "asynchronous" , type : "input" , input : false , required : false , disabled : true , componentType : "switch" } ,
] ,
outputType : "json" ,
outputParams : [
{ name : "passed" , type : "boolean" , desc : "是否检测到目标声音" , disabled : true } ,
{ name : "expectedLabel" , type : "string" , desc : "目标声音类型编码" , disabled : true } ,
{ name : "expectedLabelName" , type : "string" , desc : "目标声音类型名称" , disabled : true } ,
{ name : "label" , type : "string" , desc : "实际声音类型编码, 未匹配时为UNKNOWN" , disabled : true } ,
{ name : "labelName" , type : "string" , desc : "实际声音类型名称" , disabled : true } ,
{ name : "matched" , type : "boolean" , desc : "是否识别到已知声音" , disabled : true } ,
{ name : "confidence" , type : "number" , desc : "最高匹配度" , disabled : true } ,
{ name : "decisionReason" , type : "string" , desc : "检测结论" , disabled : true } ,
{ name : "scores" , type : "object" , desc : "各分类匹配度" , children : [ ] , disabled : true } ,
] ,
} ,
{
icon : videoSvg ,
name : "视频智能分析" ,
type : "mediaAnalysis" ,
desc : "按分析场景理解测试录像并输出结构化结论" ,
action : "VIDEO_ANALYZE" ,
nodeType : "LLM" ,
nodeParams : [
{ name : "profileCode" , type : "input" , input : "aima.power_video.v1" , required : true , disabled : true } ,
{ name : "videoUrl" , type : "quote" , input : "" , quote : "" , required : true , disabled : true } ,
{ name : "instruction" , type : "input" , input : "" , required : true , disabled : true } ,
{ name : "analysisMode" , type : "input" , input : "AUTO" , required : false , disabled : true } ,
// 默认返回精简结论;用户开启详细输出时,执行端才补充事件证据。
{ name : "detailedOutput" , type : "input" , input : false , required : false , disabled : true , componentType : "switch" } ,
{ name : "analysisTuning" , type : "input" , input : { sampleFps : 2 , maxWidth : 960 , confidenceThreshold : 0.75 , fallbackToAccurate : true } , required : false , disabled : true } ,
{ name : "asynchronous" , type : "input" , input : false , required : false , disabled : true , componentType : "switch" } ,
] ,
outputType : "json" ,
outputParams : [
{ name : "result" , type : "string" , desc : "分析结果" , disabled : true } ,
{ name : "passed" , type : "boolean" , desc : "是否通过" , disabled : true } ,
{ name : "confidence" , type : "number" , desc : "判定置信度" , disabled : true } ,
{ name : "evidenceSufficient" , type : "boolean" , desc : "证据是否充分" , disabled : true } ,
{ name : "decisionReason" , type : "string" , desc : "判定原因" , disabled : true } ,
{ name : "conclusion" , type : "string" , desc : "分析结论" , disabled : true } ,
{ name : "summary" , type : "string" , desc : "分析摘要" , disabled : true } ,
{ name : "events" , type : "array<object>" , desc : "关键事件" , children : [ ] , disabled : true } ,
{ name : "analysisMode" , type : "string" , desc : "实际分析模式" , disabled : true } ,
{ name : "fallback" , type : "boolean" , desc : "是否切换精确分析" , disabled : true } ,
{ name : "detailedOutput" , type : "boolean" , desc : "是否返回详细事件证据" , disabled : true } ,
] ,
} ,
{
// 通用图片分析不内置通过/不通过判定,返回结构完全由用户提示词约定。
icon : cameraSvg ,
name : "通用图片分析" ,
type : "imageAnalysis" ,
desc : "按照提示词分析一张或多张图片并返回指定内容" ,
action : 'IMAGE_ANALYZE' ,
nodeType : "LLM" ,
nodeParams : [
{ name : "profileCode" , type : "input" , input : "common.image_analysis.v1" , required : true , disabled : true } ,
{ name : "imageUrl" , type : "quote" , input : "" , quote : "" , required : true , disabled : true } ,
{ name : "analysisMethod" , type : "input" , input : "VISION_MODEL" , required : false , disabled : true } ,
{ name : "prompt" , type : "input" , input : "" , required : true , disabled : true , componentType : "textarea" } ,
{ name : "analysisMode" , type : "input" , input : "FAST" , required : false , disabled : true } ,
{ name : "analysisTuning" , type : "input" , input : { maxWidth : 896 , maxImages : 12 , maxOutputTokens : 384 , matchThreshold : 0.48 , matchSelector : "BEST" , matchIndex : 1 , matchSort : "ROW_MAJOR" , locateConfidenceThreshold : 0.45 } , required : false , disabled : true } ,
{ name : "asynchronous" , type : "input" , input : false , required : false , disabled : true , componentType : "switch" } ,
] ,
outputType : "json" ,
outputParams : [
{ name : "result" , type : "object" , desc : "按提示词返回的结果" , children : [ ] , disabled : true } ,
{ name : "resultText" , type : "string" , desc : "模型返回的原始文本" , disabled : true } ,
{ name : "matched" , type : "boolean" , desc : "找图是否匹配" , disabled : true } ,
{ name : "matchScore" , type : "number" , desc : "匹配分数或定位置信度" , disabled : true } ,
{ name : "coordinates" , type : "array<number>" , desc : "原图坐标 [x1,y1,x2,y2]" , children : [ ] , disabled : true } ,
{ name : "center" , type : "array<number>" , desc : "目标中心点 [x,y]" , children : [ ] , disabled : true } ,
{ name : "matchedDescription" , type : "string" , desc : "模型实际定位的目标描述" , disabled : true } ,
{ name : "refinementMethod" , type : "string" , desc : "坐标精修方式" , disabled : true } ,
{ name : "matchCount" , type : "number" , desc : "匹配项数量" , disabled : true } ,
{ name : "matches" , type : "array<object>" , desc : "全部匹配项" , children : [ ] , disabled : true } ,
{ name : "selectedMatchIndex" , type : "number" , desc : "当前选择的匹配序号" , disabled : true } ,
] ,
} ,
{
icon : microphoneSvg ,
name : "获取触控坐标" ,
type : "serviceNode" ,
desc : "用于获取触控坐标的节点" ,
action : 'TOUCH_COORDINATES' ,
nodeType : "LLM" ,
nodeParams : [
{ name : "targetFeature" , type : "input" , input : "运动模式" , disabled : true } ,
{ name : "manufacturer" , type : "input" , input : "xiaomi" , disabled : true } ,
{ name : "vehType" , type : "input" , input : "su7" , disabled : true } ,
] ,
outputType : 'json' ,
outputParams : [ { name : 'coordinates' , type : 'object' , children : [
{ name : 'x' , type : 'number' , desc : 'x坐标' } ,
{ name : 'y' , type : 'number' , desc : 'y坐标' }
] , desc : '坐标对象' , } ]
} , {
icon : dialogueSvg ,
name : "意图识别" ,
type : "serviceNode" ,
desc : "识别文本意图,支持触控交互、闲聊及知识问答,类别沿用服务端协议" ,
action : 'INTENT_RECOGNITION' ,
nodeType : "LLM" ,
outputType : 'json' ,
nodeParams : [ { name : 'text' , type : "input" , input : "" , disabled : true } ] ,
outputParams : [ { name : 'type' , type : 'string' , desc : '服务端意图类别( 2: 触控交互; 3: 闲聊; 4: 知识问答) ' , disabled : true } ]
} , {
icon : dialogueSvg ,
name : "商道智能体" ,
type : "sdAgent" ,
desc : "通过apiKey调用商道大模型" ,
action : 'AI_AGENT_PLATFORM' ,
show : _ _PROJECT _NAME _ _ === 'cmvr' ,
nodeType : "LLM" ,
outputType : 'json' ,
nodeParams : [
{ name : "config" , type : "input" , input : "" , children : [
{ name : 'apiKey' , type : "input" , input : "" , disabled : true } ,
{ name : 'text' , type : "input" , input : "" , disabled : true } ,
] } ,
{ name : 'invokeTts' , type : "input" , input : false } ,
] ,
outputParams : [ { name : 'result' , type : 'string' , desc : '商道大模型的返回文案' , disabled : true } ]
} , {
icon : dialogueSvg ,
name : "获取当前页面名称" ,
type : "serviceNode" ,
desc : "获取当前页面名称" ,
action : 'GET_CURRENT_PAGE' ,
nodeType : "LLM" ,
outputType : 'json' ,
nodeParams : [
{ name : 'url' , type : "input" , input : "" , disabled : true } ,
] ,
outputParams : [ { name : 'pageName' , type : 'string' , desc : '当前页面名称' , disabled : true } ]
}
] ,
} ,
{
collapseTitle : "触控交互" ,
nodeList : [
{
icon : touchSvg ,
name : "触控" ,
type : "serviceNode" ,
desc : "去触控坐标的点位" ,
action : 'TOUCH' ,
nodeType : "EDGE" ,
nodeParams : [
{ name : "touchParams" , type : "input" , input : "" , disabled : true }
] ,
outputType : 'json' ,
} ,
{
icon : expressionSvg ,
name : "开始说话" ,
type : "serviceNode" ,
desc : "控制机器人说话" ,
action : 'BIO_HEAD_SPEAK_START' ,
nodeType : "EDGE" ,
nodeParams : [ ] ,
outputType : 'json' ,
} ,
{
icon : expressionSvg ,
name : "停止说话" ,
type : "serviceNode" ,
desc : "停止机器人说话" ,
action : 'BIO_HEAD_SPEAK_STOP' ,
nodeType : "EDGE" ,
nodeParams : [ ] ,
outputType : 'json' ,
} ,
{
icon : expressionSvg ,
name : "表情" ,
type : "serviceNode" ,
desc : "控制机器人的面部表情" ,
action : 'BIO_HEAD_SPECIAL_EXPRESSION' ,
nodeType : "EDGE" ,
nodeParams : [
{ name : "expressKey" , type : "input" , componentType : 'select' , selectOptions : expressOptions ( ) , disabled : true } ,
] ,
outputType : 'json' ,
} ,
2026-11-25 10:07:09 +08:00
... headJointNodes ,
2026-11-16 16:35:22 +08:00
{
icon : touchSvg ,
name : "路径搜索" ,
type : "serviceNode" ,
desc : "路径搜索" ,
action : 'TI_PATH_SEARCH' ,
nodeType : "EDGE" ,
nodeParams : [
{ name : "currentLocation" , type : "input" , input : "" , disabled : true } ,
{ name : "funcId" , type : "input" , input : "" , disabled : true } ,
{ name : "vehicleConfigId" , type : "input" , input : "" , disabled : true } ,
] ,
outputType : 'json' ,
outputParams : [
{ name : 'nextLocation' , type : 'string' , desc : '下一路径位置' , disabled : true } ,
{ name : 'isEnd' , type : 'string' , desc : '是否结束' , disabled : true } ,
{ name : 'iconUrl' , type : 'string' , desc : '图标路径' , disabled : true }
]
} ,
{
icon : touchSvg ,
name : "获取触控二维坐标" ,
type : "serviceNode" ,
desc : "获取触控二维坐标" ,
action : 'TI_TOUCH_COORDINATES' ,
nodeType : "EDGE" ,
nodeParams : [
{ name : "imageUrl" , type : "input" , input : "" , disabled : true } ,
{ name : "iconUrl" , type : "input" , input : "" , disabled : true }
] ,
outputType : 'json' ,
outputParams : [
{ name : 'touchCoordinates' , type : 'string' , desc : '触控二维坐标' , disabled : true } ,
]
}
] ,
} ,
{
collapseTitle : "AI评估" ,
nodeList : [
{
icon : expressionSvg ,
name : "AI评估预处理" ,
type : "serviceNode" ,
desc : "AI评估预处理" ,
action : 'AI_EVALUATION_PRE' ,
nodeType : "AE" ,
nodeParams : [
{ name : "taskType" , type : "input" , input : "" , componentType : 'select' , selectOptions : taskTypeOptions ( ) , disabled : true } ,
] ,
outputType : 'json' ,
} ,
{
icon : touchSvg ,
name : "AI评估执行" ,
type : "serviceNode" ,
desc : "AI评估执行" ,
action : 'AI_EVALUATION_END' ,
nodeType : "AE" ,
nodeParams : [
{ name : "videoUrl" , type : "input" , input : "" , disabled : true }
] ,
outputType : 'json' ,
}
] ,
} ,
{
collapseTitle : "闲聊" ,
nodeList : [ {
icon : dialogueSvg ,
name : "闲聊" ,
type : "chat" ,
desc : "输入文本并调用大模型进行自然语言闲聊,只返回文本" ,
action : 'LLM_CHAT' ,
nodeType : "LLM" ,
outputType : 'json' ,
nodeParams : [
{ name : "text" , type : "input" , input : "" , required : true } ,
{ name : "promptMode" , type : "input" , input : "CUSTOM" , componentType : "select" , selectOptions : [
{ value : "FIXED" , label : "固定提示词(推荐)" } , { value : "CUSTOM" , label : "自定义提示词" }
] } ,
{ name : "prompt" , type : "input" , input : DEFAULT _CHAT _SYSTEM _PROMPT , required : true } ,
{ name : "invokeTts" , type : "input" , input : false , disabled : true } ,
] ,
outputParams : [ { name : 'text' , type : 'string' , desc : '大模型返回的闲聊文本' , disabled : true } ]
} ]
} ,
]
// 流程数据会长期保存,而 Vite 生成的图标地址只对当前构建有效。
// 这里用稳定的 action 建立索引,使旧流程或后端缺失 icon 时可以恢复为当前版本的内置图标。
const flowNodeIconByAction = new Map (
collapseList . flatMap ( ( group ) => group . nodeList )
. filter ( ( node ) => node . action && node . icon )
. map ( ( node ) => [ String ( node . action ) . trim ( ) . toUpperCase ( ) , node . icon ] ) ,
)
/ * *
* 根据流程节点 action 获取当前版本的内置图标 。
*
* 实现思路 : action 是流程协议中的稳定标识 , 比构建生成的资源 URL 更适合跨版本匹配 ;
* 未识别的 action 返回空字符串 , 由调用方继续使用后端自定义图标或通用占位图标 。
*
* @ param { * } action 流程节点的动作标识
* @ returns { string } 当前构建对应的图标地址 , 未匹配时返回空字符串
* /
export const getFlowNodeIconByAction = ( action ) => {
const normalizedAction = String ( action || '' ) . trim ( ) . toUpperCase ( )
return normalizedAction ? flowNodeIconByAction . get ( normalizedAction ) || '' : ''
}