fix: 动作

This commit is contained in:
stream 2025-12-17 18:43:18 +08:00
parent ac7d5c283c
commit d955aa2275
2 changed files with 42 additions and 18 deletions

View File

@ -10,20 +10,18 @@ public enum FlowiseActionEnum {
SPEAK("speak", "tts说话"),
// ===== 表情控制 =====
SMILE("smile", "微笑"),
SMILE("smile", "高兴"),
SURPRISED("surprised", "惊讶"),
ANGRY("angry", "愤怒"),
SAD("sad", "悲伤"),
SLEEP("sleep", "睡觉"),
YAWN("yawn", "打哈欠"),
TIRED("tired", "疲惫"),
// ===== 机械臂动作预留=====
WAVE("wave", "挥手"),
GRAB("grab", "抓取"),
POINT("point", "指向"),
HEART("heart", "比心"),
RAISE_HAND("raise_hand", "举手"),
RESET_ARM("reset_arm", "机械臂归位");
// ===== 动作=====
AC_ON("ac_on", "打开空调"),
AC_OFF("ac_off", "关闭空调"),
MUSIC_ON("music_on", "打开音乐"),
MUSIC_OFF("music_off", "关闭音乐"),
DRIVE_MODE_SPORT("drive_mode_sport", "设置驾驶模式为运动模式"),
DRIVE_MODE_COMFORT("drive_mode_comfort", "设置驾驶模式为舒适模式");
private final String action;
private final String description;

View File

@ -1,6 +1,7 @@
package com.cmvr.test.service;
import cn.hutool.http.HttpRequest;
import cn.hutool.http.HttpUtil;
import com.alibaba.fastjson2.JSON;
import com.alibaba.fastjson2.JSONArray;
import com.alibaba.fastjson2.JSONObject;
@ -15,6 +16,7 @@ import com.cmvr.test.enums.FlowiseActionEnum;
import com.cmvr.test.flow.context.TaskContext;
import com.cmvr.test.flow.context.TaskContextManager;
import com.cmvr.test.flow.control.FlowControlService;
import com.cmvr.test.flow.runtime.engine.FlowTaskRuntimeService;
import com.cmvr.test.model.vo.FlowiseActionRequestVO;
import com.cmvr.test.model.vo.FlowiseChatRequestVO;
import com.cmvr.test.model.vo.FlowiseStartRequestVO;
@ -39,6 +41,7 @@ public class FlowiseActionService {
private final EdgeHumanoidRobotService edgeHumanoidRobotService;
private final TaskContextManager taskContextManager;
private final FlowControlService flowControlService;
private final FlowTaskRuntimeService flowTaskRuntimeService;
@Value("${flowise.tts}")
private String flowiseTts;
@ -132,18 +135,41 @@ public class FlowiseActionService {
// ==== 表情 ====
case SMILE:
return edgeBioHeadService.specialExpression(terminalId, bioId, 1);
case SURPRISED:
return edgeBioHeadService.specialExpression(terminalId, bioId, 2);
case ANGRY:
return edgeBioHeadService.specialExpression(terminalId, bioId, 3);
case SAD:
return edgeBioHeadService.specialExpression(terminalId, bioId, 4);
case SLEEP:
case SURPRISED:
return edgeBioHeadService.specialExpression(terminalId, bioId, 2);
case TIRED:
return edgeBioHeadService.specialExpression(terminalId, bioId, 5);
case YAWN:
return edgeBioHeadService.specialExpression(terminalId, bioId, 6);
// ==== 动作 ====
case AC_ON:
// TeTaskExecuteNormalVO teTaskExecuteNormalVO = new TeTaskExecuteNormalVO();
// teTaskExecuteNormalVO.setTerminalId(terminalId);
// teTaskExecuteNormalVO.setTaskId("bd19174754e6e2b84661a4771d04e212");
// flowTaskRuntimeService.executeTask(teTaskExecuteNormalVO);
HttpUtil.post("http://192.168.0.131:8000/action/one", "");
return "空调打开了";
case AC_OFF:
log.info("空调关闭了");
return "空调关闭了";
case MUSIC_ON:
log.info("音乐打开了");
return "音乐打开了";
case MUSIC_OFF:
log.info("音乐关闭了");
return "音乐关闭了";
case DRIVE_MODE_SPORT:
log.info("驾驶模式已切换为运动模式");
return "驾驶模式已切换为运动模式";
case DRIVE_MODE_COMFORT:
log.info("驾驶模式已切换为舒适模式");
return "驾驶模式已切换为舒适模式";
default:
throw new UnsupportedOperationException("未实现的 Flowise Action: " + action);