|
@@ -1,69 +1,69 @@
|
|
|
-package com.backendsys.modules.sdk.deepseek.controller;
|
|
|
-
|
|
|
-import com.backendsys.modules.sdk.deepseek.entity.DSParam;
|
|
|
-import com.backendsys.modules.sdk.deepseek.service.DeepSeekClient;
|
|
|
-import com.backendsys.modules.sdk.deepseek.service.impl.DeepSeekClientImpl;
|
|
|
-import com.backendsys.modules.sdk.deepseek.utils.OllamaUtil;
|
|
|
-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.tags.Tag;
|
|
|
-import org.springframework.beans.factory.annotation.Autowired;
|
|
|
-import org.springframework.security.access.prepost.PreAuthorize;
|
|
|
-import org.springframework.validation.annotation.Validated;
|
|
|
-import org.springframework.web.bind.annotation.GetMapping;
|
|
|
-import org.springframework.web.bind.annotation.PostMapping;
|
|
|
-import org.springframework.web.bind.annotation.RequestBody;
|
|
|
-import org.springframework.web.bind.annotation.RestController;
|
|
|
-
|
|
|
-import java.util.concurrent.CompletableFuture;
|
|
|
-
|
|
|
-@Validated
|
|
|
-@RestController
|
|
|
-@Tag(name = "DeepSeek")
|
|
|
-public class DeepSeekController {
|
|
|
-
|
|
|
- @Autowired
|
|
|
- private OllamaUtil ollamaUtil;
|
|
|
-
|
|
|
- @Autowired
|
|
|
- private DeepSeekClient deepSeekClient;
|
|
|
-
|
|
|
- /**
|
|
|
- * Deepseek API 开放平台 (https://platform.deepseek.com)
|
|
|
- * 现有模型:
|
|
|
- * - deepseek-chat 对话模型
|
|
|
- * - deepseek-reasoner 推理模型
|
|
|
- */
|
|
|
- @Operation(summary = "DS-提问 (API)")
|
|
|
- @PreAuthorize("@sr.hasPermission('101')")
|
|
|
- @PostMapping("/api/deepSeek/chat")
|
|
|
- public Result chat(@Validated @RequestBody DSParam param) {
|
|
|
-
|
|
|
-// // 创建一个 CompletableFuture 来执行异步任务
|
|
|
-// CompletableFuture<Void> future = CompletableFuture.runAsync(() -> {
|
|
|
-// deepSeekClient.chatCompletion(param.getModel(), param.getPrompt());
|
|
|
-// });
|
|
|
- return Result.success().put("data", deepSeekClient.chatCompletion(SecurityUtil.getUserId(), param.getModel(), param.getPrompt(), null, null));
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * Deepseek 本地部署模型:
|
|
|
- * - deepseek-r1:1.5b
|
|
|
- * - deepseek-r1:7b
|
|
|
- */
|
|
|
- @Operation(summary = "DS-提问 (本地部署)")
|
|
|
- @PreAuthorize("@sr.hasPermission('101')")
|
|
|
- @PostMapping("/api/deepSeek/chatLocal")
|
|
|
- public Result chatLocal(@Validated @RequestBody DSParam param) {
|
|
|
- return Result.success().put("data", ollamaUtil.chatCompletion(SecurityUtil.getUserId(), param.getModel(), param.getPrompt(), null, null));
|
|
|
- }
|
|
|
-
|
|
|
- @Operation(summary = "DS-获得模型列表")
|
|
|
- @PreAuthorize("@sr.hasPermission('101')")
|
|
|
- @GetMapping("/api/deepSeek/getModels")
|
|
|
- public Result getModels() {
|
|
|
- return Result.success().put("data", deepSeekClient.getModels(SecurityUtil.getUserId()));
|
|
|
- }
|
|
|
-
|
|
|
-}
|
|
|
+//package com.backendsys.modules.sdk.deepseek.controller;
|
|
|
+//
|
|
|
+//import com.backendsys.modules.sdk.deepseek.entity.DSParam;
|
|
|
+//import com.backendsys.modules.sdk.deepseek.service.DeepSeekClient;
|
|
|
+//import com.backendsys.modules.sdk.deepseek.service.impl.DeepSeekClientImpl;
|
|
|
+//import com.backendsys.modules.sdk.deepseek.utils.OllamaUtil;
|
|
|
+//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.tags.Tag;
|
|
|
+//import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+//import org.springframework.security.access.prepost.PreAuthorize;
|
|
|
+//import org.springframework.validation.annotation.Validated;
|
|
|
+//import org.springframework.web.bind.annotation.GetMapping;
|
|
|
+//import org.springframework.web.bind.annotation.PostMapping;
|
|
|
+//import org.springframework.web.bind.annotation.RequestBody;
|
|
|
+//import org.springframework.web.bind.annotation.RestController;
|
|
|
+//
|
|
|
+//import java.util.concurrent.CompletableFuture;
|
|
|
+//
|
|
|
+//@Validated
|
|
|
+//@RestController
|
|
|
+//@Tag(name = "DeepSeek")
|
|
|
+//public class DeepSeekController {
|
|
|
+//
|
|
|
+// @Autowired
|
|
|
+// private OllamaUtil ollamaUtil;
|
|
|
+//
|
|
|
+// @Autowired
|
|
|
+// private DeepSeekClient deepSeekClient;
|
|
|
+//
|
|
|
+// /**
|
|
|
+// * Deepseek API 开放平台 (https://platform.deepseek.com)
|
|
|
+// * 现有模型:
|
|
|
+// * - deepseek-chat 对话模型
|
|
|
+// * - deepseek-reasoner 推理模型
|
|
|
+// */
|
|
|
+// @Operation(summary = "DS-提问 (API)")
|
|
|
+// @PreAuthorize("@sr.hasPermission('101')")
|
|
|
+// @PostMapping("/api/deepSeek/chat")
|
|
|
+// public Result chat(@Validated @RequestBody DSParam param) {
|
|
|
+//
|
|
|
+//// // 创建一个 CompletableFuture 来执行异步任务
|
|
|
+//// CompletableFuture<Void> future = CompletableFuture.runAsync(() -> {
|
|
|
+//// deepSeekClient.chatCompletion(param.getModel(), param.getPrompt());
|
|
|
+//// });
|
|
|
+// return Result.success().put("data", deepSeekClient.chatCompletion(SecurityUtil.getUserId(), param.getModel(), param.getPrompt(), null, null));
|
|
|
+// }
|
|
|
+//
|
|
|
+// /**
|
|
|
+// * Deepseek 本地部署模型:
|
|
|
+// * - deepseek-r1:1.5b
|
|
|
+// * - deepseek-r1:7b
|
|
|
+// */
|
|
|
+// @Operation(summary = "DS-提问 (本地部署)")
|
|
|
+// @PreAuthorize("@sr.hasPermission('101')")
|
|
|
+// @PostMapping("/api/deepSeek/chatLocal")
|
|
|
+// public Result chatLocal(@Validated @RequestBody DSParam param) {
|
|
|
+// return Result.success().put("data", ollamaUtil.chatCompletion(SecurityUtil.getUserId(), param.getModel(), param.getPrompt(), null, null));
|
|
|
+// }
|
|
|
+//
|
|
|
+// @Operation(summary = "DS-获得模型列表")
|
|
|
+// @PreAuthorize("@sr.hasPermission('101')")
|
|
|
+// @GetMapping("/api/deepSeek/getModels")
|
|
|
+// public Result getModels() {
|
|
|
+// return Result.success().put("data", deepSeekClient.getModels(SecurityUtil.getUserId()));
|
|
|
+// }
|
|
|
+//
|
|
|
+//}
|