|
@@ -64,7 +64,7 @@ public class KimiChatServiceImpl extends ServiceImpl<KimiChatMapper, KimiChat> i
|
|
|
return headers;
|
|
|
}
|
|
|
|
|
|
- public void chatCompletions(KimiRequest kimiRequest, Long dataId) {
|
|
|
+ public void chatCompletions(KimiRequest kimiRequest, Long groupId) {
|
|
|
|
|
|
HttpClient client = HttpClient.newBuilder().build();
|
|
|
|
|
@@ -89,9 +89,9 @@ public class KimiChatServiceImpl extends ServiceImpl<KimiChatMapper, KimiChat> i
|
|
|
while ((line = reader.readLine()) != null) {
|
|
|
log.info("流数据 -- {} ", line);
|
|
|
if (!TextUtils.isEmpty(line)) {
|
|
|
- sseService.sendData( dataId, line );
|
|
|
+ sseService.sendData( groupId, line );
|
|
|
if (!"data: [DONE]".equals(line) && !line.isEmpty()) {
|
|
|
- stream2db(line.substring(6), dataId);
|
|
|
+ stream2db(line.substring(6), groupId);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -102,12 +102,14 @@ public class KimiChatServiceImpl extends ServiceImpl<KimiChatMapper, KimiChat> i
|
|
|
try {
|
|
|
reader.close();
|
|
|
resp.close();
|
|
|
+
|
|
|
} catch (IOException e) {
|
|
|
log.error("关闭链接异常 {}", e.getMessage());
|
|
|
}
|
|
|
}
|
|
|
|
|
|
}).join();
|
|
|
+ sseService.complate(groupId);
|
|
|
}
|
|
|
|
|
|
private void stream2db(String resp, Long groupId){
|