返回结构修改
This commit is contained in:
@@ -278,7 +278,6 @@ public class ChatWebSocketHandler {
|
|||||||
}
|
}
|
||||||
} else if ("end".equals(resultFlag)) {
|
} else if ("end".equals(resultFlag)) {
|
||||||
//暂时的业务逻辑
|
//暂时的业务逻辑
|
||||||
|
|
||||||
//发送面试官结束语音流
|
//发送面试官结束语音流
|
||||||
String openingPathUrl = RuoYiConfig.getProfile() + VOICE_SYSTEM_DIR + "end.wav";
|
String openingPathUrl = RuoYiConfig.getProfile() + VOICE_SYSTEM_DIR + "end.wav";
|
||||||
try {
|
try {
|
||||||
@@ -298,7 +297,7 @@ public class ChatWebSocketHandler {
|
|||||||
String msgMapData = cacheMsgMapData.get(session.getId());
|
String msgMapData = cacheMsgMapData.get(session.getId());
|
||||||
if (StrUtil.isNotEmpty(msgMapData)) {
|
if (StrUtil.isNotEmpty(msgMapData)) {
|
||||||
List<Map> list = JSONUtil.toList(msgMapData, Map.class);
|
List<Map> list = JSONUtil.toList(msgMapData, Map.class);
|
||||||
//获取最后一条数据记录
|
//获取第一条数据记录
|
||||||
Map<String, String> mapEntity = list.get(0);
|
Map<String, String> mapEntity = list.get(0);
|
||||||
//更新问题记录
|
//更新问题记录
|
||||||
mapEntity.put("role", "system");
|
mapEntity.put("role", "system");
|
||||||
@@ -311,8 +310,8 @@ public class ChatWebSocketHandler {
|
|||||||
ChatGPTClient gptClient = SpringUtils.getBean(ChatGPTClient.class);
|
ChatGPTClient gptClient = SpringUtils.getBean(ChatGPTClient.class);
|
||||||
String resultMsg = gptClient.handleAiChat(promptJson, "QA");
|
String resultMsg = gptClient.handleAiChat(promptJson, "QA");
|
||||||
Map<String, String> resultEntity = new HashMap<>();
|
Map<String, String> resultEntity = new HashMap<>();
|
||||||
resultEntity.put("msg", resultMsg);
|
resultEntity.put("content", resultMsg);
|
||||||
resultEntity.put("dataType", "score");
|
resultEntity.put("type", "score");
|
||||||
session.getBasicRemote().sendText(JSONUtil.toJsonStr(resultEntity));
|
session.getBasicRemote().sendText(JSONUtil.toJsonStr(resultEntity));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -338,6 +337,8 @@ public class ChatWebSocketHandler {
|
|||||||
cacheMsgMapData.put(session.getId(), "");
|
cacheMsgMapData.put(session.getId(), "");
|
||||||
//初始化面试问题
|
//初始化面试问题
|
||||||
cacheQuestionResult.put(session.getId(), "");
|
cacheQuestionResult.put(session.getId(), "");
|
||||||
|
|
||||||
|
cacheScoreResult.put(session.getId(), null);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 发生错误时调用
|
// 发生错误时调用
|
||||||
@@ -466,8 +467,8 @@ public class ChatWebSocketHandler {
|
|||||||
//结束回答要清空问答数据
|
//结束回答要清空问答数据
|
||||||
cacheMsgMapData.put(session.getId(), "");
|
cacheMsgMapData.put(session.getId(), "");
|
||||||
Map<String, String> resultEntity = new HashMap<>();
|
Map<String, String> resultEntity = new HashMap<>();
|
||||||
resultEntity.put("msg", content);
|
resultEntity.put("content", content);
|
||||||
resultEntity.put("dataType", "score");
|
resultEntity.put("type", "score");
|
||||||
session.getBasicRemote().sendText(JSONUtil.toJsonStr(resultEntity));
|
session.getBasicRemote().sendText(JSONUtil.toJsonStr(resultEntity));
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
|||||||
Reference in New Issue
Block a user