TTS key 修改
This commit is contained in:
@@ -375,6 +375,17 @@ public class ChatWebSocketHandler {
|
||||
//直接对该问题进行转换处理返回语音流
|
||||
log.info("第一个问题为:{}",question);
|
||||
sendTTSBuffer(clientId, question, session);
|
||||
//发送问题文本
|
||||
try {
|
||||
//把文本也给前端返回去
|
||||
Map<String, String> dataText = new HashMap<>();
|
||||
dataText.put("type", "question");
|
||||
dataText.put("content", question);
|
||||
log.info("提问的问题文本发送啦:{}",JSONUtil.toJsonStr(dataText));
|
||||
session.getBasicRemote().sendText(JSONUtil.toJsonStr(dataText));
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
//初始化记录提示词数据到-缓存中
|
||||
@@ -429,13 +440,13 @@ public class ChatWebSocketHandler {
|
||||
resultEntity.put("content", resultMsg);
|
||||
resultEntity.put("type", "score");
|
||||
try{
|
||||
//返回评分语音
|
||||
sendTTSBuffer(clientId,resultMsg,session);
|
||||
|
||||
//返回最终的评分结构
|
||||
log.info("返回最终的评分结构:{}",JSONUtil.toJsonStr(resultEntity));
|
||||
session.getBasicRemote().sendText(JSONUtil.toJsonStr(resultEntity));
|
||||
|
||||
//返回评分语音
|
||||
sendTTSBuffer(clientId,resultMsg,session);
|
||||
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
@@ -544,6 +555,9 @@ public class ChatWebSocketHandler {
|
||||
String openingPathUrl = RuoYiConfig.getProfile() + VOICE_SYSTEM_DIR + "end.wav";
|
||||
sendVoiceBuffer(openingPathUrl, session);
|
||||
|
||||
//返回评分语音
|
||||
sendTTSBuffer(clientId,scoreText,session);
|
||||
|
||||
Map<String, String> resultEntity = new HashMap<>();
|
||||
resultEntity.put("content", scoreText);
|
||||
resultEntity.put("type", "score");
|
||||
@@ -551,9 +565,6 @@ public class ChatWebSocketHandler {
|
||||
log.info("返回最终的评分结果:{}",JSONUtil.toJsonStr(resultEntity));
|
||||
session.getBasicRemote().sendText(JSONUtil.toJsonStr(resultEntity));
|
||||
|
||||
//返回评分语音
|
||||
sendTTSBuffer(clientId,scoreText,session);
|
||||
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
|
||||
Reference in New Issue
Block a user