diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/home/LawController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/home/LawController.java index 67477ec..339eb0b 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/home/LawController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/home/LawController.java @@ -2,6 +2,7 @@ package com.ruoyi.web.controller.home; import cn.hutool.core.convert.Convert; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.fasterxml.jackson.core.JsonProcessingException; import com.github.pagehelper.PageInfo; import com.github.pagehelper.page.PageMethod; import com.ruoyi.common.core.controller.BaseController; @@ -99,8 +100,8 @@ public class LawController extends BaseController { @Autowired private DeepSeekLocalService deepSeekLocalService; - @GetMapping("/call-local-deepseek") - public R callLocalDeepSeek(@RequestParam(required = false) String content) { + @PostMapping("/call-local-deepseek") + public R callLocalDeepSeek(@RequestParam(required = false) String content) throws JsonProcessingException { return R.ok(deepSeekLocalService.callLocalDeepSeek(content)); } diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/DeepSeekLocalService.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/DeepSeekLocalService.java index 7697667..e8e5d2a 100644 --- a/ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/DeepSeekLocalService.java +++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/DeepSeekLocalService.java @@ -18,7 +18,7 @@ import java.util.Arrays; @Service public class DeepSeekLocalService { - private static final String LOCAL_API_URL = "http://localhost:8081/chat/completions"; + private static final String LOCAL_API_URL = "http://192.168.110.56:11434/v1/chat/completions"; private final RestTemplate restTemplate; @@ -41,7 +41,7 @@ public class DeepSeekLocalService { userMessage.setContent(content); DeepSeekRequest requestBody = new DeepSeekRequest(); - requestBody.setModel("deepseek-chat"); + requestBody.setModel("deepseek-r1:1.5b"); requestBody.setMessages(Arrays.asList(systemMessage, userMessage)); requestBody.setStream(false); // 创建 HttpEntity @@ -55,6 +55,8 @@ public class DeepSeekLocalService { ); // 处理响应 if (response.getStatusCode() == HttpStatus.OK) { + System.out.println("成功了!"); + System.out.println("返回数据: " + response.getBody()); return response.getBody(); } else { throw new RuntimeException("Request failed with status code: " + response.getStatusCode());