Browse Source

简答题评分联调

master
luoweijian 2 months ago
parent
commit
443214f2c1
  1. 1
      src/main/java/com/project/exam/domain/job/ShortAnswerScoringJob.java
  2. 5
      src/main/java/com/project/exam/domain/service/impl/BuildExamRecordDomainServiceImpl.java
  3. 5
      src/main/java/com/project/interaction/domain/service/impl/PostToAiScoringDomainServiceImpl.java

1
src/main/java/com/project/exam/domain/job/ShortAnswerScoringJob.java

@ -190,7 +190,6 @@ public class ShortAnswerScoringJob {
AiScoringResponseDTO response = postToAiScoringDomainService.requestAiScoring(request); AiScoringResponseDTO response = postToAiScoringDomainService.requestAiScoring(request);
if (response.getSuccess() != null && response.getSuccess() if (response.getSuccess() != null && response.getSuccess()
&& response.getCode() != null && response.getCode() == 0
&& response.getData() != null) { && response.getData() != null) {
// 计算各得分点得分和命中点 // 计算各得分点得分和命中点

5
src/main/java/com/project/exam/domain/service/impl/BuildExamRecordDomainServiceImpl.java

@ -72,7 +72,10 @@ public class BuildExamRecordDomainServiceImpl implements BuildExamRecordDomainSe
if (!canShowDetails) { if (!canShowDetails) {
answerSnapshotDTO.setRightAnswer(null); answerSnapshotDTO.setRightAnswer(null);
answerSnapshotDTO.setAnalysis(null); answerSnapshotDTO.setAnalysis(null);
}else if(!answerSnapshotDTO.getRightAnswer().contains(",")){ } else if (answerSnapshotDTO.getType() != null
&& !QuestionTypeEnum.SHORT_ANSWER.getValue().equals(answerSnapshotDTO.getType())
&& answerSnapshotDTO.getRightAnswer() != null
&& !answerSnapshotDTO.getRightAnswer().contains(",")) {
String rightAnswer = answerSnapshotDTO.getRightAnswer().chars() String rightAnswer = answerSnapshotDTO.getRightAnswer().chars()
.mapToObj(c -> String.valueOf((char) c)) .mapToObj(c -> String.valueOf((char) c))
.collect(Collectors.joining(",")); .collect(Collectors.joining(","));

5
src/main/java/com/project/interaction/domain/service/impl/PostToAiScoringDomainServiceImpl.java

@ -28,6 +28,9 @@ public class PostToAiScoringDomainServiceImpl implements PostToAiScoringDomainSe
@Value("${algo.scoringUrl:/v1/score/short_answer}") @Value("${algo.scoringUrl:/v1/score/short_answer}")
private String scoringUrl; private String scoringUrl;
@Value("${algo.apiUrl:http://172.16.25.174:8000}")
private String apiUrl;
private final ObjectMapper objectMapper = new ObjectMapper(); private final ObjectMapper objectMapper = new ObjectMapper();
@Override @Override
@ -36,7 +39,7 @@ public class PostToAiScoringDomainServiceImpl implements PostToAiScoringDomainSe
log.info(">>> [AI阅卷] 正在请求AI阅卷, question={}", request.getQuestion()); log.info(">>> [AI阅卷] 正在请求AI阅卷, question={}", request.getQuestion());
String responseBody = algorithmWebClient.post() String responseBody = algorithmWebClient.post()
.uri(scoringUrl) .uri(apiUrl+scoringUrl)
.bodyValue(request) .bodyValue(request)
.retrieve() .retrieve()
.bodyToMono(String.class) .bodyToMono(String.class)

Loading…
Cancel
Save