|
@@ -118,7 +118,10 @@ public class DeepSeekClient {
|
|
System.out.println("-------------------- 开始流式回答: --------------------");
|
|
System.out.println("-------------------- 开始流式回答: --------------------");
|
|
|
|
|
|
// [SSE] 发送消息
|
|
// [SSE] 发送消息
|
|
- sseUtil.send(emitterKey, (new SseResponse(SseResponseEnum.DEEPSEEK, "正在思考")).toJsonStr());
|
|
|
|
|
|
+ DSContent initContent = new DSContent();
|
|
|
|
+ initContent.setContent_type("loading");
|
|
|
|
+ initContent.setContent("正在思考");
|
|
|
|
+ sseUtil.send(emitterKey, (new SseResponse(SseResponseEnum.DEEPSEEK, initContent)).toJsonStr());
|
|
|
|
|
|
StringBuilder allContent = new StringBuilder();
|
|
StringBuilder allContent = new StringBuilder();
|
|
StringBuilder allReasoning = new StringBuilder();
|
|
StringBuilder allReasoning = new StringBuilder();
|
|
@@ -149,7 +152,7 @@ public class DeepSeekClient {
|
|
JsonNode node = objectMapper.readTree(jsonData);
|
|
JsonNode node = objectMapper.readTree(jsonData);
|
|
JsonNode delta = node.path("choices").path(0).path("delta");
|
|
JsonNode delta = node.path("choices").path(0).path("delta");
|
|
|
|
|
|
- // [推理]
|
|
|
|
|
|
+ // [推理] Think
|
|
String reasoning_content = delta.path("reasoning_content").asText("");
|
|
String reasoning_content = delta.path("reasoning_content").asText("");
|
|
if (!reasoning_content.isEmpty()) {
|
|
if (!reasoning_content.isEmpty()) {
|
|
|
|
|
|
@@ -157,7 +160,7 @@ public class DeepSeekClient {
|
|
|
|
|
|
// [SSE] 发送消息
|
|
// [SSE] 发送消息
|
|
DSContent dsContent = new DSContent();
|
|
DSContent dsContent = new DSContent();
|
|
- dsContent.setModel(model);
|
|
|
|
|
|
+ dsContent.setContent_type("think");
|
|
dsContent.setContent(reasoning_content);
|
|
dsContent.setContent(reasoning_content);
|
|
sseUtil.send(emitterKey, (new SseResponse(SseResponseEnum.DEEPSEEK, dsContent)).toJsonStr());
|
|
sseUtil.send(emitterKey, (new SseResponse(SseResponseEnum.DEEPSEEK, dsContent)).toJsonStr());
|
|
|
|
|
|
@@ -165,14 +168,14 @@ public class DeepSeekClient {
|
|
allReasoning.append(reasoning_content);
|
|
allReasoning.append(reasoning_content);
|
|
}
|
|
}
|
|
|
|
|
|
- // [回答]
|
|
|
|
|
|
+ // [回答] Reply
|
|
String content = delta.path("content").asText("");
|
|
String content = delta.path("content").asText("");
|
|
if (!content.isEmpty()) {
|
|
if (!content.isEmpty()) {
|
|
System.out.println("content: " + content);
|
|
System.out.println("content: " + content);
|
|
|
|
|
|
// [SSE] 发送消息
|
|
// [SSE] 发送消息
|
|
DSContent dsContent = new DSContent();
|
|
DSContent dsContent = new DSContent();
|
|
- dsContent.setModel(model);
|
|
|
|
|
|
+ dsContent.setContent_type("reply");
|
|
dsContent.setContent(content);
|
|
dsContent.setContent(content);
|
|
sseUtil.send(emitterKey, (new SseResponse(SseResponseEnum.DEEPSEEK, dsContent)).toJsonStr());
|
|
sseUtil.send(emitterKey, (new SseResponse(SseResponseEnum.DEEPSEEK, dsContent)).toJsonStr());
|
|
|
|
|