TTS 返回语音优化

This commit is contained in:
2025-10-19 14:53:28 +08:00
parent 6c127b8639
commit 080c32cba7

View File

@@ -114,11 +114,14 @@ public class ChatWebSocketHandler {
Map<String,String> mapResult = JSONUtil.toBean(JSONUtil.parseObj(message),Map.class);
String resultFlag = mapResult.get("msg");
if("done".equals(resultFlag)){
//发送消息
WebSocket webSocket = cacheWebSocket.get(clientId);
if(webSocket != null){
webSocket.close(1000,null);
}
webSocket.send("{\"type\": \"input_audio_buffer.commit\"}");
webSocket.send("{\"type\": \"response.create\"}");
// if(webSocket != null){
// webSocket.close(1000,null);
// }
//语音结束,开始进行回答解析
String cacheResultText = cacheClientTts.get(clientId);
log.info("1、开始进行AI回答时间:{}",System.currentTimeMillis()/1000);