简历解析业务逻辑处理
This commit is contained in:
@@ -71,6 +71,7 @@ public class ElevenLabsStreamClient {
|
||||
ByteArrayOutputStream smallChunkBuffer = new ByteArrayOutputStream();
|
||||
byte[] buffer = new byte[4096];
|
||||
int bytesRead;
|
||||
log.info("开始发送语音流:{}",System.currentTimeMillis()/1000);
|
||||
while ((bytesRead = inputStream.read(buffer)) != -1) {
|
||||
try{
|
||||
// 如果上一包还在发送 → 阻塞等待
|
||||
@@ -80,10 +81,10 @@ public class ElevenLabsStreamClient {
|
||||
}
|
||||
}catch (Exception e){}
|
||||
//语音流合并到2KB左右进行发送
|
||||
if(smallChunkBuffer.size() >= 3072){
|
||||
if(smallChunkBuffer.size() >= 4096){
|
||||
// 🔥开始发送 → 上锁
|
||||
sending[0] = true;
|
||||
log.info("语音流大于"+smallChunkBuffer.size()+"啦,发送完成!!!");
|
||||
// log.info("语音流大于"+smallChunkBuffer.size()+"啦,发送完成!!!");
|
||||
byte[] merged = smallChunkBuffer.toByteArray();
|
||||
smallChunkBuffer.reset();
|
||||
session.getAsyncRemote().sendBinary(ByteBuffer.wrap(merged), result -> {
|
||||
@@ -99,16 +100,19 @@ public class ElevenLabsStreamClient {
|
||||
}
|
||||
//都加完缓冲区,最最后一次发送
|
||||
if(smallChunkBuffer.size() > 2){
|
||||
try {
|
||||
Thread.sleep(50);
|
||||
}catch (Exception e){}
|
||||
// 如果上一包还在发送 → 阻塞等待
|
||||
byte[] merged = smallChunkBuffer.toByteArray();
|
||||
smallChunkBuffer.reset();
|
||||
session.getAsyncRemote().sendBinary(ByteBuffer.wrap(merged), result -> {
|
||||
log.info("最后一次发送,语音流大于"+smallChunkBuffer.size()+"啦,发送完成!!!");
|
||||
});
|
||||
}
|
||||
log.info("结束发送语音流:{}",System.currentTimeMillis()/1000);
|
||||
//返回结束点
|
||||
try {
|
||||
Thread.sleep(20);
|
||||
Thread.sleep(50);
|
||||
}catch (Exception e){}
|
||||
Map<String,String> dataText = new HashMap<>();
|
||||
dataText.put("type","voiceEnd");
|
||||
|
||||
@@ -39,6 +39,9 @@ public class ChatGPTClient {
|
||||
@Value("${chatGpt.modelCV}")
|
||||
private String modelCV;
|
||||
|
||||
@Value("${chatGpt.modelJxCv}")
|
||||
private String modelJxCv;
|
||||
|
||||
@Value("${chatGpt.role}")
|
||||
private String role;
|
||||
|
||||
@@ -66,6 +69,8 @@ public class ChatGPTClient {
|
||||
resultText = sendMessage(promptText, modelQuestion,objectMapper,client,role);
|
||||
} else if("PF".equals(type)){
|
||||
resultText = sendMessage(promptText, model,objectMapper,client,role);
|
||||
}else if("JX".equals(type)){
|
||||
resultText = sendMessage(promptText, modelJxCv,objectMapper,client,role);
|
||||
}else {
|
||||
resultText = sendMessage(promptText, modelQuestion,objectMapper,client,role);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user