|
@@ -3,9 +3,11 @@ package com.backendsys.modules.ai.deepSeek.controller;
|
|
import com.backendsys.modules.ai.deepSeek.entity.DeepSeekParam;
|
|
import com.backendsys.modules.ai.deepSeek.entity.DeepSeekParam;
|
|
import com.backendsys.modules.ai.deepSeek.utils.OllamaUtil;
|
|
import com.backendsys.modules.ai.deepSeek.utils.OllamaUtil;
|
|
import com.backendsys.modules.common.config.security.utils.SecurityUtil;
|
|
import com.backendsys.modules.common.config.security.utils.SecurityUtil;
|
|
|
|
+import com.backendsys.modules.common.utils.Result;
|
|
import io.swagger.v3.oas.annotations.Operation;
|
|
import io.swagger.v3.oas.annotations.Operation;
|
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
+import org.springframework.security.access.prepost.PreAuthorize;
|
|
import org.springframework.validation.annotation.Validated;
|
|
import org.springframework.validation.annotation.Validated;
|
|
import org.springframework.web.bind.annotation.PostMapping;
|
|
import org.springframework.web.bind.annotation.PostMapping;
|
|
import org.springframework.web.bind.annotation.RequestBody;
|
|
import org.springframework.web.bind.annotation.RequestBody;
|
|
@@ -20,13 +22,15 @@ public class DeepSeekController {
|
|
private OllamaUtil ollamaUtil;
|
|
private OllamaUtil ollamaUtil;
|
|
|
|
|
|
@Operation(summary = "提问")
|
|
@Operation(summary = "提问")
|
|
|
|
+ @PreAuthorize("@sr.hasPermission('101')")
|
|
@PostMapping("/api/deepSeek/ask")
|
|
@PostMapping("/api/deepSeek/ask")
|
|
- public String ask(@Validated @RequestBody DeepSeekParam param) {
|
|
|
|
|
|
+ public Result ask(@Validated @RequestBody DeepSeekParam param) {
|
|
Long userId = SecurityUtil.getUserId();
|
|
Long userId = SecurityUtil.getUserId();
|
|
- System.out.println("userId = " + userId);
|
|
|
|
|
|
|
|
- ollamaUtil.chatDeepSeek("deepseek-r1:1.5b", param.getQuestion(), userId);
|
|
|
|
- return "ok";
|
|
|
|
|
|
+// ollamaUtil.chatDeepSeek("deepseek-r1:1.5b", param.getQuestion(), userId);
|
|
|
|
+ ollamaUtil.chatDeepSeek("deepseek-r1:7b", param.getQuestion(), userId);
|
|
|
|
+
|
|
|
|
+ return Result.success();
|
|
}
|
|
}
|
|
|
|
|
|
}
|
|
}
|