|
|
@@ -135,19 +135,12 @@ public class AIEvaluationService {
|
|
|
this.evaluationMapperServiceImpl = evaluationMapperServiceImpl;
|
|
|
}
|
|
|
|
|
|
- /**
|
|
|
- * 一键双评
|
|
|
- * @param assignmentId
|
|
|
- * @param studentId
|
|
|
- * @return
|
|
|
- */
|
|
|
- public AIEntry evaluateAll(Long assignmentId, Long studentId) {
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
public CompletableFuture<AIEntry> evaluationAsync(Long assignmentId, Long studentId) {
|
|
|
- return CompletableFuture.supplyAsync(() -> evaluation(assignmentId, studentId), aiTaskExecutor);
|
|
|
+ return CompletableFuture.supplyAsync(() -> evaluation(assignmentId, studentId), aiTaskExecutor)
|
|
|
+ .exceptionally(ex -> { throw new MyException(HttpStatus.INTERNAL_SERVER_ERROR.value(), "AI请求失败:" + ex.getMessage());})
|
|
|
+ .orTimeout(40, TimeUnit.SECONDS);
|
|
|
}
|
|
|
+
|
|
|
/**
|
|
|
* AI作文整体智能批改
|
|
|
* @param assignmentId
|
|
|
@@ -163,9 +156,9 @@ public class AIEvaluationService {
|
|
|
if (assignment == null) throw MyException.create(HttpStatus.BAD_REQUEST, "作业不存在");
|
|
|
Evaluation evaluationJudge = evaluationMapperServiceImpl.getByVersion(assignmentId, studentId, engagement.getVersion());
|
|
|
if(evaluationJudge != null) throw MyException.create(HttpStatus.BAD_REQUEST, "作业已进行过AI分析");
|
|
|
- log.info("evaluation start");
|
|
|
+
|
|
|
initEvaluationRecord(assignmentId, studentId, engagement);
|
|
|
- log.info("evaluation end");
|
|
|
+
|
|
|
String prompt = String.format(REWRITE_PROMPT_TEMPLATE, assignment.getDescription(), engagement.getTextContent());
|
|
|
AIRequestService.AIResponse response = requestAI(prompt, 0);
|
|
|
String retContent;
|