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 79ffdb1..085e5a7 100644 --- a/vetti-admin/src/main/java/com/vetti/socket/ChatWebSocketHandler.java +++ b/vetti-admin/src/main/java/com/vetti/socket/ChatWebSocketHandler.java @@ -382,7 +382,7 @@ public class ChatWebSocketHandler { Map mapEntity = list.get(0); //更新问题记录 mapEntity.put("role", "system"); - mapEntity.put("content", "You are a construction industry interview expert. Rate candidate responses on a 1-5 scale and analyze key signals."); + mapEntity.put("content", "You are a construction industry interview expert. Evaluate candidate responses and provide scores (1-5) and follow-up questions when needed. Always respond in JSON format."); //每个回答的内容前面要加上候选人的职位 if (StrUtil.isNotEmpty(position)) { for (Map map : list) { @@ -399,8 +399,14 @@ public class ChatWebSocketHandler { log.info("结束AI提示词为:{}", promptJson); ChatGPTClient gptClient = SpringUtils.getBean(ChatGPTClient.class); String resultMsg = gptClient.handleAiChat(promptJson, "QA"); + //开始解析返回结果 + Map mapResultData = JSONUtil.toBean(resultMsg,Map.class); + //获取评分 + Object scoreStr = mapResultData.get("score"); + Object assessment = mapResultData.get("assessment"); + Map resultEntity = new HashMap<>(); - resultEntity.put("content", resultMsg); + resultEntity.put("content", scoreStr +"\n"+assessment); resultEntity.put("type", "score"); try{ //返回最终的评分结构