STT逻辑修改

This commit is contained in:
2025-10-28 19:51:32 +08:00
parent 68a3644b5f
commit 926b542c45

View File

@@ -143,8 +143,9 @@ public class ChatWebSocketHandler {
}
String startFlag = cacheReplyFlag.get(session.getId());
//语音结束,开始进行回答解析
log.info("开始文本处理,客户端ID为:{}",clientId);
String cacheResultText = cacheClientTts.get(clientId);
log.info("面试者回答信息为:{}", cacheResultText);
log.info("开始文本处理,面试者回答信息为:{}", cacheResultText);
if (StrUtil.isEmpty(cacheResultText)) {
cacheResultText = "I first check the forklift's logbook for recent issues, inspect tires and brakes, verify the load capacity matches today's task, and confirm my licence is current—all per SWMS requirements.";
}
@@ -471,7 +472,7 @@ public class ChatWebSocketHandler {
@Override
public void onMessage(WebSocket webSocket, String text) {
System.out.println("📩 收到转录结果: " + text);
// System.out.println("📩 收到转录结果: " + text);
//对数据进行解析
if (StrUtil.isNotEmpty(text)) {
Map<String, String> mapResultData = JSONUtil.toBean(text, Map.class);
@@ -484,6 +485,7 @@ public class ChatWebSocketHandler {
} else {
cacheString = resultText;
}
log.info("收到转录结果:{}","客户端ID为:"+clientId+",转录结果:"+resultText);
cacheClientTts.put(clientId, cacheString);
}
}