mirror of
https://github.com/ikechan8370/chatgpt-plugin.git
synced 2025-12-16 21:37:11 +00:00
fix: 修复tts报错body alreay used问题
This commit is contained in:
parent
75a060b86c
commit
d3cea768f7
1 changed files with 3 additions and 2 deletions
|
|
@ -56,8 +56,9 @@ export async function generateAudio (text, speaker = '随机', language = '中
|
|||
'content-type': 'application/json'
|
||||
}
|
||||
})
|
||||
let responseBody = await response.text()
|
||||
try {
|
||||
let json = await response.json()
|
||||
let json = JSON.parse(responseBody)
|
||||
if (Config.debug) {
|
||||
logger.info(json)
|
||||
}
|
||||
|
|
@ -71,7 +72,7 @@ export async function generateAudio (text, speaker = '随机', language = '中
|
|||
return audioLink
|
||||
} catch (err) {
|
||||
logger.error('生成语音api发生错误,请检查是否配置了正确的api,且仓库是否开放为public', response.status)
|
||||
throw new Error(await response.text())
|
||||
throw new Error(responseBody)
|
||||
}
|
||||
}
|
||||
export function convertSpeaker (speaker) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue