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] =?UTF-8?q?update=EF=BC=9A=E6=B7=BB=E5=8A=A0=E5=90=8D?= =?UTF-8?q?=E7=A7=B0=E5=8F=82=E6=95=B0=EF=BC=8C=E5=B9=B6=E5=A4=84=E7=90=86?= =?UTF-8?q?=E8=AF=84=E8=AF=AD=E8=AF=9D=E6=9C=AF=EF=BC=8C=E4=B8=8E=E6=9D=A1?= =?UTF-8?q?=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"] } ] }