misc: set default TTS to xiaoai

This commit is contained in:
WJG 2024-02-28 14:44:54 +08:00
parent 0e56bdff35
commit 0f38e6b9cc
No known key found for this signature in database
GPG Key ID: 258474EF8590014A

View File

@ -62,7 +62,7 @@ export class BaseSpeaker {
async unWakeUp() { async unWakeUp() {
// 通过 TTS 不发音文本,使小爱退出唤醒状态 // 通过 TTS 不发音文本,使小爱退出唤醒状态
await this.MiNA!.pause() await this.MiNA!.pause();
await this.MiIOT!.doAction(5, 1, kAreYouOK); await this.MiIOT!.doAction(5, 1, kAreYouOK);
} }
@ -86,6 +86,11 @@ export class BaseSpeaker {
tts = this.tts, tts = this.tts,
} = options ?? {}; } = options ?? {};
const doubaoTTS = process.env.TTS_DOUBAO;
if (!doubaoTTS) {
tts = "xiaoai"; // 没有提供豆包语音接口时,只能使用小爱自带 TTS
}
const ttsNotXiaoai = (!!stream || !!text) && !audio && tts !== "xiaoai"; const ttsNotXiaoai = (!!stream || !!text) && !audio && tts !== "xiaoai";
playSFX = ttsNotXiaoai && playSFX; playSFX = ttsNotXiaoai && playSFX;