/** * 文件说明:定义流程设计器可用的节点、表单字段及下拉选项等静态配置。 * 作用范围:仅服务于流程设计器模块。 */ 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 相关的状态或数据,该影响范围仅限当前模块。 */ 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', 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', 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' }, ], }, { 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', 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", 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", desc: "原图坐标 [x1,y1,x2,y2]", children: [], disabled: true }, { name: "center", type: "array", 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", 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', }, { 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) || '' : '' }