去掉语句的头尾标点符号

This commit is contained in:
wulin 2023-10-25 10:05:07 +08:00
parent c6ccf6e6b4
commit 00ce4c3731

View File

@ -217,6 +217,14 @@ public class BaseWebSocketService {
//标点符号起始会导致合成的声音第一句话有杂音
text = text.substring(1);
}
if(text.endsWith("") ||
text.endsWith("") ||
text.endsWith("") ||
text.endsWith("") ||
text.endsWith("") ||
text.endsWith(" ")){
text = text.substring(0, text.length() - 1);
}
if(text.length() > ONE_MAX_TEXT){
StringBuilder builder = new StringBuilder();
sendAudioMessage(baseSession,
@ -229,6 +237,7 @@ public class BaseWebSocketService {
}else{
BoxMessageResp boxMessageResp = new BoxMessageResp();
BeanUtils.copyProperties(baseMessageResp, boxMessageResp);
boxMessageResp.setText(text);
sendAudioMessage(baseSession, boxMessageResp).subscribe();
}
return;
@ -354,4 +363,5 @@ public class BaseWebSocketService {
return dv;
});
}
}