修复回复内容过长时,同时回复语音的问题

This commit is contained in:
ifeif 2023-12-09 22:50:24 +08:00
parent 4a6cad2e4e
commit f4fccf957f

View file

@ -1302,11 +1302,13 @@ export class chatgpt extends plugin {
this.reply(`建议的回复:\n${chatMessage.suggestedResponses}`) this.reply(`建议的回复:\n${chatMessage.suggestedResponses}`)
} }
} }
const sendable = await generateAudio(this.e, ttsResponse, emotion, emotionDegree) if(ttsResponse.length <= parseInt(Config.ttsAutoFallbackThreshold)) {
if (sendable) { const sendable = await generateAudio(this.e, ttsResponse, emotion, emotionDegree)
await this.reply(sendable) if (sendable) {
} else { await this.reply(sendable)
await this.reply('合成语音发生错误~') } else {
await this.reply('合成语音发生错误~')
}
} }
} else if (userSetting.usePicture || (Config.autoUsePicture && response.length > Config.autoUsePictureThreshold)) { } else if (userSetting.usePicture || (Config.autoUsePicture && response.length > Config.autoUsePictureThreshold)) {
// todo use next api of chatgpt to complete incomplete respoonse // todo use next api of chatgpt to complete incomplete respoonse