关闭算法音频合成

This commit is contained in:
wulin 2023-10-18 17:16:04 +08:00
parent ef5cbad1ef
commit 81699e840e

View File

@ -616,7 +616,7 @@ public class BaseWebSocketProcess {
log.info("推送Box播放音乐");
BoxSession boxSession = getBoxSessionWithSn(baseSession.getSn());
if(boxSession != null){
sendMsg(baseSession, JSONObject.toJSONString(resp));
sendMsg(baseSession, resp);
//记录音乐状态
if(resp.getMusic().getPlay().equals(PlayEnum.STOP.getCode())){
//去掉内存中音乐同步对象
@ -660,15 +660,14 @@ public class BaseWebSocketProcess {
}
}
return deviceUserTalkRecordService.insertDeviceUserTalkRecord(talkRecord).flatMap(i ->{
String msg = JSONObject.toJSONString(resp);
if(this instanceof BoxWebSocketHandler){
log.info("果box聊天记录同步到客户端");
BaseSession userSession = getUserSessionWithUserId(baseSession.getUserId());
if(userSession != null){
sendMsg(userSession, msg);
sendMsg(userSession, resp);
}
}
sendMsg(baseSession, msg);
sendMsg(baseSession, resp);
return Mono.just(true);
});//保存聊天记录
@ -696,8 +695,7 @@ public class BaseWebSocketProcess {
BoxMessageResp resp = new BoxMessageResp();
resp.setType(type);
resp.setText(message);
String msg = JSONObject.toJSONString(resp);
sendMsg(baseSession, msg);
sendMsg(baseSession, resp);
}
protected void normalSendMsg(BaseSession baseSession, String message, Integer type, Integer finish){
@ -705,18 +703,18 @@ public class BaseWebSocketProcess {
resp.setType(type);
resp.setText(message);
resp.getTts().setStatus(finish);
String msg = JSONObject.toJSONString(resp);
sendMsg(baseSession, msg);
sendMsg(baseSession, resp);
}
private void sendMsg(BaseSession baseSession, String msg) {
private void sendMsg(BaseSession baseSession, BaseMessageResp baseMessageResp) {
String msg = JSONObject.toJSONString(baseMessageResp);
log.info("推到终端:{},SN:{},userId:{},消息内容:{}", baseSession.getSessionType(), baseSession.getSn(), baseSession.getUserId(), msg);
if(this instanceof BoxWebSocketHandler){
BoxMessageResp boxMessageResp = JSONObject.parseObject(msg, BoxMessageResp.class);
audioService.getAudioUrl(boxMessageResp.getText()).map(s ->{
audioService.getAudioUrl(baseMessageResp.getText()).map(s ->{
log.info("音频地址:{}", s);
boxMessageResp.setAudio(s);
baseSession.getSink().next(baseSession.getSession().textMessage(JSONObject.toJSONString(boxMessageResp)));
((BoxMessageResp)baseMessageResp).setAudio(s);
baseSession.getSink().next(baseSession.getSession().textMessage(JSONObject.toJSONString(baseMessageResp)));
return s;
}).subscribe();
}else{