TTS 返回语音优化

This commit is contained in:
2025-10-19 23:01:02 +08:00
parent 42c8aef2ac
commit f5f5afb649

View File

@@ -190,7 +190,7 @@ public class ChatWebSocketHandler {
byteBuffer.get(bytes); byteBuffer.get(bytes);
log.info("2、开始接收数据流时间:{}",System.currentTimeMillis()/1000); log.info("2、开始接收数据流时间:{}",System.currentTimeMillis()/1000);
// 生成唯一文件名 // 生成唯一文件名
String fileName = clientId + "_" + System.currentTimeMillis() + ".webm"; String fileName = clientId + "_" + System.currentTimeMillis() + ".wav";
String pathUrl = RuoYiConfig.getProfile()+VOICE_STORAGE_DIR + fileName; String pathUrl = RuoYiConfig.getProfile()+VOICE_STORAGE_DIR + fileName;
log.info("文件路径为:{}", pathUrl); log.info("文件路径为:{}", pathUrl);
log.info("3、开始接收数据流时间:{}",System.currentTimeMillis()/1000); log.info("3、开始接收数据流时间:{}",System.currentTimeMillis()/1000);
@@ -279,9 +279,9 @@ public class ChatWebSocketHandler {
} }
// 确保文件以.webm结尾 // 确保文件以.webm结尾
if (!filePath.toLowerCase().endsWith(".webm")) { // if (!filePath.toLowerCase().endsWith(".webm")) {
filePath += ".webm"; // filePath += ".webm";
} // }
FileOutputStream fos = null; FileOutputStream fos = null;
try { try {