From 8c2a543bbb1d43a6eafcfab6c32d8eda2e68cbb9 Mon Sep 17 00:00:00 2001 From: PL <774412461@qq.com> Date: Wed, 16 Oct 2024 11:42:27 +0800 Subject: [PATCH 01/11] =?UTF-8?q?=E5=A4=84=E7=90=86=E8=AF=84=E8=AF=AD?= =?UTF-8?q?=E6=99=BA=E8=82=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../teammodel/model/dto/ai/ChatModelDto.java | 6 +- .../model/dto/ai/comment/ChatCommentsDto.java | 6 + .../service/impl/ChatMessageServiceImpl.java | 381 +++++++++--------- src/main/resources/Json/ChatModel.json | 34 +- 4 files changed, 212 insertions(+), 215 deletions(-) diff --git a/src/main/java/cn/teammodel/model/dto/ai/ChatModelDto.java b/src/main/java/cn/teammodel/model/dto/ai/ChatModelDto.java index 9a5dc5f..298edd4 100644 --- a/src/main/java/cn/teammodel/model/dto/ai/ChatModelDto.java +++ b/src/main/java/cn/teammodel/model/dto/ai/ChatModelDto.java @@ -12,10 +12,10 @@ import java.util.List; public class ChatModelDto { public String type; public String name; - public String role; - public String chat; + public ArrayList role; + public ArrayList chat; public ArrayList cycleChats; - public String end; + public ArrayList end; } diff --git a/src/main/java/cn/teammodel/model/dto/ai/comment/ChatCommentsDto.java b/src/main/java/cn/teammodel/model/dto/ai/comment/ChatCommentsDto.java index c4bc272..e37d233 100644 --- a/src/main/java/cn/teammodel/model/dto/ai/comment/ChatCommentsDto.java +++ b/src/main/java/cn/teammodel/model/dto/ai/comment/ChatCommentsDto.java @@ -32,6 +32,12 @@ public class ChatCommentsDto { * 评语重复次数 */ private int repeat; + + /* + * 评语阶段 + */ + private int phase; + /** * 返回评语大概字数 */ diff --git a/src/main/java/cn/teammodel/service/impl/ChatMessageServiceImpl.java b/src/main/java/cn/teammodel/service/impl/ChatMessageServiceImpl.java index 52137ee..0195017 100644 --- a/src/main/java/cn/teammodel/service/impl/ChatMessageServiceImpl.java +++ b/src/main/java/cn/teammodel/service/impl/ChatMessageServiceImpl.java @@ -76,6 +76,7 @@ public class ChatMessageServiceImpl implements ChatMessageService { try { // 目前仅使用讯飞星火大模型 String appId = chatCommentsDto.getAppId(); + // 获取模板文本 String text = commentsTemplate(chatCommentsDto); if (!StringUtils.isEmpty(text)) { chatCommentsDto.setText(text); @@ -300,232 +301,220 @@ public class ChatMessageServiceImpl implements ChatMessageService { * @return */ private String commentsTemplate(ChatCommentsDto chatCommentsDto) { - StringBuilder builder = new StringBuilder(); - String strData = JSON.toJSONString(chatCommentsDto.getData()); - List chatModels = new ArrayList<>(); - ChatModelDto chatModel = null; - // 获取模型数据 - chatModels = jsonLoader.myJsonDataBean(); - - /* - //验证获取模型数据 异常问题 try { - String fileText = FileUtil.getFileText("Json/ChatModel.json"); - String jsonData = JSON.toJSONString(fileText); - //获取聊天字段中的数据 - Object obj = JSON.parseObject(jsonData).get("chatModel"); - String jsonData01 = JSON.toJSONString(obj); - //转换方式 - chatModels = JSON.parseObject(jsonData01, new TypeReference>() {}); + StringBuilder builder = new StringBuilder(); + String strData = JSON.toJSONString(chatCommentsDto.getData()); + //检查是否角色 + int phase = Math.max(chatCommentsDto.getPhase(), 0); + List chatModels = new ArrayList<>(); + ChatModelDto chatModel = null; + // 获取模型数据 + chatModels = jsonLoader.myJsonDataBean(); + //循环查找对应的模型数据 + for (ChatModelDto chatModelTemp : chatModels) { + //判断评语类型 + if (chatCommentsDto.getType().equals(chatModelTemp.getType())) { + chatModel = chatModelTemp; + break; + } + } - log.info("获取地址fileText:"+fileText+"----文件内容Data:"+ jsonData +"----获取模型集合Object:" + obj +"----获取模型集合String:"+ jsonData01 +"----获取模型集合机构:"+chatModels); - } catch (Exception e) { - throw new ServiceException(ErrorCode.OPERATION_ERROR.getCode(), "读取文件" + Arrays.toString(e.getStackTrace()) + e.getMessage()); - }*/ + if (chatModel != null) { + String role = ""; + if (phase > 2){ + role = chatModel.getRole().get(0); + }else + { + role = chatModel.getRole().get(1); + } - //循环查找对应的模型数据 - for (ChatModelDto chatModelTemp : chatModels) { - //判断评语类型 - if (chatCommentsDto.getType().equals(chatModelTemp.getType())) { - chatModel = chatModelTemp; - break; + //角色条件 + builder.append(String.format(chatModel.getRole().get(phase), chatCommentsDto.getPeriod(), chatCommentsDto.getSubject())); } - } - - if (chatModel != null) { - //角色条件 - builder.append(String.format(chatModel.getRole(), chatCommentsDto.getPeriod(), chatCommentsDto.getSubject())); - } - ChatModelDto finalChatModel = chatModel; - //模版 - switch (chatCommentsDto.getType()) { - //智育 总体评语模版 - case "wisdom": { - WisdomCommentsDto wisdomComments; - //转换问题 - try { - //转换方式 - wisdomComments = JSON.parseObject(strData, WisdomCommentsDto.class); - } catch (Exception e) { - throw new ServiceException(ErrorCode.PARAMS_ERROR.getCode(), "类型转换失败"); - } - if (wisdomComments.getName() == null) { - throw new ServiceException(ErrorCode.PARAMS_ERROR.getCode(), "请求参数异常"); - } + ChatModelDto finalChatModel = chatModel; + //模版 + switch (chatCommentsDto.getType()) { + //智育 总体评语模版 + case "wisdom": { + WisdomCommentsDto wisdomComments; + //转换问题 + try { + //转换方式 + wisdomComments = JSON.parseObject(strData, WisdomCommentsDto.class); + } catch (Exception e) { + throw new ServiceException(ErrorCode.PARAMS_ERROR.getCode(), "类型转换失败"); + } + if (wisdomComments.getName() == null) { + throw new ServiceException(ErrorCode.PARAMS_ERROR.getCode(), "请求参数异常"); + } - // 使用String.format方法生成最终的字符串 - builder.append(String.format( - finalChatModel.getChat(), - wisdomComments.getName(), - wisdomComments.getYear(), - wisdomComments.getSemester(), - wisdomComments.getJoinAll(), - wisdomComments.getLessonMiddle(), - wisdomComments.getOnLine(), - wisdomComments.getMarking(), - wisdomComments.getLevel(), - wisdomComments.getProportion(), - wisdomComments.getName() - )); - /* - //有平均分 - builder.append(String.format( - finalChatModel.getChat(), - wisdomComments.getName(), - wisdomComments.getYear(), - wisdomComments.getSemester(), - wisdomComments.getJoinAll(), - wisdomComments.getLessonMiddle(), - wisdomComments.getOnLine(), - wisdomComments.getMarking(), - wisdomComments.getAverage(), - wisdomComments.getLevel(), - wisdomComments.getProportion(), - wisdomComments.getName() - ));*/ - wisdomComments.getDims().forEach(item -> { - builder.append(String.format(finalChatModel.getCycleChats().get(0), - item.name, - item.data[0], - item.data[1], - item.data[2], - item.data[3], - item.data[4] + String chat = phase > 0 ? finalChatModel.getChat().get(1) : finalChatModel.getChat().get(0); + String cycleChat = finalChatModel.getCycleChats().get(0); + + // 使用String.format方法生成最终的字符串 + builder.append(String.format( + chat, + wisdomComments.getName(), + wisdomComments.getYear(), + wisdomComments.getSemester(), + wisdomComments.getJoinAll(), + wisdomComments.getLessonMiddle(), + wisdomComments.getOnLine(), + wisdomComments.getMarking(), + wisdomComments.getLevel(), + wisdomComments.getProportion(), + wisdomComments.getName() )); - }); - builder.append(String.format(finalChatModel.getEnd(), wisdomComments.getName())); - break; - } - //智育 表现模版 - case "wisdomExam": { - List examComments = new ArrayList<>(); - try { - examComments = JSON.parseObject(strData, new TypeReference>() { + wisdomComments.getDims().forEach(item -> { + if(item.data.length >= 4) + { + builder.append(String.format(cycleChat, + item.name, + item.data[0], + item.data[1], + item.data[2], + item.data[3], + item.data[4] + )); + } }); - } catch (Exception e) { - throw new ServiceException(ErrorCode.PARAMS_ERROR.getCode(), "类型转换失败"); + builder.append(String.format(finalChatModel.getEnd().get(0), wisdomComments.getDims().size())); + break; } - if (examComments.size() <= 1) { - if (examComments.isEmpty()) { - throw new ServiceException(ErrorCode.PARAMS_ERROR.getCode(), "请求参数异常"); + //智育 表现模版 + case "wisdomExam": { + List examComments = new ArrayList<>(); + try { + examComments = JSON.parseObject(strData, new TypeReference>() { + }); + } catch (Exception e) { + throw new ServiceException(ErrorCode.PARAMS_ERROR.getCode(), "类型转换失败"); } - if (examComments.get(0).name == null) { - throw new ServiceException(ErrorCode.PARAMS_ERROR.getCode(), "请求参数异常"); + if (examComments.size() <= 1) { + if (examComments.isEmpty()) { + throw new ServiceException(ErrorCode.PARAMS_ERROR.getCode(), "请求参数异常"); + } + if (examComments.get(0).name == null) { + throw new ServiceException(ErrorCode.PARAMS_ERROR.getCode(), "请求参数异常"); + } } - } - int count = 1; - for (WisdomExamCommentsDto examComment : examComments) { - builder.append(String.format(finalChatModel.getCycleChats().get(0), count, examComment.getName(), - examComment.getTime(), examComment.getScore(), examComment.getScoreRate(), - examComment.getRanking())); - if (count < examComments.size()) { - count++; + int count = 1; + for (WisdomExamCommentsDto examComment : examComments) { + builder.append(String.format(finalChatModel.getCycleChats().get(0), count, examComment.getName(), + examComment.getTime(), examComment.getScore(), examComment.getScoreRate(), + examComment.getRanking())); + if (count < examComments.size()) { + count++; + } } + builder.append(String.format(finalChatModel.getEnd().get(0), count)); + break; } - builder.append(String.format(finalChatModel.getEnd(), count)); - break; - } - // 智育 学科评语模版 - case "windomSubject": { - List subjectComments; - try { - subjectComments = JSON.parseObject(strData, new TypeReference>() { - }); - } catch (Exception e) { - throw new ServiceException(ErrorCode.PARAMS_ERROR.getCode(), "请求参数异常"); - } - if (subjectComments.size() <= 1) { + // 智育 学科评语模版 + case "wisdomSubject": { + List subjectComments; + try { + subjectComments = JSON.parseObject(strData, new TypeReference>() { + }); + } catch (Exception e) { + throw new ServiceException(ErrorCode.PARAMS_ERROR.getCode(), "请求参数异常"); + } if (subjectComments.isEmpty()) { throw new ServiceException(ErrorCode.PARAMS_ERROR.getCode(), "请求参数异常"); } - } - builder.append(finalChatModel.getChat()); - String name = ""; - //拼接学科数组 - for (WisdomSubjectComments comments : subjectComments) { - builder.append(String.format(finalChatModel.getCycleChats().get(0), comments.subjectName)); - for (WisdomSubjectComments.StuInfo stuInfo : comments.getRankings()) { - builder.append(String.format(finalChatModel.getCycleChats().get(1), stuInfo.ranking,stuInfo.name, stuInfo.scoreRate*100)); + builder.append(finalChatModel.getChat()); + String name = ""; + //拼接学科数组 + for (WisdomSubjectComments comments : subjectComments) { + builder.append(String.format(finalChatModel.getCycleChats().get(0), comments.subjectName)); + for (WisdomSubjectComments.StuInfo stuInfo : comments.getRankings()) { + builder.append(String.format(finalChatModel.getCycleChats().get(1), stuInfo.ranking,stuInfo.name, stuInfo.scoreRate*100)); + } + if (phase == 0) { + name = comments.getClaasRanking().name; + builder.append(String.format(finalChatModel.getCycleChats().get(2), name, comments.getClaasRanking().ranking, comments.getClaasRanking().scoreRate * 100, comments.getClaasRanking().average * 100)); + } } - name = comments.getClaasRanking().name; - builder.append(String.format(finalChatModel.getCycleChats().get(2),name,comments.getClaasRanking().ranking, comments.getClaasRanking().scoreRate * 100,comments.getClaasRanking().average * 100)); - } - builder.append(String.format(finalChatModel.getEnd(), subjectComments.size(),name)); - break; - } - //艺术 考核指标纬度评语 - case "artLatitude":{ - List artLatitudes; - try { - artLatitudes = JSON.parseObject(strData, new TypeReference>() { - }); - } catch (Exception e) { - throw new ServiceException(ErrorCode.PARAMS_ERROR.getCode(), "请求参数异常"); + builder.append(String.format(finalChatModel.getEnd().get(0), subjectComments.size(),name)); + break; } - if (artLatitudes.size() <= 1) { - if (artLatitudes.isEmpty()) { + //艺术 考核指标纬度评语 + case "artLatitude":{ + List artLatitudes; + try { + artLatitudes = JSON.parseObject(strData, new TypeReference>() { + }); + } catch (Exception e) { throw new ServiceException(ErrorCode.PARAMS_ERROR.getCode(), "请求参数异常"); } - } - builder.append(finalChatModel.getChat()); - for (ArtLatitudeDto artLatitude : artLatitudes) - { - builder.append(String.format(finalChatModel.getCycleChats().get(0), artLatitude.getQuotaN1(),artLatitude.getQuotaP1(), artLatitude.getQuotaN2(),artLatitude.getQuotaP2(), artLatitude.getQuotaN3(),artLatitude.getQuotaP3(), artLatitude.getPercent(),artLatitude.getLevel())); - } + if (artLatitudes.size() <= 1) { + if (artLatitudes.isEmpty()) { + throw new ServiceException(ErrorCode.PARAMS_ERROR.getCode(), "请求参数异常"); + } + } + builder.append(finalChatModel.getChat()); + for (ArtLatitudeDto artLatitude : artLatitudes) + { + builder.append(String.format(finalChatModel.getCycleChats().get(0), artLatitude.getQuotaN1(),artLatitude.getQuotaP1(), artLatitude.getQuotaN2(),artLatitude.getQuotaP2(), artLatitude.getQuotaN3(),artLatitude.getQuotaP3(), artLatitude.getPercent(),artLatitude.getLevel())); + } - builder.append(finalChatModel.getEnd()); - break; - } - //艺术 学科评语模版 - case "artSubject":{ - List artSubjects; - try { - artSubjects = JSON.parseObject(strData, new TypeReference>() { - }); - } catch (Exception e) { - throw new ServiceException(ErrorCode.PARAMS_ERROR.getCode(), "请求参数异常"); + builder.append(finalChatModel.getEnd()); + break; } - if (artSubjects.size() <= 1) { - if (artSubjects.isEmpty()) { + //艺术 学科评语模版 + case "artSubject":{ + List artSubjects; + try { + artSubjects = JSON.parseObject(strData, new TypeReference>() { + }); + } catch (Exception e) { throw new ServiceException(ErrorCode.PARAMS_ERROR.getCode(), "请求参数异常"); } + if (artSubjects.size() <= 1) { + if (artSubjects.isEmpty()) { + throw new ServiceException(ErrorCode.PARAMS_ERROR.getCode(), "请求参数异常"); + } + } + builder.append(finalChatModel.getChat()); + for (ArtSubjectDto artSubject : artSubjects){ + builder.append(String.format(finalChatModel.getCycleChats().get(0), artSubject.getDimension(),artSubject.getBlock(), artSubject.getPoint(),artSubject.getScore(), artSubject.getTotalScore(),artSubject.getPercent())); + } + + builder.append(String.format(finalChatModel.getEnd().get(0),chatCommentsDto.getSubject())); + break; } - builder.append(finalChatModel.getChat()); - for (ArtSubjectDto artSubject : artSubjects){ - builder.append(String.format(finalChatModel.getCycleChats().get(0), artSubject.getDimension(),artSubject.getBlock(), artSubject.getPoint(),artSubject.getScore(), artSubject.getTotalScore(),artSubject.getPercent())); + //体育 + case "sport":{ + builder.append("请按照以下格式回复:\n"); + builder.append("1. 运动作品:\n"); + builder.append("2. 运动作品说明:\n"); + builder.append("3. 运动作品示例:\n"); + builder.append("4. 运动作品示例说明:\n"); + break; } + //德育 + case "moral":{ + builder.append(finalChatModel.getChat()); - builder.append(String.format(finalChatModel.getEnd(),chatCommentsDto.getSubject())); - break; - } - //体育 - case "sport":{ - builder.append("请按照以下格式回复:\n"); - builder.append("1. 运动作品:\n"); - builder.append("2. 运动作品说明:\n"); - builder.append("3. 运动作品示例:\n"); - builder.append("4. 运动作品示例说明:\n"); - break; + break; + } + default: + throw new ServiceException(ErrorCode.PARAMS_ERROR.getCode(), "评语类型异常"); } - //德育 - case "moral":{ - builder.append(finalChatModel.getChat()); - break; + if (chatCommentsDto.getSize() > 0) { + builder.append("限制条件:") + .append(chatCommentsDto.getSize()) + .append("字左右;【返回评语内容#不要开头提示语#】。"); + } else { + builder.append("字数限制在:200字左右;【#返回评语内容#,#不要内容提示语#】。"); } - default: - throw new ServiceException(ErrorCode.PARAMS_ERROR.getCode(), "评语类型异常"); - } - - if (chatCommentsDto.getSize() > 0) { - builder.append("字数限制在:") - .append(chatCommentsDto.getSize()) - .append("字左右"); - } else { - builder.append("字数限制在:200字左右"); + return builder.toString(); + } catch (Exception e) { + log.info(Arrays.toString(e.getStackTrace())); + log.error("{}-{}", e.getMessage(), Arrays.toString(e.getStackTrace())); + throw new ServiceException(ErrorCode.OPERATION_ERROR.getCode(), Arrays.toString(e.getStackTrace())); } - - return builder.toString(); } } diff --git a/src/main/resources/Json/ChatModel.json b/src/main/resources/Json/ChatModel.json index 3a6b353..846862e 100644 --- a/src/main/resources/Json/ChatModel.json +++ b/src/main/resources/Json/ChatModel.json @@ -3,42 +3,44 @@ { "type": "wisdom", "name": "智育 总体评语模版", - "role": "请扮演[%s%s]老师角色\n", - "chat": "%s同学,在%s学年度,第%s学期中,共计参加了%s次评测,其中课中评测%s次、线上评测%s次、阅卷评测%s次,素养等级为%s,已超过班级%s%% 同学。\n %s同学总体表现:", + "role": ["请扮演[%s%s]老师角色\n","请扮演[%s%s]老师角色\n"], + "chat": ["%s同学,在%s学年度,第%s学期中,共计参加了%s次评测,其中课中评测%s次、线上评测%s次、阅卷评测%s次,素养等级为%s,已超过班级%s%% 的同学。\n %s同学的总体表现:", + "%s,在%s学年度,第%s学期,共计参加了%s次评测,其中课中评测%s次、线上评测%s次、阅卷评测%s次,总体表现:" + ], "cycleChats": ["在%s中:学习态度为:%s、学习成效:%s、合作能力:%s、评价能力:%s、评价能力:%s ;\n"], - "end": "根据我提供的数据,对这 %s 次考试成绩表现做一个评价\n" + "end": ["根据我提供的数据,对这 %s 次考试成绩表现做一个评价\n"] }, { "type": "wisdomExam", "name": "智育 成绩表现模版", - "role": "请扮演[%s%s]老师角色\n", - "chat": "", + "role": ["请扮演[%s%s]老师角色\n","请扮演[%s%s]老师角色\n"], + "chat": [""], "cycleChats": ["参加第%s次,考试结果:名称:%s,时间:%s,得分:%s,考试得分率:%s %% 排名:%s ;\n"], - "end": "根据我提供的数据,对这 %s 次考试成绩表现做一个评价。\n" + "end": ["根据我提供的数据,对这 %s 次考试成绩表现做一个评价。\n"] }, { - "type": "windomSubject", + "type": "wisdomSubject", "name": "智育 学科评语模版", - "role": "请扮演[%s%s]老师角色\n ", - "chat": "各科评测表现", + "role": ["请扮演[%s%s]老师角色\n ","请扮演[%s%s]老师角色\n"], + "chat": ["各科评测表现"], "cycleChats":["科目:%s 班级top10"," 排名:%s,姓名:%s,得分率:%s %% ,\n " ,"%s在班级排名:%s,得分率:%s %%,排在班级平均得分率:(%s %%)"], - "end": "根据我提供的数据,对这%s门学科,【%s】在班级中的表现做一个评价。 \n" + "end": ["根据我提供的数据,对这%s门学科,【%s】在班级中的表现做一个评价。 \n"] }, { "type": "artLatitude", "name": "艺术 考核指标评语模版", - "role": "请扮演[%s%s]老师角色\n ", - "chat": "考核指标评纬度\n", + "role": ["请扮演[%s%s]老师角色\n ","请扮演[%s%s]老师角色\n"], + "chat": ["考核指标评纬度\n"], "cycleChats": [" 一级指标:%s( %s %%);二级指标:%s( %s %%);三级指标 %s( %s %%) ;得分率:%s %% 等级:%s\n"], - "end": "根据我提供的【考核指标纬度】做一个整体的评价。 \n" + "end": ["根据我提供的【考核指标纬度】做一个整体的评价。 \n"] }, { "type": "artSubject", "name": "艺术 学科评语模版", - "role": "请扮演[%s%s]老师角色\n ", - "chat": "%s学科\n", + "role": ["请扮演[%s%s]老师角色\n ","请扮演[%s%s]年级老师角色\n"], + "chat": ["%s学科\n"], "cycleChats": [" 考核纬度:%s;一级知识点:%s;二级知识点 %s;得分:%s/%s 得分率:%s\n"], - "end": "根据我提供的【%s学科】的表现做一个整体的评价。 \n" + "end": ["根据我提供的【%s学科】的表现做一个整体的评价。 \n"] } ] } From 50f94cb38ae3827ec9be4a57e3eefcbe8cd54fb7 Mon Sep 17 00:00:00 2001 From: PL <774412461@qq.com> Date: Wed, 16 Oct 2024 12:06:38 +0800 Subject: [PATCH 02/11] =?UTF-8?q?=E5=A4=84=E7=90=86=E9=99=90=E5=88=B6?= =?UTF-8?q?=E6=9D=A1=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../cn/teammodel/service/impl/ChatMessageServiceImpl.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/java/cn/teammodel/service/impl/ChatMessageServiceImpl.java b/src/main/java/cn/teammodel/service/impl/ChatMessageServiceImpl.java index 0195017..08a0315 100644 --- a/src/main/java/cn/teammodel/service/impl/ChatMessageServiceImpl.java +++ b/src/main/java/cn/teammodel/service/impl/ChatMessageServiceImpl.java @@ -504,11 +504,11 @@ public class ChatMessageServiceImpl implements ChatMessageService { } if (chatCommentsDto.getSize() > 0) { - builder.append("限制条件:") + builder.append("限制条件如下:1、") .append(chatCommentsDto.getSize()) - .append("字左右;【返回评语内容#不要开头提示语#】。"); + .append("字左右;2、[#返回评语内容#,#不要开头提示语#,#开头不出现特殊字符#]。"); } else { - builder.append("字数限制在:200字左右;【#返回评语内容#,#不要内容提示语#】。"); + builder.append("限制条件如下:1、200字左右;2、[#返回评语内容#,#不要开头提示语#,#开头不出现特殊字符#]。"); } return builder.toString(); } catch (Exception e) { From 469f19384b3682afe1a1344f15717364a6e2fcf0 Mon Sep 17 00:00:00 2001 From: PL <774412461@qq.com> Date: Thu, 17 Oct 2024 14:59:52 +0800 Subject: [PATCH 03/11] =?UTF-8?q?update=EF=BC=9A=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E5=90=8D=E7=A7=B0=E5=8F=82=E6=95=B0=EF=BC=8C=E5=B9=B6=E5=A4=84?= =?UTF-8?q?=E7=90=86=E8=AF=84=E8=AF=AD=E8=AF=9D=E6=9C=AF=EF=BC=8C=E4=B8=8E?= =?UTF-8?q?=E6=9D=A1=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../model/dto/ai/comment/ChatCommentsDto.java | 5 ++++ .../service/impl/ChatMessageServiceImpl.java | 26 +++++++------------ src/main/resources/Json/ChatModel.json | 26 +++++++++---------- 3 files changed, 27 insertions(+), 30 deletions(-) diff --git a/src/main/java/cn/teammodel/model/dto/ai/comment/ChatCommentsDto.java b/src/main/java/cn/teammodel/model/dto/ai/comment/ChatCommentsDto.java index e37d233..d18ed59 100644 --- a/src/main/java/cn/teammodel/model/dto/ai/comment/ChatCommentsDto.java +++ b/src/main/java/cn/teammodel/model/dto/ai/comment/ChatCommentsDto.java @@ -33,6 +33,11 @@ public class ChatCommentsDto { */ private int repeat; + /** + * 名称 + */ + private String name; + /* * 评语阶段 */ diff --git a/src/main/java/cn/teammodel/service/impl/ChatMessageServiceImpl.java b/src/main/java/cn/teammodel/service/impl/ChatMessageServiceImpl.java index 08a0315..7956adc 100644 --- a/src/main/java/cn/teammodel/service/impl/ChatMessageServiceImpl.java +++ b/src/main/java/cn/teammodel/service/impl/ChatMessageServiceImpl.java @@ -320,16 +320,8 @@ public class ChatMessageServiceImpl implements ChatMessageService { } if (chatModel != null) { - String role = ""; - if (phase > 2){ - role = chatModel.getRole().get(0); - }else - { - role = chatModel.getRole().get(1); - } - //角色条件 - builder.append(String.format(chatModel.getRole().get(phase), chatCommentsDto.getPeriod(), chatCommentsDto.getSubject())); + builder.append(String.format(chatModel.getRole().get(0), chatCommentsDto.getPeriod(), chatCommentsDto.getSubject())); } ChatModelDto finalChatModel = chatModel; @@ -355,7 +347,7 @@ public class ChatMessageServiceImpl implements ChatMessageService { // 使用String.format方法生成最终的字符串 builder.append(String.format( chat, - wisdomComments.getName(), + chatCommentsDto.getName(), wisdomComments.getYear(), wisdomComments.getSemester(), wisdomComments.getJoinAll(), @@ -400,6 +392,8 @@ public class ChatMessageServiceImpl implements ChatMessageService { } } int count = 1; + //昵称 + builder.append(String.format(finalChatModel.getChat().get(0), chatCommentsDto.getName())); for (WisdomExamCommentsDto examComment : examComments) { builder.append(String.format(finalChatModel.getCycleChats().get(0), count, examComment.getName(), examComment.getTime(), examComment.getScore(), examComment.getScoreRate(), @@ -423,7 +417,7 @@ public class ChatMessageServiceImpl implements ChatMessageService { if (subjectComments.isEmpty()) { throw new ServiceException(ErrorCode.PARAMS_ERROR.getCode(), "请求参数异常"); } - builder.append(finalChatModel.getChat()); + builder.append(String.format(finalChatModel.getChat().get(0), chatCommentsDto.getName())); String name = ""; //拼接学科数组 for (WisdomSubjectComments comments : subjectComments) { @@ -453,7 +447,7 @@ public class ChatMessageServiceImpl implements ChatMessageService { throw new ServiceException(ErrorCode.PARAMS_ERROR.getCode(), "请求参数异常"); } } - builder.append(finalChatModel.getChat()); + builder.append(String.format(finalChatModel.getChat().get(0), chatCommentsDto.getName())); for (ArtLatitudeDto artLatitude : artLatitudes) { builder.append(String.format(finalChatModel.getCycleChats().get(0), artLatitude.getQuotaN1(),artLatitude.getQuotaP1(), artLatitude.getQuotaN2(),artLatitude.getQuotaP2(), artLatitude.getQuotaN3(),artLatitude.getQuotaP3(), artLatitude.getPercent(),artLatitude.getLevel())); @@ -466,8 +460,7 @@ public class ChatMessageServiceImpl implements ChatMessageService { case "artSubject":{ List artSubjects; try { - artSubjects = JSON.parseObject(strData, new TypeReference>() { - }); + artSubjects = JSON.parseObject(strData, new TypeReference>() {}); } catch (Exception e) { throw new ServiceException(ErrorCode.PARAMS_ERROR.getCode(), "请求参数异常"); } @@ -496,7 +489,6 @@ public class ChatMessageServiceImpl implements ChatMessageService { //德育 case "moral":{ builder.append(finalChatModel.getChat()); - break; } default: @@ -506,9 +498,9 @@ public class ChatMessageServiceImpl implements ChatMessageService { if (chatCommentsDto.getSize() > 0) { builder.append("限制条件如下:1、") .append(chatCommentsDto.getSize()) - .append("字左右;2、[#返回评语内容#,#不要开头提示语#,#开头不出现特殊字符#]。"); + .append("字左右;2、返回评语内容,不要开头提示语,开头不出现特殊字符。"); } else { - builder.append("限制条件如下:1、200字左右;2、[#返回评语内容#,#不要开头提示语#,#开头不出现特殊字符#]。"); + builder.append("限制条件如下:1、200字左右;2、返回评语内容;不要开头提示语;开头允许出现特殊字符。"); } return builder.toString(); } catch (Exception e) { diff --git a/src/main/resources/Json/ChatModel.json b/src/main/resources/Json/ChatModel.json index 846862e..b7baa58 100644 --- a/src/main/resources/Json/ChatModel.json +++ b/src/main/resources/Json/ChatModel.json @@ -3,44 +3,44 @@ { "type": "wisdom", "name": "智育 总体评语模版", - "role": ["请扮演[%s%s]老师角色\n","请扮演[%s%s]老师角色\n"], + "role": ["请扮演[%s%s]老师角色;\n 数据如下:"], "chat": ["%s同学,在%s学年度,第%s学期中,共计参加了%s次评测,其中课中评测%s次、线上评测%s次、阅卷评测%s次,素养等级为%s,已超过班级%s%% 的同学。\n %s同学的总体表现:", "%s,在%s学年度,第%s学期,共计参加了%s次评测,其中课中评测%s次、线上评测%s次、阅卷评测%s次,总体表现:" ], "cycleChats": ["在%s中:学习态度为:%s、学习成效:%s、合作能力:%s、评价能力:%s、评价能力:%s ;\n"], - "end": ["根据我提供的数据,对这 %s 次考试成绩表现做一个评价\n"] + "end": ["请根据我提供的数据,对这 %s 次考试成绩表现做一个评价。\n"] }, { "type": "wisdomExam", "name": "智育 成绩表现模版", - "role": ["请扮演[%s%s]老师角色\n","请扮演[%s%s]老师角色\n"], - "chat": [""], + "role": ["请扮演[%s%s]老师角色;数据如下:\n"], + "chat": ["%s\n,"], "cycleChats": ["参加第%s次,考试结果:名称:%s,时间:%s,得分:%s,考试得分率:%s %% 排名:%s ;\n"], - "end": ["根据我提供的数据,对这 %s 次考试成绩表现做一个评价。\n"] + "end": ["请根据我提供的数据,对这 %s 次考试成绩表现做一个评价。\n"] }, { "type": "wisdomSubject", "name": "智育 学科评语模版", - "role": ["请扮演[%s%s]老师角色\n ","请扮演[%s%s]老师角色\n"], - "chat": ["各科评测表现"], + "role": ["请扮演[%s%s]老师角色; 数据如下:\n"], + "chat": ["%s各科评测表现"], "cycleChats":["科目:%s 班级top10"," 排名:%s,姓名:%s,得分率:%s %% ,\n " ,"%s在班级排名:%s,得分率:%s %%,排在班级平均得分率:(%s %%)"], - "end": ["根据我提供的数据,对这%s门学科,【%s】在班级中的表现做一个评价。 \n"] + "end": ["请根据我提供的数据,对这%s门学科,【%s】的表现做一个评价。 \n"] }, { "type": "artLatitude", "name": "艺术 考核指标评语模版", - "role": ["请扮演[%s%s]老师角色\n ","请扮演[%s%s]老师角色\n"], - "chat": ["考核指标评纬度\n"], + "role": ["请扮演[%s%s]老师角色;数据如下:\n"], + "chat": ["%s的考核指标评纬度\n"], "cycleChats": [" 一级指标:%s( %s %%);二级指标:%s( %s %%);三级指标 %s( %s %%) ;得分率:%s %% 等级:%s\n"], - "end": ["根据我提供的【考核指标纬度】做一个整体的评价。 \n"] + "end": ["请根据我提供的【考核指标纬度】做一个整体的评价。 \n"] }, { "type": "artSubject", "name": "艺术 学科评语模版", - "role": ["请扮演[%s%s]老师角色\n ","请扮演[%s%s]年级老师角色\n"], + "role": ["请扮演[%s%s]老师角色;数据如下:\n "], "chat": ["%s学科\n"], "cycleChats": [" 考核纬度:%s;一级知识点:%s;二级知识点 %s;得分:%s/%s 得分率:%s\n"], - "end": ["根据我提供的【%s学科】的表现做一个整体的评价。 \n"] + "end": ["请根据我提供的【%s学科】的表现做一个整体的评价。 \n"] } ] } From d1018c375c1aad46edf7de039012b019f8696146 Mon Sep 17 00:00:00 2001 From: PL <774412461@qq.com> Date: Fri, 18 Oct 2024 15:03:16 +0800 Subject: [PATCH 04/11] =?UTF-8?q?update:=E4=BC=98=E5=8C=96AI=E8=AF=84?= =?UTF-8?q?=E8=AF=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/frontend/AiController.java | 8 ----- .../service/impl/ChatMessageServiceImpl.java | 34 ++++++++++++++----- src/main/resources/Json/ChatModel.json | 8 ++--- 3 files changed, 29 insertions(+), 21 deletions(-) diff --git a/src/main/java/cn/teammodel/controller/frontend/AiController.java b/src/main/java/cn/teammodel/controller/frontend/AiController.java index 4f9b6b0..dae9a17 100644 --- a/src/main/java/cn/teammodel/controller/frontend/AiController.java +++ b/src/main/java/cn/teammodel/controller/frontend/AiController.java @@ -151,14 +151,6 @@ public class AiController { @PostMapping("chat/comments") @ApiOperation("设置评语") public SseEmitter chatComments(@RequestBody @Valid ChatCommentsDto chatCommentsDto) { - /* - Authentication user0 = SecurityUtil.getAuthentication(); - Object user01 = SecurityUtil.getAuthentication().getPrincipal(); - TmdUserDetail user02 = (TmdUserDetail) SecurityUtil.getAuthentication().getPrincipal(); - Claims user03 = ((TmdUserDetail) SecurityUtil.getAuthentication().getPrincipal()).getClaims(); - String user04 = ((TmdUserDetail) SecurityUtil.getAuthentication().getPrincipal()).getClaims().getSubject(); - */ - //String userId = ((TmdUserDetail) SecurityUtil.getAuthentication().getPrincipal()).getClaims().getSubject(); // 获取getClaims时为空 String userId = ((TmdUserDetail) SecurityUtil.getAuthentication().getPrincipal()).getUser().getId(); diff --git a/src/main/java/cn/teammodel/service/impl/ChatMessageServiceImpl.java b/src/main/java/cn/teammodel/service/impl/ChatMessageServiceImpl.java index 7956adc..196b4a1 100644 --- a/src/main/java/cn/teammodel/service/impl/ChatMessageServiceImpl.java +++ b/src/main/java/cn/teammodel/service/impl/ChatMessageServiceImpl.java @@ -392,8 +392,10 @@ public class ChatMessageServiceImpl implements ChatMessageService { } } int count = 1; - //昵称 - builder.append(String.format(finalChatModel.getChat().get(0), chatCommentsDto.getName())); + if(finalChatModel.getChat() != null && !chatCommentsDto.getName().isEmpty()){ + //昵称 + builder.append(String.format(finalChatModel.getChat().get(0), chatCommentsDto.getName())); + } for (WisdomExamCommentsDto examComment : examComments) { builder.append(String.format(finalChatModel.getCycleChats().get(0), count, examComment.getName(), examComment.getTime(), examComment.getScore(), examComment.getScoreRate(), @@ -409,15 +411,21 @@ public class ChatMessageServiceImpl implements ChatMessageService { case "wisdomSubject": { List subjectComments; try { - subjectComments = JSON.parseObject(strData, new TypeReference>() { - }); + subjectComments = JSON.parseObject(strData, new TypeReference>() {}); } catch (Exception e) { throw new ServiceException(ErrorCode.PARAMS_ERROR.getCode(), "请求参数异常"); } if (subjectComments.isEmpty()) { throw new ServiceException(ErrorCode.PARAMS_ERROR.getCode(), "请求参数异常"); } - builder.append(String.format(finalChatModel.getChat().get(0), chatCommentsDto.getName())); + if(finalChatModel.getChat() != null && !chatCommentsDto.getName().isEmpty()){ + builder.append(String.format(finalChatModel.getChat().get(1), chatCommentsDto.getName())); + } + else { + if (finalChatModel.getChat() != null) { + builder.append(finalChatModel.getChat().get(0)); + } + } String name = ""; //拼接学科数组 for (WisdomSubjectComments comments : subjectComments) { @@ -447,7 +455,13 @@ public class ChatMessageServiceImpl implements ChatMessageService { throw new ServiceException(ErrorCode.PARAMS_ERROR.getCode(), "请求参数异常"); } } - builder.append(String.format(finalChatModel.getChat().get(0), chatCommentsDto.getName())); + if(finalChatModel.getChat() != null && !chatCommentsDto.getName().isEmpty()) { + builder.append(String.format(finalChatModel.getChat().get(1), chatCommentsDto.getName())); + }else { + if (finalChatModel.getChat() != null) { + builder.append(finalChatModel.getChat().get(0)); + } + } for (ArtLatitudeDto artLatitude : artLatitudes) { builder.append(String.format(finalChatModel.getCycleChats().get(0), artLatitude.getQuotaN1(),artLatitude.getQuotaP1(), artLatitude.getQuotaN2(),artLatitude.getQuotaP2(), artLatitude.getQuotaN3(),artLatitude.getQuotaP3(), artLatitude.getPercent(),artLatitude.getLevel())); @@ -469,7 +483,7 @@ public class ChatMessageServiceImpl implements ChatMessageService { throw new ServiceException(ErrorCode.PARAMS_ERROR.getCode(), "请求参数异常"); } } - builder.append(finalChatModel.getChat()); + builder.append(String.format(finalChatModel.getChat().get(0), chatCommentsDto.getSubject())); for (ArtSubjectDto artSubject : artSubjects){ builder.append(String.format(finalChatModel.getCycleChats().get(0), artSubject.getDimension(),artSubject.getBlock(), artSubject.getPoint(),artSubject.getScore(), artSubject.getTotalScore(),artSubject.getPercent())); } @@ -498,9 +512,11 @@ public class ChatMessageServiceImpl implements ChatMessageService { if (chatCommentsDto.getSize() > 0) { builder.append("限制条件如下:1、") .append(chatCommentsDto.getSize()) - .append("字左右;2、返回评语内容,不要开头提示语,开头不出现特殊字符。"); + .append("字左右;2、返回评语内容;不要开头提示语;开头不允许出现特殊字符。"); + //.append("字左右;2、返回评语的内容: 评语的开篇不允许出现提示语;评语的开篇不允许出现特殊字符。"); } else { - builder.append("限制条件如下:1、200字左右;2、返回评语内容;不要开头提示语;开头允许出现特殊字符。"); + builder.append("限制条件如下:1、200字左右;2、返回评语内容;不要开头提示语;开头不允许出现特殊字符。"); + //builder.append("限制条件如下:1、200字左右;2、返回评语的内容: 评语的开篇不允许出现提示语;评语的开篇不允许出现特殊字符。"); } return builder.toString(); } catch (Exception e) { diff --git a/src/main/resources/Json/ChatModel.json b/src/main/resources/Json/ChatModel.json index b7baa58..2c61520 100644 --- a/src/main/resources/Json/ChatModel.json +++ b/src/main/resources/Json/ChatModel.json @@ -5,7 +5,7 @@ "name": "智育 总体评语模版", "role": ["请扮演[%s%s]老师角色;\n 数据如下:"], "chat": ["%s同学,在%s学年度,第%s学期中,共计参加了%s次评测,其中课中评测%s次、线上评测%s次、阅卷评测%s次,素养等级为%s,已超过班级%s%% 的同学。\n %s同学的总体表现:", - "%s,在%s学年度,第%s学期,共计参加了%s次评测,其中课中评测%s次、线上评测%s次、阅卷评测%s次,总体表现:" + "%s,在%s学年度,第%s学期,共计参加了%s次评测,其中课中评测%s次、线上评测%s次、阅卷评测%s次,总体表现如下:" ], "cycleChats": ["在%s中:学习态度为:%s、学习成效:%s、合作能力:%s、评价能力:%s、评价能力:%s ;\n"], "end": ["请根据我提供的数据,对这 %s 次考试成绩表现做一个评价。\n"] @@ -22,7 +22,7 @@ "type": "wisdomSubject", "name": "智育 学科评语模版", "role": ["请扮演[%s%s]老师角色; 数据如下:\n"], - "chat": ["%s各科评测表现"], + "chat": ["的各科评测表现:","%s的各科评测表现:\""], "cycleChats":["科目:%s 班级top10"," 排名:%s,姓名:%s,得分率:%s %% ,\n " ,"%s在班级排名:%s,得分率:%s %%,排在班级平均得分率:(%s %%)"], "end": ["请根据我提供的数据,对这%s门学科,【%s】的表现做一个评价。 \n"] }, @@ -30,7 +30,7 @@ "type": "artLatitude", "name": "艺术 考核指标评语模版", "role": ["请扮演[%s%s]老师角色;数据如下:\n"], - "chat": ["%s的考核指标评纬度\n"], + "chat": ["考核指标评纬度\n","%s的考核指标评纬度\n"], "cycleChats": [" 一级指标:%s( %s %%);二级指标:%s( %s %%);三级指标 %s( %s %%) ;得分率:%s %% 等级:%s\n"], "end": ["请根据我提供的【考核指标纬度】做一个整体的评价。 \n"] }, @@ -38,7 +38,7 @@ "type": "artSubject", "name": "艺术 学科评语模版", "role": ["请扮演[%s%s]老师角色;数据如下:\n "], - "chat": ["%s学科\n"], + "chat": ["%s的学科\n"], "cycleChats": [" 考核纬度:%s;一级知识点:%s;二级知识点 %s;得分:%s/%s 得分率:%s\n"], "end": ["请根据我提供的【%s学科】的表现做一个整体的评价。 \n"] } From dda1342731dea22377bfff6d725df6682111ed58 Mon Sep 17 00:00:00 2001 From: PL <774412461@qq.com> Date: Fri, 18 Oct 2024 15:54:21 +0800 Subject: [PATCH 05/11] =?UTF-8?q?update:=E4=BC=98=E5=8C=96AI=E8=AF=84?= =?UTF-8?q?=E8=AF=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../cn/teammodel/service/impl/ChatMessageServiceImpl.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main/java/cn/teammodel/service/impl/ChatMessageServiceImpl.java b/src/main/java/cn/teammodel/service/impl/ChatMessageServiceImpl.java index 196b4a1..7f145e0 100644 --- a/src/main/java/cn/teammodel/service/impl/ChatMessageServiceImpl.java +++ b/src/main/java/cn/teammodel/service/impl/ChatMessageServiceImpl.java @@ -512,11 +512,11 @@ public class ChatMessageServiceImpl implements ChatMessageService { if (chatCommentsDto.getSize() > 0) { builder.append("限制条件如下:1、") .append(chatCommentsDto.getSize()) - .append("字左右;2、返回评语内容;不要开头提示语;开头不允许出现特殊字符。"); - //.append("字左右;2、返回评语的内容: 评语的开篇不允许出现提示语;评语的开篇不允许出现特殊字符。"); + .append("字左右;2、直接返回评语的内容。"); } else { - builder.append("限制条件如下:1、200字左右;2、返回评语内容;不要开头提示语;开头不允许出现特殊字符。"); - //builder.append("限制条件如下:1、200字左右;2、返回评语的内容: 评语的开篇不允许出现提示语;评语的开篇不允许出现特殊字符。"); + builder.append("限制条件如下:1、200字左右;2、直接返回评语的内容。"); + //builder.append("限制条件如下:1、200字左右;2、返回评语内容:不要开头提示语;开头不允许出现特殊字符。"); + //builder.append("限制条件如下:1、200字左右;2、直接返回评语的内容;3、评语的开篇不允许出现提示语;4、评语的开篇不允许出现特殊字符。"); } return builder.toString(); } catch (Exception e) { From 817fe06787a5b705b628cb6b8dd87b3aa4c75001 Mon Sep 17 00:00:00 2001 From: PL <774412461@qq.com> Date: Fri, 18 Oct 2024 16:40:12 +0800 Subject: [PATCH 06/11] =?UTF-8?q?update:=E4=BC=98=E5=8C=96AI=E8=AF=84?= =?UTF-8?q?=E8=AF=AD=E7=89=88=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../cn/teammodel/service/impl/ChatMessageServiceImpl.java | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/main/java/cn/teammodel/service/impl/ChatMessageServiceImpl.java b/src/main/java/cn/teammodel/service/impl/ChatMessageServiceImpl.java index 7f145e0..48dd300 100644 --- a/src/main/java/cn/teammodel/service/impl/ChatMessageServiceImpl.java +++ b/src/main/java/cn/teammodel/service/impl/ChatMessageServiceImpl.java @@ -512,11 +512,10 @@ public class ChatMessageServiceImpl implements ChatMessageService { if (chatCommentsDto.getSize() > 0) { builder.append("限制条件如下:1、") .append(chatCommentsDto.getSize()) - .append("字左右;2、直接返回评语的内容。"); + .append("字左右;2、直接返回评语的内容;3、评语的开篇不允许出现提示语;4、评语的开篇不允许出现特殊字符。"); } else { - builder.append("限制条件如下:1、200字左右;2、直接返回评语的内容。"); + builder.append("限制条件如下:1、200字左右;2、直接返回评语的内容;3、评语的开篇不允许出现提示语;4、评语的开篇不允许出现特殊字符。"); //builder.append("限制条件如下:1、200字左右;2、返回评语内容:不要开头提示语;开头不允许出现特殊字符。"); - //builder.append("限制条件如下:1、200字左右;2、直接返回评语的内容;3、评语的开篇不允许出现提示语;4、评语的开篇不允许出现特殊字符。"); } return builder.toString(); } catch (Exception e) { From ffb8af9546eb72b49c5c84c14d9e54a70c01fc36 Mon Sep 17 00:00:00 2001 From: PL <774412461@qq.com> Date: Fri, 18 Oct 2024 17:58:42 +0800 Subject: [PATCH 07/11] =?UTF-8?q?update:=E8=B0=83=E8=AF=95=E4=BC=98?= =?UTF-8?q?=E5=8C=96AI=E8=AF=84=E8=AF=AD=E6=A8=A1=E7=89=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/ChatMessageServiceImpl.java | 24 +++++++++++++++---- src/main/resources/Json/ChatModel.json | 8 +++---- 2 files changed, 23 insertions(+), 9 deletions(-) diff --git a/src/main/java/cn/teammodel/service/impl/ChatMessageServiceImpl.java b/src/main/java/cn/teammodel/service/impl/ChatMessageServiceImpl.java index 48dd300..7ec5b44 100644 --- a/src/main/java/cn/teammodel/service/impl/ChatMessageServiceImpl.java +++ b/src/main/java/cn/teammodel/service/impl/ChatMessageServiceImpl.java @@ -323,6 +323,20 @@ public class ChatMessageServiceImpl implements ChatMessageService { //角色条件 builder.append(String.format(chatModel.getRole().get(0), chatCommentsDto.getPeriod(), chatCommentsDto.getSubject())); } + String chatName = ""; + + + switch(phase){ + case 1: + chatName = chatCommentsDto.getName()+"班级"; + break; + case 2: + chatName = chatCommentsDto.getName()+"年级"; + break; + default: + chatName = chatCommentsDto.getName()+"同学"; + break; + } ChatModelDto finalChatModel = chatModel; //模版 @@ -371,7 +385,7 @@ public class ChatMessageServiceImpl implements ChatMessageService { )); } }); - builder.append(String.format(finalChatModel.getEnd().get(0), wisdomComments.getDims().size())); + builder.append(String.format(finalChatModel.getEnd().get(0),chatName, wisdomComments.getDims().size())); break; } //智育 表现模版 @@ -404,7 +418,7 @@ public class ChatMessageServiceImpl implements ChatMessageService { count++; } } - builder.append(String.format(finalChatModel.getEnd().get(0), count)); + builder.append(String.format(finalChatModel.getEnd().get(0),chatName)); break; } // 智育 学科评语模版 @@ -438,7 +452,7 @@ public class ChatMessageServiceImpl implements ChatMessageService { builder.append(String.format(finalChatModel.getCycleChats().get(2), name, comments.getClaasRanking().ranking, comments.getClaasRanking().scoreRate * 100, comments.getClaasRanking().average * 100)); } } - builder.append(String.format(finalChatModel.getEnd().get(0), subjectComments.size(),name)); + builder.append(String.format(finalChatModel.getEnd().get(0), subjectComments.size(),chatName)); break; } //艺术 考核指标纬度评语 @@ -467,7 +481,7 @@ public class ChatMessageServiceImpl implements ChatMessageService { builder.append(String.format(finalChatModel.getCycleChats().get(0), artLatitude.getQuotaN1(),artLatitude.getQuotaP1(), artLatitude.getQuotaN2(),artLatitude.getQuotaP2(), artLatitude.getQuotaN3(),artLatitude.getQuotaP3(), artLatitude.getPercent(),artLatitude.getLevel())); } - builder.append(finalChatModel.getEnd()); + builder.append(String.format(finalChatModel.getEnd().get(0),chatName)); break; } //艺术 学科评语模版 @@ -488,7 +502,7 @@ public class ChatMessageServiceImpl implements ChatMessageService { builder.append(String.format(finalChatModel.getCycleChats().get(0), artSubject.getDimension(),artSubject.getBlock(), artSubject.getPoint(),artSubject.getScore(), artSubject.getTotalScore(),artSubject.getPercent())); } - builder.append(String.format(finalChatModel.getEnd().get(0),chatCommentsDto.getSubject())); + builder.append(String.format(finalChatModel.getEnd().get(0),chatName)); break; } //体育 diff --git a/src/main/resources/Json/ChatModel.json b/src/main/resources/Json/ChatModel.json index 2c61520..f5886e4 100644 --- a/src/main/resources/Json/ChatModel.json +++ b/src/main/resources/Json/ChatModel.json @@ -8,7 +8,7 @@ "%s,在%s学年度,第%s学期,共计参加了%s次评测,其中课中评测%s次、线上评测%s次、阅卷评测%s次,总体表现如下:" ], "cycleChats": ["在%s中:学习态度为:%s、学习成效:%s、合作能力:%s、评价能力:%s、评价能力:%s ;\n"], - "end": ["请根据我提供的数据,对这 %s 次考试成绩表现做一个评价。\n"] + "end": ["请根据我提供的数据,对该%s的考试成绩表现做一个评价。\n"] }, { "type": "wisdomExam", @@ -16,7 +16,7 @@ "role": ["请扮演[%s%s]老师角色;数据如下:\n"], "chat": ["%s\n,"], "cycleChats": ["参加第%s次,考试结果:名称:%s,时间:%s,得分:%s,考试得分率:%s %% 排名:%s ;\n"], - "end": ["请根据我提供的数据,对这 %s 次考试成绩表现做一个评价。\n"] + "end": ["请根据我提供的数据,对该%s的考试成绩表现做一个评价。\n"] }, { "type": "wisdomSubject", @@ -32,7 +32,7 @@ "role": ["请扮演[%s%s]老师角色;数据如下:\n"], "chat": ["考核指标评纬度\n","%s的考核指标评纬度\n"], "cycleChats": [" 一级指标:%s( %s %%);二级指标:%s( %s %%);三级指标 %s( %s %%) ;得分率:%s %% 等级:%s\n"], - "end": ["请根据我提供的【考核指标纬度】做一个整体的评价。 \n"] + "end": ["请根据我提供的数据,对该%s做一个整体的评价。 \n"] }, { "type": "artSubject", @@ -40,7 +40,7 @@ "role": ["请扮演[%s%s]老师角色;数据如下:\n "], "chat": ["%s的学科\n"], "cycleChats": [" 考核纬度:%s;一级知识点:%s;二级知识点 %s;得分:%s/%s 得分率:%s\n"], - "end": ["请根据我提供的【%s学科】的表现做一个整体的评价。 \n"] + "end": ["请根据我提供的数据,对该%s的表现做一个整体的评价。 \n"] } ] } From baea2163575b28999e57dd20c57f77604544af48 Mon Sep 17 00:00:00 2001 From: PL <774412461@qq.com> Date: Fri, 18 Oct 2024 18:43:50 +0800 Subject: [PATCH 08/11] =?UTF-8?q?update:=E8=B0=83=E8=AF=95=E4=BC=98?= =?UTF-8?q?=E5=8C=96AI=E8=AF=84=E8=AF=AD=E6=A8=A1=E7=89=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/ChatMessageServiceImpl.java | 49 ++++++++++--------- src/main/resources/Json/ChatModel.json | 25 ++++++---- 2 files changed, 40 insertions(+), 34 deletions(-) diff --git a/src/main/java/cn/teammodel/service/impl/ChatMessageServiceImpl.java b/src/main/java/cn/teammodel/service/impl/ChatMessageServiceImpl.java index 7ec5b44..ece5764 100644 --- a/src/main/java/cn/teammodel/service/impl/ChatMessageServiceImpl.java +++ b/src/main/java/cn/teammodel/service/impl/ChatMessageServiceImpl.java @@ -318,26 +318,32 @@ public class ChatMessageServiceImpl implements ChatMessageService { break; } } - - if (chatModel != null) { - //角色条件 - builder.append(String.format(chatModel.getRole().get(0), chatCommentsDto.getPeriod(), chatCommentsDto.getSubject())); - } String chatName = ""; - - switch(phase){ case 1: - chatName = chatCommentsDto.getName()+"班级"; + if (chatCommentsDto.getName().contains("班") || chatCommentsDto.getName().contains("班级")) { + chatName = chatCommentsDto.getName(); + } else { + chatName = chatCommentsDto.getName()+"班级"; + } break; case 2: - chatName = chatCommentsDto.getName()+"年级"; + if (chatCommentsDto.getName().contains("年级")) { + chatName = chatCommentsDto.getName(); + } else { + chatName = chatCommentsDto.getName()+"年级"; + } break; default: chatName = chatCommentsDto.getName()+"同学"; break; } + if (chatModel != null) { + //角色条件 + builder.append(String.format(chatModel.getRole().get(0), chatCommentsDto.getPeriod(), chatCommentsDto.getSubject(), chatName)); + } + ChatModelDto finalChatModel = chatModel; //模版 switch (chatCommentsDto.getType()) { @@ -385,7 +391,7 @@ public class ChatMessageServiceImpl implements ChatMessageService { )); } }); - builder.append(String.format(finalChatModel.getEnd().get(0),chatName, wisdomComments.getDims().size())); + //builder.append(String.format(finalChatModel.getEnd().get(0),chatName, wisdomComments.getDims().size())); break; } //智育 表现模版 @@ -418,7 +424,7 @@ public class ChatMessageServiceImpl implements ChatMessageService { count++; } } - builder.append(String.format(finalChatModel.getEnd().get(0),chatName)); + //builder.append(String.format(finalChatModel.getEnd().get(0),chatName)); break; } // 智育 学科评语模版 @@ -452,7 +458,7 @@ public class ChatMessageServiceImpl implements ChatMessageService { builder.append(String.format(finalChatModel.getCycleChats().get(2), name, comments.getClaasRanking().ranking, comments.getClaasRanking().scoreRate * 100, comments.getClaasRanking().average * 100)); } } - builder.append(String.format(finalChatModel.getEnd().get(0), subjectComments.size(),chatName)); + //builder.append(String.format(finalChatModel.getEnd().get(0), subjectComments.size(),chatName)); break; } //艺术 考核指标纬度评语 @@ -476,12 +482,11 @@ public class ChatMessageServiceImpl implements ChatMessageService { builder.append(finalChatModel.getChat().get(0)); } } - for (ArtLatitudeDto artLatitude : artLatitudes) - { + for (ArtLatitudeDto artLatitude : artLatitudes){ builder.append(String.format(finalChatModel.getCycleChats().get(0), artLatitude.getQuotaN1(),artLatitude.getQuotaP1(), artLatitude.getQuotaN2(),artLatitude.getQuotaP2(), artLatitude.getQuotaN3(),artLatitude.getQuotaP3(), artLatitude.getPercent(),artLatitude.getLevel())); } - builder.append(String.format(finalChatModel.getEnd().get(0),chatName)); + //builder.append(String.format(finalChatModel.getEnd().get(0),chatName)); break; } //艺术 学科评语模版 @@ -502,7 +507,7 @@ public class ChatMessageServiceImpl implements ChatMessageService { builder.append(String.format(finalChatModel.getCycleChats().get(0), artSubject.getDimension(),artSubject.getBlock(), artSubject.getPoint(),artSubject.getScore(), artSubject.getTotalScore(),artSubject.getPercent())); } - builder.append(String.format(finalChatModel.getEnd().get(0),chatName)); + //builder.append(String.format(finalChatModel.getEnd().get(0),chatName)); break; } //体育 @@ -523,14 +528,10 @@ public class ChatMessageServiceImpl implements ChatMessageService { throw new ServiceException(ErrorCode.PARAMS_ERROR.getCode(), "评语类型异常"); } - if (chatCommentsDto.getSize() > 0) { - builder.append("限制条件如下:1、") - .append(chatCommentsDto.getSize()) - .append("字左右;2、直接返回评语的内容;3、评语的开篇不允许出现提示语;4、评语的开篇不允许出现特殊字符。"); - } else { - builder.append("限制条件如下:1、200字左右;2、直接返回评语的内容;3、评语的开篇不允许出现提示语;4、评语的开篇不允许出现特殊字符。"); - //builder.append("限制条件如下:1、200字左右;2、返回评语内容:不要开头提示语;开头不允许出现特殊字符。"); - } + String limitChat = "。限制条件如下:1.%s字左右;2.直接返回评价的内容;3.评价开头不要提示语;4.评价开头不允许出现特殊字符。"; + int size = chatCommentsDto.getSize() > 0 ? chatCommentsDto.getSize() : 200; + builder.append(String.format(limitChat, size)); + return builder.toString(); } catch (Exception e) { log.info(Arrays.toString(e.getStackTrace())); diff --git a/src/main/resources/Json/ChatModel.json b/src/main/resources/Json/ChatModel.json index f5886e4..3b071d5 100644 --- a/src/main/resources/Json/ChatModel.json +++ b/src/main/resources/Json/ChatModel.json @@ -3,44 +3,49 @@ { "type": "wisdom", "name": "智育 总体评语模版", - "role": ["请扮演[%s%s]老师角色;\n 数据如下:"], + "role": ["请扮演[%s%s]老师角色,依据提供的数据,对%s的总体的表现做一个评价。\n 数据如下:"], "chat": ["%s同学,在%s学年度,第%s学期中,共计参加了%s次评测,其中课中评测%s次、线上评测%s次、阅卷评测%s次,素养等级为%s,已超过班级%s%% 的同学。\n %s同学的总体表现:", "%s,在%s学年度,第%s学期,共计参加了%s次评测,其中课中评测%s次、线上评测%s次、阅卷评测%s次,总体表现如下:" ], "cycleChats": ["在%s中:学习态度为:%s、学习成效:%s、合作能力:%s、评价能力:%s、评价能力:%s ;\n"], - "end": ["请根据我提供的数据,对该%s的考试成绩表现做一个评价。\n"] + "end": ["请根据我提供的数据,对%s的考试成绩表现做一个评价。\n"], + "limit": "。限制条件如下:1、%s字左右;2、直接返回评语的内容;3、评语的开篇不允许出现提示语;4、评语的开篇不允许出现特殊字符。" }, { "type": "wisdomExam", "name": "智育 成绩表现模版", - "role": ["请扮演[%s%s]老师角色;数据如下:\n"], + "role": ["请扮演[%s%s]老师角色,依据我提供的数据,对%s的学习成效表现做一个评价。数据如下:\n"], "chat": ["%s\n,"], "cycleChats": ["参加第%s次,考试结果:名称:%s,时间:%s,得分:%s,考试得分率:%s %% 排名:%s ;\n"], - "end": ["请根据我提供的数据,对该%s的考试成绩表现做一个评价。\n"] + "end": ["请根据我提供的数据,对%s的考试成绩表现做一个评价。\n"], + "limit": "。限制条件如下:1、%s字左右;2、直接返回评语的内容;3、评语的开篇不允许出现提示语;4、评语的开篇不允许出现特殊字符。" }, { "type": "wisdomSubject", "name": "智育 学科评语模版", - "role": ["请扮演[%s%s]老师角色; 数据如下:\n"], + "role": ["请扮演[%s%s]老师角色,依据我提供的数据,对%s的各科评测表现做一个评价。 数据如下:\n"], "chat": ["的各科评测表现:","%s的各科评测表现:\""], "cycleChats":["科目:%s 班级top10"," 排名:%s,姓名:%s,得分率:%s %% ,\n " ,"%s在班级排名:%s,得分率:%s %%,排在班级平均得分率:(%s %%)"], - "end": ["请根据我提供的数据,对这%s门学科,【%s】的表现做一个评价。 \n"] + "end": ["请根据我提供的数据,对这%s门学科,对%s的表现做一个评价。 \n"], + "limit": "。限制条件如下:1、%s字左右;2、直接返回评语的内容;3、评语的开篇不允许出现提示语;4、评语的开篇不允许出现特殊字符。" }, { "type": "artLatitude", "name": "艺术 考核指标评语模版", - "role": ["请扮演[%s%s]老师角色;数据如下:\n"], + "role": ["请扮演[%s%s]老师角色,依据我提供的数据,对%s的表现做一个整体的评价。数据如下:\n"], "chat": ["考核指标评纬度\n","%s的考核指标评纬度\n"], "cycleChats": [" 一级指标:%s( %s %%);二级指标:%s( %s %%);三级指标 %s( %s %%) ;得分率:%s %% 等级:%s\n"], - "end": ["请根据我提供的数据,对该%s做一个整体的评价。 \n"] + "end": ["请根据我提供的数据,对%s做一个整体的评价。 \n"], + "limit": "" }, { "type": "artSubject", "name": "艺术 学科评语模版", - "role": ["请扮演[%s%s]老师角色;数据如下:\n "], + "role": ["请扮演[%s%s]老师角色,依据我提供的数据,对%s的表现做一个整体的评价。 数据如下:\n "], "chat": ["%s的学科\n"], "cycleChats": [" 考核纬度:%s;一级知识点:%s;二级知识点 %s;得分:%s/%s 得分率:%s\n"], - "end": ["请根据我提供的数据,对该%s的表现做一个整体的评价。 \n"] + "end": ["请根据我提供的数据,对%s的表现做一个整体的评价。 \n"], + "limit": "。限制条件如下:1、%s字左右;2、直接返回评语的内容;3、评语的开篇不允许出现提示语;4、评语的开篇不允许出现特殊字符。" } ] } From 146adb9ae66dbac939cb946ae4884d5c993807d6 Mon Sep 17 00:00:00 2001 From: PL <774412461@qq.com> Date: Fri, 18 Oct 2024 19:37:00 +0800 Subject: [PATCH 09/11] =?UTF-8?q?update:=E8=B0=83=E8=AF=95=E4=BC=98?= =?UTF-8?q?=E5=8C=96AI=E8=AF=84=E8=AF=AD=E6=A8=A1=E7=89=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dto/ai/comment/WisdomExamCommentsDto.java | 13 ++++++- .../service/impl/ChatMessageServiceImpl.java | 36 +++++++++++++++---- src/main/resources/Json/ChatModel.json | 2 +- 3 files changed, 42 insertions(+), 9 deletions(-) diff --git a/src/main/java/cn/teammodel/model/dto/ai/comment/WisdomExamCommentsDto.java b/src/main/java/cn/teammodel/model/dto/ai/comment/WisdomExamCommentsDto.java index 8e065a4..dbe13fd 100644 --- a/src/main/java/cn/teammodel/model/dto/ai/comment/WisdomExamCommentsDto.java +++ b/src/main/java/cn/teammodel/model/dto/ai/comment/WisdomExamCommentsDto.java @@ -6,6 +6,7 @@ import lombok.Data; */ @Data public class WisdomExamCommentsDto { + /** * 试卷名称 */ @@ -21,9 +22,19 @@ public class WisdomExamCommentsDto { /** * 得分率 */ - public int scoreRate; + public double scoreRate; /** * 排名 */ public int ranking; + + /** + * 班级得分率 + */ + public double classRate; + + /** + * 年级得分率 + */ + public double gradeRate; } diff --git a/src/main/java/cn/teammodel/service/impl/ChatMessageServiceImpl.java b/src/main/java/cn/teammodel/service/impl/ChatMessageServiceImpl.java index ece5764..f1fff1e 100644 --- a/src/main/java/cn/teammodel/service/impl/ChatMessageServiceImpl.java +++ b/src/main/java/cn/teammodel/service/impl/ChatMessageServiceImpl.java @@ -416,15 +416,37 @@ public class ChatMessageServiceImpl implements ChatMessageService { //昵称 builder.append(String.format(finalChatModel.getChat().get(0), chatCommentsDto.getName())); } - for (WisdomExamCommentsDto examComment : examComments) { - builder.append(String.format(finalChatModel.getCycleChats().get(0), count, examComment.getName(), - examComment.getTime(), examComment.getScore(), examComment.getScoreRate(), - examComment.getRanking())); - if (count < examComments.size()) { - count++; + switch(phase){ + case 1:{ + for (WisdomExamCommentsDto examComment : examComments) { + builder.append(String.format(finalChatModel.getCycleChats().get(1), count, examComment.getName(),examComment.getTime(), examComment.getClassRate(),examComment.getGradeRate())); + if (count < examComments.size()) { + count++; + } + } + break; + } + case 2:{ + for (WisdomExamCommentsDto examComment : examComments) { + builder.append(String.format(finalChatModel.getCycleChats().get(2), count, examComment.getName(),examComment.getTime(), examComment.getGradeRate())); + if (count < examComments.size()) { + count++; + } + } + break; + } + default:{ + for (WisdomExamCommentsDto examComment : examComments) { + builder.append(String.format(finalChatModel.getCycleChats().get(0), count, examComment.getName(), + examComment.getTime(), examComment.getScore(), examComment.getScoreRate(), + examComment.getRanking())); + if (count < examComments.size()) { + count++; + } + } + break; } } - //builder.append(String.format(finalChatModel.getEnd().get(0),chatName)); break; } // 智育 学科评语模版 diff --git a/src/main/resources/Json/ChatModel.json b/src/main/resources/Json/ChatModel.json index 3b071d5..30b7920 100644 --- a/src/main/resources/Json/ChatModel.json +++ b/src/main/resources/Json/ChatModel.json @@ -16,7 +16,7 @@ "name": "智育 成绩表现模版", "role": ["请扮演[%s%s]老师角色,依据我提供的数据,对%s的学习成效表现做一个评价。数据如下:\n"], "chat": ["%s\n,"], - "cycleChats": ["参加第%s次,考试结果:名称:%s,时间:%s,得分:%s,考试得分率:%s %% 排名:%s ;\n"], + "cycleChats": ["参加第%s次,考试结果:名称:%s,时间:%s,得分:%s,考试得分率:%s %% 排名:%s ;\n","参加第%s次,考试结果:名称:%s,时间:%s,班级平均得分率:%s %%吗,年级平均得分率:%s %%;\n","参加第%s次,考试结果:名称:%s,时间:%s,年级平均得分率:%s %%;\n"], "end": ["请根据我提供的数据,对%s的考试成绩表现做一个评价。\n"], "limit": "。限制条件如下:1、%s字左右;2、直接返回评语的内容;3、评语的开篇不允许出现提示语;4、评语的开篇不允许出现特殊字符。" }, From 65d474008494594e6fc3a87791bb979a6f90a5f3 Mon Sep 17 00:00:00 2001 From: PL <774412461@qq.com> Date: Fri, 18 Oct 2024 19:41:14 +0800 Subject: [PATCH 10/11] =?UTF-8?q?update:=E8=B0=83=E8=AF=95=E4=BC=98?= =?UTF-8?q?=E5=8C=96AI=E8=AF=84=E8=AF=AD=E6=A8=A1=E7=89=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/resources/Json/ChatModel.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/resources/Json/ChatModel.json b/src/main/resources/Json/ChatModel.json index 30b7920..75015ab 100644 --- a/src/main/resources/Json/ChatModel.json +++ b/src/main/resources/Json/ChatModel.json @@ -16,7 +16,7 @@ "name": "智育 成绩表现模版", "role": ["请扮演[%s%s]老师角色,依据我提供的数据,对%s的学习成效表现做一个评价。数据如下:\n"], "chat": ["%s\n,"], - "cycleChats": ["参加第%s次,考试结果:名称:%s,时间:%s,得分:%s,考试得分率:%s %% 排名:%s ;\n","参加第%s次,考试结果:名称:%s,时间:%s,班级平均得分率:%s %%吗,年级平均得分率:%s %%;\n","参加第%s次,考试结果:名称:%s,时间:%s,年级平均得分率:%s %%;\n"], + "cycleChats": ["参加第%s次,考试结果:名称:%s,时间:%s,得分:%s,考试得分率:%s %% 排名:%s ;\n","参加第%s次,考试结果:名称:%s,时间:%s,班级平均得分率:%s %%,年级平均得分率:%s %%;\n","参加第%s次,考试结果:名称:%s,时间:%s,年级平均得分率:%s %%;\n"], "end": ["请根据我提供的数据,对%s的考试成绩表现做一个评价。\n"], "limit": "。限制条件如下:1、%s字左右;2、直接返回评语的内容;3、评语的开篇不允许出现提示语;4、评语的开篇不允许出现特殊字符。" }, From 8100e1594815215feb1e3199500e00abfdc6ec9e Mon Sep 17 00:00:00 2001 From: PL <774412461@qq.com> Date: Fri, 18 Oct 2024 19:52:04 +0800 Subject: [PATCH 11/11] =?UTF-8?q?update:=E4=BC=98=E5=8C=96=E4=BB=A3?= =?UTF-8?q?=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/ChatMessageServiceImpl.java | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/src/main/java/cn/teammodel/service/impl/ChatMessageServiceImpl.java b/src/main/java/cn/teammodel/service/impl/ChatMessageServiceImpl.java index f1fff1e..f66bd4e 100644 --- a/src/main/java/cn/teammodel/service/impl/ChatMessageServiceImpl.java +++ b/src/main/java/cn/teammodel/service/impl/ChatMessageServiceImpl.java @@ -420,29 +420,21 @@ public class ChatMessageServiceImpl implements ChatMessageService { case 1:{ for (WisdomExamCommentsDto examComment : examComments) { builder.append(String.format(finalChatModel.getCycleChats().get(1), count, examComment.getName(),examComment.getTime(), examComment.getClassRate(),examComment.getGradeRate())); - if (count < examComments.size()) { - count++; - } + count++; } break; } case 2:{ for (WisdomExamCommentsDto examComment : examComments) { builder.append(String.format(finalChatModel.getCycleChats().get(2), count, examComment.getName(),examComment.getTime(), examComment.getGradeRate())); - if (count < examComments.size()) { - count++; - } + count++; } break; } default:{ for (WisdomExamCommentsDto examComment : examComments) { - builder.append(String.format(finalChatModel.getCycleChats().get(0), count, examComment.getName(), - examComment.getTime(), examComment.getScore(), examComment.getScoreRate(), - examComment.getRanking())); - if (count < examComments.size()) { - count++; - } + builder.append(String.format(finalChatModel.getCycleChats().get(0), count, examComment.getName(),examComment.getTime(), examComment.getScore(), examComment.getScoreRate(),examComment.getRanking())); + count++; } break; }