TTS 返回语音优化
This commit is contained in:
@@ -115,21 +115,22 @@ public class OpenAiStreamClient {
|
||||
.getJSONObject("delta")
|
||||
.getStr("content");
|
||||
|
||||
if (content != null && !content.isEmpty()) {
|
||||
if(punctuationSet.contains(content)){
|
||||
//说明有标点啦,直接返回
|
||||
bufferStr.append(content);
|
||||
listener.onMessage(bufferStr.toString());
|
||||
}else{
|
||||
//加入缓冲区
|
||||
if(StrUtil.isEmpty(bufferStr.toString())){
|
||||
bufferStr.append(content);
|
||||
}else {
|
||||
bufferStr.append(" ").append(content);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
// if (content != null && !content.isEmpty()) {
|
||||
// if(punctuationSet.contains(content)){
|
||||
// //说明有标点啦,直接返回
|
||||
// bufferStr.append(content);
|
||||
// listener.onMessage(bufferStr.toString());
|
||||
// }else{
|
||||
// //加入缓冲区
|
||||
// if(StrUtil.isEmpty(bufferStr.toString())){
|
||||
// bufferStr.append(content);
|
||||
// }else {
|
||||
// bufferStr.append(" ").append(content);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// }
|
||||
listener.onMessage(content);
|
||||
} catch (Exception e) {
|
||||
listener.onError(new IOException("Parse error: " + e.getMessage()));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user