|
@@ -23,6 +23,7 @@ import java.net.http.HttpRequest;
|
|
|
import java.net.http.HttpResponse;
|
|
|
import java.time.LocalDateTime;
|
|
|
import java.util.ArrayList;
|
|
|
+import java.util.Arrays;
|
|
|
import java.util.List;
|
|
|
|
|
|
/**
|
|
@@ -74,13 +75,16 @@ log.info("发送kimi数据 {}", JSON.toJSONString(kimiRequest));
|
|
|
// 发送请求并接收响应
|
|
|
client.sendAsync(request, HttpResponse.BodyHandlers.ofString())
|
|
|
.thenApply(HttpResponse::body)
|
|
|
- .thenAccept(x -> {
|
|
|
- log.info("流数据 -- ",x);
|
|
|
- if(!TextUtils.isEmpty(x.replaceAll("\n", "").trim())){
|
|
|
+ .thenAccept(resp -> {
|
|
|
+// System.out.println(x);
|
|
|
+ log.info("流数据 -- {}",resp);
|
|
|
+ Arrays.stream(resp.split("\n")).forEach(x -> {
|
|
|
+ if(!TextUtils.isEmpty(x.replaceAll("\n", "").trim())){
|
|
|
+ sseService.sendData( dataId, x );
|
|
|
+ stream2db(x.substring(6), dataId);
|
|
|
+ }
|
|
|
+ });
|
|
|
|
|
|
- sseService.sendData( dataId, x );
|
|
|
- stream2db(x.substring(6), dataId);
|
|
|
- }
|
|
|
})
|
|
|
.join();
|
|
|
|