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

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}`)
}
}
const sendable = await generateAudio(this.e, ttsResponse, emotion, emotionDegree)
if (sendable) {
await this.reply(sendable)
} else {
await this.reply('合成语音发生错误~')
if(ttsResponse.length <= parseInt(Config.ttsAutoFallbackThreshold)) {
const sendable = await generateAudio(this.e, ttsResponse, emotion, emotionDegree)
if (sendable) {
await this.reply(sendable)
} else {
await this.reply('合成语音发生错误~')
}
}
} else if (userSetting.usePicture || (Config.autoUsePicture && response.length > Config.autoUsePictureThreshold)) {
// todo use next api of chatgpt to complete incomplete respoonse