Commit 0785404c authored by leiming's avatar leiming

1、调整后台接收前端发送数据量

2、对调用进行json包装
parent 62de82cd
Pipeline #6408 canceled with stages
......@@ -4,6 +4,7 @@ package admin.listener;
import admin.model.deepseek.resp.stream.ChatStreamResponse;
import admin.model.maxdb.resp.MaxdbStreamResponse;
import admin.service.TextToSpeechService;
import com.alibaba.fastjson.JSON;
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.google.gson.Gson;
......@@ -17,6 +18,8 @@ import okhttp3.sse.EventSourceListener;
import javax.annotation.Resource;
import javax.websocket.Session;
import java.net.SocketException;
import java.util.HashMap;
import java.util.Map;
import java.util.Objects;
/**
......@@ -60,7 +63,12 @@ public class DeepSeekAiListener extends EventSourceListener {
if (completionResponse.getContent()!=null){
System.out.print(completionResponse.getContent());
this.stringBuffer.append(completionResponse.getContent());
this.session.getBasicRemote().sendText(completionResponse.getContent());
Map<String,Object> map = new HashMap<>();
map.put("action","reply");
map.put("type","text");
map.put("content",completionResponse.getContent());
String msg = JSON.toJSONString(map);
this.session.getBasicRemote().sendText(msg);
}
}catch (Exception e){
System.out.println(e.getMessage());
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment