mirror of
https://github.com/ikechan8370/chatgpt-plugin.git
synced 2025-12-16 21:37:11 +00:00
fix: 设置不存在的角色语音时给提示
This commit is contained in:
parent
a54f87667a
commit
c9361c63b4
2 changed files with 7 additions and 2 deletions
|
|
@ -381,8 +381,12 @@ export class chatgpt extends plugin {
|
|||
}
|
||||
let speaker = _.trimStart(e.msg, '#chatgpt设置语音角色') || '随机'
|
||||
userSetting.ttsRole = convertSpeaker(speaker)
|
||||
await redis.set(`CHATGPT:USER:${e.sender.user_id}`, JSON.stringify(userSetting))
|
||||
await this.reply(`您的默认语音角色已被设置为”${userSetting.ttsRole}“`)
|
||||
if (speakers.indexOf(userSetting.ttsRole) >= 0) {
|
||||
await redis.set(`CHATGPT:USER:${e.sender.user_id}`, JSON.stringify(userSetting))
|
||||
await this.reply(`您的默认语音角色已被设置为”${userSetting.ttsRole}“`)
|
||||
} else {
|
||||
await this.reply(`”抱歉,${userSetting.ttsRole}“我还不认识呢`)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -61,6 +61,7 @@ export async function generateAudio (text, speaker = '随机', language = '中
|
|||
}
|
||||
if (response.status > 299) {
|
||||
logger.info(json)
|
||||
throw new Error(JSON.stringify(json))
|
||||
}
|
||||
let [message, audioInfo, take] = json?.data
|
||||
logger.info(message, take)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue