|
@@ -124,9 +124,7 @@ public class DeepSeekClientImpl implements DeepSeekClient {
|
|
System.out.println("-------------------- 开始流式回答: --------------------");
|
|
System.out.println("-------------------- 开始流式回答: --------------------");
|
|
|
|
|
|
// [SSE] 发送消息
|
|
// [SSE] 发送消息
|
|
- ChatSseMessage chatLoadingSseMessage = new ChatSseMessage();
|
|
|
|
- chatLoadingSseMessage.setContent_type("loading");
|
|
|
|
- chatLoadingSseMessage.setContent("正在思考");
|
|
|
|
|
|
+ ChatSseMessage chatLoadingSseMessage = new ChatSseMessage("LOADING", "正在思考");
|
|
sseUtil.send(user_id, new SseResponse(SseResponseEnum.DEEPSEEK, chatLoadingSseMessage).toJsonStr());
|
|
sseUtil.send(user_id, new SseResponse(SseResponseEnum.DEEPSEEK, chatLoadingSseMessage).toJsonStr());
|
|
|
|
|
|
StringBuilder allContent = new StringBuilder();
|
|
StringBuilder allContent = new StringBuilder();
|
|
@@ -171,9 +169,7 @@ public class DeepSeekClientImpl implements DeepSeekClient {
|
|
System.out.println("reasoning_content: " + reasoning_content);
|
|
System.out.println("reasoning_content: " + reasoning_content);
|
|
|
|
|
|
// [SSE] 发送消息
|
|
// [SSE] 发送消息
|
|
- ChatSseMessage chatSseMessage = new ChatSseMessage();
|
|
|
|
- chatSseMessage.setContent_type("think");
|
|
|
|
- chatSseMessage.setContent(reasoning_content);
|
|
|
|
|
|
+ ChatSseMessage chatSseMessage = new ChatSseMessage("THINK", reasoning_content);
|
|
sseUtil.send(user_id, new SseResponse(SseResponseEnum.DEEPSEEK, chatSseMessage).toJsonStr());
|
|
sseUtil.send(user_id, new SseResponse(SseResponseEnum.DEEPSEEK, chatSseMessage).toJsonStr());
|
|
|
|
|
|
// 收集推理内容
|
|
// 收集推理内容
|
|
@@ -190,14 +186,17 @@ public class DeepSeekClientImpl implements DeepSeekClient {
|
|
reasoningContentDuration = thinkStartTime - allStartTime;
|
|
reasoningContentDuration = thinkStartTime - allStartTime;
|
|
System.out.println("推理耗时: " + reasoningContentDuration + "毫秒");
|
|
System.out.println("推理耗时: " + reasoningContentDuration + "毫秒");
|
|
System.out.println("-----------------------------------------------");
|
|
System.out.println("-----------------------------------------------");
|
|
|
|
+
|
|
|
|
+ // [SSE] 发送消息
|
|
|
|
+ ChatSseMessage chatSseMessage = new ChatSseMessage("THINK", "[DONE][THINK]", reasoningContentDuration);
|
|
|
|
+ sseUtil.send(user_id, new SseResponse(SseResponseEnum.DEEPSEEK, chatSseMessage).toJsonStr());
|
|
|
|
+
|
|
}
|
|
}
|
|
|
|
|
|
System.out.println("content: " + content);
|
|
System.out.println("content: " + content);
|
|
|
|
|
|
// [SSE] 发送消息
|
|
// [SSE] 发送消息
|
|
- ChatSseMessage chatSseMessage = new ChatSseMessage();
|
|
|
|
- chatSseMessage.setContent_type("reply");
|
|
|
|
- chatSseMessage.setContent(content);
|
|
|
|
|
|
+ ChatSseMessage chatSseMessage = new ChatSseMessage("REPLY", content);
|
|
sseUtil.send(user_id, new SseResponse(SseResponseEnum.DEEPSEEK, chatSseMessage).toJsonStr());
|
|
sseUtil.send(user_id, new SseResponse(SseResponseEnum.DEEPSEEK, chatSseMessage).toJsonStr());
|
|
|
|
|
|
// 收集回答内容
|
|
// 收集回答内容
|
|
@@ -215,6 +214,10 @@ public class DeepSeekClientImpl implements DeepSeekClient {
|
|
System.out.println("全部回答: " + allContent);
|
|
System.out.println("全部回答: " + allContent);
|
|
System.out.println("总输出耗时: " + contentDuration + " 毫秒");
|
|
System.out.println("总输出耗时: " + contentDuration + " 毫秒");
|
|
|
|
|
|
|
|
+ // [SSE] 发送消息
|
|
|
|
+ ChatSseMessage chatSseMessage = new ChatSseMessage("REPLY", "[DONE][REPLY]", contentDuration);
|
|
|
|
+ sseUtil.send(user_id, new SseResponse(SseResponseEnum.DEEPSEEK, chatSseMessage).toJsonStr());
|
|
|
|
+
|
|
chatResult.setReasoning_content(allReasoningContent.toString());
|
|
chatResult.setReasoning_content(allReasoningContent.toString());
|
|
chatResult.setReasoning_duration(reasoningContentDuration);
|
|
chatResult.setReasoning_duration(reasoningContentDuration);
|
|
chatResult.setContent(allContent.toString());
|
|
chatResult.setContent(allContent.toString());
|