|
@@ -78,12 +78,14 @@ log.info("发送kimi数据 {}", JSON.toJSONString(kimiRequest));
|
|
|
.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);
|
|
|
- }
|
|
|
- });
|
|
|
+ if (!TextUtils.isEmpty(resp)){
|
|
|
+ Arrays.stream(resp.split("\n")).forEach(x -> {
|
|
|
+ if(!TextUtils.isEmpty(x.replaceAll("\n", "").trim())){
|
|
|
+ sseService.sendData( dataId, x );
|
|
|
+ stream2db(x.substring(6), dataId);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
|
|
|
})
|
|
|
.join();
|
|
@@ -96,7 +98,7 @@ log.info("发送kimi数据 {}", JSON.toJSONString(kimiRequest));
|
|
|
try{
|
|
|
kimiResponse = JSON.parseObject(resp, KimiStreamResponse.class);
|
|
|
}catch (Exception e){
|
|
|
- log.error("解析失败 -- ",resp);
|
|
|
+ log.error("解析失败 -- {}",resp);
|
|
|
return;
|
|
|
}
|
|
|
|