|
|
@@ -104,6 +104,25 @@ public abstract class AbstractChatRobot implements IChatRobot {
|
|
|
return TtsProvider.XFYUN.equalsIgnoreCase(ttsProvider);
|
|
|
}
|
|
|
|
|
|
+ protected boolean isTxTts1Provider() {
|
|
|
+ return TtsProvider.TX_TTS1.equalsIgnoreCase(ttsProvider);
|
|
|
+ }
|
|
|
+
|
|
|
+ protected boolean isTxTts1FlushBoundary(String input) {
|
|
|
+ if (StringUtils.isEmpty(input)) {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ String lastChar = input.substring(input.length() - 1);
|
|
|
+ return "。".equals(lastChar)
|
|
|
+ || ".".equals(lastChar)
|
|
|
+ || "!".equals(lastChar)
|
|
|
+ || "!".equals(lastChar)
|
|
|
+ || "?".equals(lastChar)
|
|
|
+ || "?".equals(lastChar)
|
|
|
+ || ";".equals(lastChar)
|
|
|
+ || ";".equals(lastChar);
|
|
|
+ }
|
|
|
+
|
|
|
protected boolean useXfyunCloneDirectTts() {
|
|
|
return isXfyunTtsProvider()
|
|
|
&& "clone".equalsIgnoreCase(StringUtils.trimToEmpty(getAccount().ttsModels))
|
|
|
@@ -114,8 +133,8 @@ public abstract class AbstractChatRobot implements IChatRobot {
|
|
|
if (isXfyunTtsProvider()) {
|
|
|
return false;
|
|
|
}
|
|
|
- if (TtsProvider.TX_TTS1.equalsIgnoreCase(ttsProvider)) {
|
|
|
- return false;
|
|
|
+ if (isTxTts1Provider()) {
|
|
|
+ return ttsTextLength >= 5 && isTxTts1FlushBoundary(speechContent);
|
|
|
}
|
|
|
return ttsTextLength >= 5 && checkPauseFlag(speechContent);
|
|
|
}
|