From d3cea768f709dc6414dfd07a755feae66f354a98 Mon Sep 17 00:00:00 2001 From: ikechan8370 Date: Sun, 5 Mar 2023 15:35:07 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8Dtts=E6=8A=A5=E9=94=99b?= =?UTF-8?q?ody=20alreay=20used=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- utils/tts.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/utils/tts.js b/utils/tts.js index 4d1b81a..270a3fa 100644 --- a/utils/tts.js +++ b/utils/tts.js @@ -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) {