From e1ad2d959c960355ab8f71680a61de4cf60057a5 Mon Sep 17 00:00:00 2001 From: wangxiangshun Date: Thu, 6 Nov 2025 11:07:04 +0800 Subject: [PATCH] =?UTF-8?q?=E8=BF=94=E5=9B=9E=E7=BB=93=E6=9E=84=E4=BF=AE?= =?UTF-8?q?=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/vetti/socket/ChatWebSocketHandler.java | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/vetti-admin/src/main/java/com/vetti/socket/ChatWebSocketHandler.java b/vetti-admin/src/main/java/com/vetti/socket/ChatWebSocketHandler.java index 306d34c..244bb87 100644 --- a/vetti-admin/src/main/java/com/vetti/socket/ChatWebSocketHandler.java +++ b/vetti-admin/src/main/java/com/vetti/socket/ChatWebSocketHandler.java @@ -278,7 +278,6 @@ public class ChatWebSocketHandler { } } else if ("end".equals(resultFlag)) { //暂时的业务逻辑 - //发送面试官结束语音流 String openingPathUrl = RuoYiConfig.getProfile() + VOICE_SYSTEM_DIR + "end.wav"; try { @@ -298,7 +297,7 @@ public class ChatWebSocketHandler { String msgMapData = cacheMsgMapData.get(session.getId()); if (StrUtil.isNotEmpty(msgMapData)) { List list = JSONUtil.toList(msgMapData, Map.class); - //获取最后一条数据记录 + //获取第一条数据记录 Map mapEntity = list.get(0); //更新问题记录 mapEntity.put("role", "system"); @@ -311,8 +310,8 @@ public class ChatWebSocketHandler { ChatGPTClient gptClient = SpringUtils.getBean(ChatGPTClient.class); String resultMsg = gptClient.handleAiChat(promptJson, "QA"); Map resultEntity = new HashMap<>(); - resultEntity.put("msg", resultMsg); - resultEntity.put("dataType", "score"); + resultEntity.put("content", resultMsg); + resultEntity.put("type", "score"); session.getBasicRemote().sendText(JSONUtil.toJsonStr(resultEntity)); } } @@ -338,6 +337,8 @@ public class ChatWebSocketHandler { cacheMsgMapData.put(session.getId(), ""); //初始化面试问题 cacheQuestionResult.put(session.getId(), ""); + + cacheScoreResult.put(session.getId(), null); } // 发生错误时调用 @@ -466,8 +467,8 @@ public class ChatWebSocketHandler { //结束回答要清空问答数据 cacheMsgMapData.put(session.getId(), ""); Map resultEntity = new HashMap<>(); - resultEntity.put("msg", content); - resultEntity.put("dataType", "score"); + resultEntity.put("content", content); + resultEntity.put("type", "score"); session.getBasicRemote().sendText(JSONUtil.toJsonStr(resultEntity)); } catch (Exception e) {