|
|
@ -10,10 +10,7 @@ import cn.teammodel.common.ErrorCode;
|
|
|
|
import cn.teammodel.common.PK;
|
|
|
|
import cn.teammodel.common.PK;
|
|
|
|
import cn.teammodel.config.exception.ServiceException;
|
|
|
|
import cn.teammodel.config.exception.ServiceException;
|
|
|
|
import cn.teammodel.model.dto.ai.*;
|
|
|
|
import cn.teammodel.model.dto.ai.*;
|
|
|
|
import cn.teammodel.model.dto.ai.comment.ChatCommentsDto;
|
|
|
|
import cn.teammodel.model.dto.ai.comment.*;
|
|
|
|
import cn.teammodel.model.dto.ai.comment.WisdomCommentsDto;
|
|
|
|
|
|
|
|
import cn.teammodel.model.dto.ai.comment.WisdomExamCommentsDto;
|
|
|
|
|
|
|
|
import cn.teammodel.model.dto.ai.comment.WisdomSubjectComments;
|
|
|
|
|
|
|
|
import cn.teammodel.model.entity.ai.ChatApp;
|
|
|
|
import cn.teammodel.model.entity.ai.ChatApp;
|
|
|
|
import cn.teammodel.repository.ChatAppRepository;
|
|
|
|
import cn.teammodel.repository.ChatAppRepository;
|
|
|
|
import cn.teammodel.repository.ChatSessionRepository;
|
|
|
|
import cn.teammodel.repository.ChatSessionRepository;
|
|
|
@ -21,10 +18,8 @@ import cn.teammodel.model.entity.User;
|
|
|
|
import cn.teammodel.model.entity.ai.ChatSession;
|
|
|
|
import cn.teammodel.model.entity.ai.ChatSession;
|
|
|
|
import cn.teammodel.security.utils.SecurityUtil;
|
|
|
|
import cn.teammodel.security.utils.SecurityUtil;
|
|
|
|
import cn.teammodel.service.ChatMessageService;
|
|
|
|
import cn.teammodel.service.ChatMessageService;
|
|
|
|
import cn.teammodel.utils.FileUtil;
|
|
|
|
|
|
|
|
import cn.teammodel.utils.RepositoryUtil;
|
|
|
|
import cn.teammodel.utils.RepositoryUtil;
|
|
|
|
import com.alibaba.fastjson2.JSON;
|
|
|
|
import com.alibaba.fastjson2.JSON;
|
|
|
|
import com.alibaba.fastjson2.JSONObject;
|
|
|
|
|
|
|
|
import com.alibaba.fastjson2.TypeReference;
|
|
|
|
import com.alibaba.fastjson2.TypeReference;
|
|
|
|
import com.azure.cosmos.models.CosmosPatchOperations;
|
|
|
|
import com.azure.cosmos.models.CosmosPatchOperations;
|
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
@ -34,11 +29,6 @@ import org.springframework.stereotype.Service;
|
|
|
|
import org.springframework.web.servlet.mvc.method.annotation.SseEmitter;
|
|
|
|
import org.springframework.web.servlet.mvc.method.annotation.SseEmitter;
|
|
|
|
|
|
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
|
import javax.annotation.Resource;
|
|
|
|
import java.io.*;
|
|
|
|
|
|
|
|
import java.net.URISyntaxException;
|
|
|
|
|
|
|
|
import java.net.URL;
|
|
|
|
|
|
|
|
import java.nio.file.Files;
|
|
|
|
|
|
|
|
import java.nio.file.Paths;
|
|
|
|
|
|
|
|
import java.time.Instant;
|
|
|
|
import java.time.Instant;
|
|
|
|
import java.util.*;
|
|
|
|
import java.util.*;
|
|
|
|
|
|
|
|
|
|
|
@ -451,36 +441,79 @@ public class ChatMessageServiceImpl implements ChatMessageService {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
builder.append(finalChatModel.getChat());
|
|
|
|
builder.append(finalChatModel.getChat());
|
|
|
|
|
|
|
|
String name = "";
|
|
|
|
//拼接学科数组
|
|
|
|
//拼接学科数组
|
|
|
|
for (WisdomSubjectComments comments : subjectComments) {
|
|
|
|
for (WisdomSubjectComments comments : subjectComments) {
|
|
|
|
builder.append(String.format(finalChatModel.getCycleChats().get(0), comments.subjectName));
|
|
|
|
builder.append(String.format(finalChatModel.getCycleChats().get(0), comments.subjectName));
|
|
|
|
for (WisdomSubjectComments.StuInfo stuInfo : comments.getRankings()) {
|
|
|
|
for (WisdomSubjectComments.StuInfo stuInfo : comments.getRankings()) {
|
|
|
|
builder.append(String.format(finalChatModel.getCycleChats().get(1), stuInfo.ranking,
|
|
|
|
builder.append(String.format(finalChatModel.getCycleChats().get(1), stuInfo.ranking,stuInfo.name, stuInfo.scoreRate*100));
|
|
|
|
stuInfo.name, stuInfo.scoreRate));
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
name = comments.getClaasRanking().name;
|
|
|
|
builder.append(String.format(finalChatModel.getCycleChats().get(2),
|
|
|
|
builder.append(String.format(finalChatModel.getCycleChats().get(2),name,comments.getClaasRanking().ranking, comments.getClaasRanking().scoreRate * 100,comments.getClaasRanking().average));
|
|
|
|
comments.getClaasRanking().ranking, comments.getClaasRanking().scoreRate,
|
|
|
|
|
|
|
|
comments.getClaasRanking().average));
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
builder.append(String.format(finalChatModel.getEnd(), subjectComments.size()));
|
|
|
|
builder.append(String.format(finalChatModel.getEnd(), subjectComments.size(),name));
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
//艺术 考核指标纬度评语
|
|
|
|
//艺术 考核指标纬度评语
|
|
|
|
case "artDimensions":
|
|
|
|
case "artLatitude":{
|
|
|
|
builder.append("请按照以下格式回复:\n");
|
|
|
|
List<ArtLatitudeDto> artLatitudes;
|
|
|
|
builder.append("1. 艺术作品:\n");
|
|
|
|
try {
|
|
|
|
builder.append("2. 艺术作品说明:\n");
|
|
|
|
artLatitudes = JSON.parseObject(strData, new TypeReference<List<ArtLatitudeDto>>() {
|
|
|
|
builder.append("3. 艺术作品示例:\n");
|
|
|
|
});
|
|
|
|
builder.append("4. 艺术作品示例说明:\n");
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
|
|
|
throw new ServiceException(ErrorCode.PARAMS_ERROR.getCode(), "请求参数异常");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
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<ArtSubjectDto> artSubjects;
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
|
|
|
artSubjects = JSON.parseObject(strData, new TypeReference<List<ArtSubjectDto>>() {
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
} 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(),chatCommentsDto.getSubject()));
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
case "sport":
|
|
|
|
}
|
|
|
|
|
|
|
|
//体育
|
|
|
|
|
|
|
|
case "sport":{
|
|
|
|
builder.append("请按照以下格式回复:\n");
|
|
|
|
builder.append("请按照以下格式回复:\n");
|
|
|
|
builder.append("1. 运动作品:\n");
|
|
|
|
builder.append("1. 运动作品:\n");
|
|
|
|
builder.append("2. 运动作品说明:\n");
|
|
|
|
builder.append("2. 运动作品说明:\n");
|
|
|
|
builder.append("3. 运动作品示例:\n");
|
|
|
|
builder.append("3. 运动作品示例:\n");
|
|
|
|
builder.append("4. 运动作品示例说明:\n");
|
|
|
|
builder.append("4. 运动作品示例说明:\n");
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
//德育
|
|
|
|
|
|
|
|
case "moral":{
|
|
|
|
|
|
|
|
builder.append(finalChatModel.getChat());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
}
|
|
|
|
default:
|
|
|
|
default:
|
|
|
|
throw new ServiceException(ErrorCode.PARAMS_ERROR.getCode(), "评语类型异常");
|
|
|
|
throw new ServiceException(ErrorCode.PARAMS_ERROR.getCode(), "评语类型异常");
|
|
|
|
}
|
|
|
|
}
|
|
|
|