Bläddra i källkod

改为真异步的话涉及到认证问题,懒得动了,先这样吧

Jiang Pengyu 6 månader sedan
förälder
incheckning
8b9b2e1c58
1 ändrade filer med 15 tillägg och 15 borttagningar
  1. 15 15
      src/main/java/com/njuzr/eaibackend/controller/EvaluationController.java

+ 15 - 15
src/main/java/com/njuzr/eaibackend/controller/EvaluationController.java

@@ -28,21 +28,21 @@ public class EvaluationController {
      * @param studentId 学生ID
      * @return
      */
-      @PostMapping("/overall")
-    public CompletableFuture<MyResponse>  rewrite(
-            @RequestParam Long assignmentId,
-            @RequestParam Long studentId
-    ) throws ExecutionException, InterruptedException {
-        return aiEvaluationService.evaluationAsync(assignmentId, studentId)
-            .thenApply(result -> MyResponse.success(result))
-            .exceptionally(ex -> MyResponse.error(500, "AI请求失败:" + ex.getMessage()));
-    }  //真正的异步,之前的假异步
-    // public MyResponse rewrite(
-    //         @RequestParam Long assignmentId,
-    //         @RequestParam Long studentId
-    // ) throws ExecutionException, InterruptedException {
-    //     return MyResponse.success(aiEvaluationService.evaluationAsync(assignmentId, studentId).get());
-    // }
+     @PostMapping("/overall")
+//    public CompletableFuture<MyResponse>  rewrite(
+//            @RequestParam Long assignmentId,
+//            @RequestParam Long studentId
+//    ) throws ExecutionException, InterruptedException {
+//        return aiEvaluationService.evaluationAsync(assignmentId, studentId)
+//            .thenApply(result -> MyResponse.success(result))
+//            .exceptionally(ex -> MyResponse.error(500, "AI请求失败:" + ex.getMessage()));
+//    }  //真正的异步,之前的假异步
+     public MyResponse rewrite(
+             @RequestParam Long assignmentId,
+             @RequestParam Long studentId
+     ) throws ExecutionException, InterruptedException {
+         return MyResponse.success(aiEvaluationService.evaluationAsync(assignmentId, studentId).get());
+     }
 
     /**
      * 对作文进行逐句批改