mirror of
https://github.com/ikechan8370/chatgpt-plugin.git
synced 2025-12-16 13:27:08 +00:00
增加语音合成失败处理。 (#278)
This commit is contained in:
parent
1432723de5
commit
73689f4639
1 changed files with 39 additions and 32 deletions
|
|
@ -498,6 +498,7 @@ export class chatgpt extends plugin {
|
|||
if (e.isGroup && !e.atme) {
|
||||
return false
|
||||
}
|
||||
if (e.user_id == Bot.uin) return false
|
||||
prompt = e.msg.trim()
|
||||
} else {
|
||||
let ats = e.message.filter(m => m.type === 'at')
|
||||
|
|
@ -740,9 +741,15 @@ export class chatgpt extends plugin {
|
|||
}
|
||||
if (useTTS) {
|
||||
if (Config.ttsSpace && response.length <= Config.ttsAutoFallbackThreshold) {
|
||||
let audio_err = false
|
||||
try {
|
||||
let wav = await generateAudio(response, speaker, '中日混合(中文用[ZH][ZH]包裹起来,日文用[JA][JA]包裹起来)')
|
||||
await e.reply(segment.record(wav))
|
||||
if (Config.alsoSendText) {
|
||||
} catch (err) {
|
||||
await this.reply('合成语音发生错误,我用文本回复你吧')
|
||||
audio_err = true
|
||||
}
|
||||
if (Config.alsoSendText || audio_err) {
|
||||
await this.reply(`${response}`, e.isGroup)
|
||||
if (quotemessage.length > 0) {
|
||||
this.reply(await makeForwardMsg(this.e, quotemessage))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue