瀏覽代碼

调整 ollama

tsurumure 6 月之前
父節點
當前提交
6f1fe9c501

+ 3 - 2
src/main/java/com/backendsys/modules/sdk/deepseek/utils/OllamaUtil.java

@@ -103,6 +103,7 @@ public class OllamaUtil {
                         /*
                             ---------------------- line ----------------------
                             {"model":"deepseek-r1:1.5b","created_at":"2025-03-05T10:51:17.443189986Z","response":"\u003cthink\u003e","done":false}
+                            {"model":"deepseek-r1:1.5b","created_at":"2025-03-06T11:08:30.9219611Z","response":"\n\n","done":false}
                             --------------------------------------------------
                          */
 
@@ -136,7 +137,7 @@ public class OllamaUtil {
                         if (isThinking) {
                             System.out.println("think: " + content);
 
-                            if (!content.contains("<think>") && !content.contains("\n\n")) {
+                            if (!content.contains("<think>") && !content.contains("\\n\\n")) {
                                 // [SSE] 发送消息
                                 ChatSseMessage chatSseMessage = new ChatSseMessage("THINK", content);
                                 sseUtil.send(user_id, new SseResponse(SseResponseEnum.DEEPSEEK, chatSseMessage).toJsonStr());
@@ -150,7 +151,7 @@ public class OllamaUtil {
                         if (!isThinking) {
                             System.out.println("content: " + content);
 
-                            if (!content.contains("</think>") && !content.contains("\n\n")) {
+                            if (!content.contains("</think>") && !content.contains("\\n\\n")) {
                                 // [SSE] 发送消息
                                 ChatSseMessage chatSseMessage = new ChatSseMessage("REPLY", content);
                                 sseUtil.send(user_id, new SseResponse(SseResponseEnum.DEEPSEEK, chatSseMessage).toJsonStr());

+ 2 - 2
src/main/resources/application-local.yml

@@ -164,8 +164,8 @@ baidu:
 ai:
   config:
     deepseek:
-#      domain: http://localhost:11434
-      domain: https://1wd05129tf963.vicp.fun
+      domain: http://localhost:11434
+#      domain: https://1wd05129tf963.vicp.fun
 
 deepseek:
   url: https://api.deepseek.com