mirror of
https://github.com/ikechan8370/chatgpt-plugin.git
synced 2025-12-17 13:57:10 +00:00
fix: 调整以支持云转码
This commit is contained in:
parent
0daecc2edb
commit
1454917cad
5 changed files with 262 additions and 236 deletions
38
apps/chat.js
38
apps/chat.js
|
|
@ -511,23 +511,23 @@ export class chatgpt extends plugin {
|
|||
}
|
||||
|
||||
async switch2Audio (e) {
|
||||
switch (Config.ttsMode){
|
||||
switch (Config.ttsMode) {
|
||||
case 'vits-uma-genshin-honkai':
|
||||
if(!Config.ttsSpace){
|
||||
if (!Config.ttsSpace) {
|
||||
await this.reply('您没有配置VITS API,请前往锅巴面板进行配置')
|
||||
return
|
||||
}
|
||||
break
|
||||
case 'azure':
|
||||
if(!Config.azureKey){
|
||||
await this.reply('您没有配置Azure Key,请前往锅巴面板进行配置')
|
||||
return
|
||||
if (!Config.azureKey) {
|
||||
await this.reply('您没有配置Azure Key,请前往锅巴面板进行配置')
|
||||
return
|
||||
}
|
||||
break
|
||||
case 'voicevox':
|
||||
if(!Config.voicevoxSpace){
|
||||
await this.reply('您没有配置VoiceVox API,请前往锅巴面板进行配置')
|
||||
return
|
||||
if (!Config.voicevoxSpace) {
|
||||
await this.reply('您没有配置VoiceVox API,请前往锅巴面板进行配置')
|
||||
return
|
||||
}
|
||||
break
|
||||
}
|
||||
|
|
@ -620,17 +620,17 @@ export class chatgpt extends plugin {
|
|||
let match = regex.exec(speaker)
|
||||
let style = null
|
||||
if (match) {
|
||||
speaker = match[1]
|
||||
style = match[2]
|
||||
speaker = match[1]
|
||||
style = match[2]
|
||||
}
|
||||
let chosen = VoiceVoxTTS.supportConfigurations.filter(s => s.name === speaker)
|
||||
if (chosen.length === 0) {
|
||||
await this.reply(`抱歉,没有"${speaker}"这个角色,目前voicevox模式下支持的角色有${VoiceVoxTTS.supportConfigurations.map(item => item.name).join('、')}`)
|
||||
break
|
||||
await this.reply(`抱歉,没有"${speaker}"这个角色,目前voicevox模式下支持的角色有${VoiceVoxTTS.supportConfigurations.map(item => item.name).join('、')}`)
|
||||
break
|
||||
}
|
||||
if (style && !chosen[0].styles.find(item => item.name === style)) {
|
||||
await this.reply(`抱歉,"${speaker}"这个角色没有"${style}"这个风格,目前支持的风格有${chosen[0].styles.map(item => item.name).join('、')}`)
|
||||
break
|
||||
await this.reply(`抱歉,"${speaker}"这个角色没有"${style}"这个风格,目前支持的风格有${chosen[0].styles.map(item => item.name).join('、')}`)
|
||||
break
|
||||
}
|
||||
let userSetting = await redis.get(`CHATGPT:USER:${e.sender.user_id}`)
|
||||
if (!userSetting) {
|
||||
|
|
@ -1036,18 +1036,18 @@ export class chatgpt extends plugin {
|
|||
}
|
||||
} else if (Config.ttsMode === 'azure' && Config.azureTTSKey) {
|
||||
wav = await AzureTTS.generateAudio(ttsResponse, {
|
||||
speaker: speaker
|
||||
speaker
|
||||
})
|
||||
} else if (Config.ttsMode === 'voicevox' && Config.voicevoxSpace) {
|
||||
wav = await VoiceVoxTTS.generateAudio(ttsResponse, {
|
||||
speaker: speaker
|
||||
})
|
||||
wav = await VoiceVoxTTS.generateAudio(ttsResponse, {
|
||||
speaker
|
||||
})
|
||||
} else {
|
||||
await this.reply('你没有配置转语音API哦')
|
||||
}
|
||||
try {
|
||||
try {
|
||||
let sendable = await uploadRecord(wav, Config.ttsMode === 'azure')
|
||||
let sendable = await uploadRecord(wav, Config.ttsMode)
|
||||
if (sendable) {
|
||||
await e.reply(sendable)
|
||||
} else {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue