From 8bd58cf42993a7ace75a720ab8bf60529bc0ba96 Mon Sep 17 00:00:00 2001 From: zyc404 Date: Tue, 7 May 2024 23:18:32 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0suno=E7=94=9F=E6=88=90?= =?UTF-8?q?=E7=AD=89=E5=BE=85=E6=97=B6=E9=97=B4=EF=BC=8C=E4=BF=AE=E5=A4=8D?= =?UTF-8?q?=E4=B8=8B=E8=BD=BD=E8=A7=86=E9=A2=91=E5=8F=82=E6=95=B0=E9=94=99?= =?UTF-8?q?=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- resources/view/setting_view.json | 7 +++++++ utils/BingSuno.js | 6 +++--- utils/config.js | 1 + 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/resources/view/setting_view.json b/resources/view/setting_view.json index d295e86..01253fa 100644 --- a/resources/view/setting_view.json +++ b/resources/view/setting_view.json @@ -1122,7 +1122,14 @@ "label": "Sydney模式接受首条信息超时时间", "placeholder": "超过该时间阈值未收到Bing的任何消息,则断开本次连接并重试", "data": "sydneyFirstMessageTimeout" + }, + { + "type": "number", + "label": "SunoApi获取超时时间", + "placeholder": "使用sunoApi获取数据时超时时间,单位秒", + "data": "sunoApiTimeout" } + ] }, { diff --git a/utils/BingSuno.js b/utils/BingSuno.js index 8fdee50..b126148 100644 --- a/utils/BingSuno.js +++ b/utils/BingSuno.js @@ -20,7 +20,7 @@ export default class BingSunoClient { let videoPath while (!videoPath && retry >= 0) { try { - videoPath = await downloadFile(song.video_url, `suno/${song.title}.mp4`, false, false, { + videoPath = await downloadFile(song.videoURL, `suno/${song.title}.mp4`, false, false, { 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/123.0.0.0 Safari/537.36' }) } catch (err) { @@ -170,7 +170,8 @@ export default class BingSunoClient { }) const sunoId = await responseId.json() if (sunoId[0]?.id) { - let timeoutTimes = 30 + await e.reply('Bing Suno 生成中,请稍后') + let timeoutTimes = Config.sunoApiTimeout let timer = setInterval(async () => { const response = await fetch(`${Config.bingSunoApi}/api/get?ids=${sunoId[0]?.id}`, { method: 'GET', @@ -205,7 +206,6 @@ export default class BingSunoClient { sunoURL, prompt } - await e.reply('Bing Suno 生成中,请稍后') this.replyMsg(sunoDisplayResult, e) clearInterval(timer) } else if (timeoutTimes === 0) { diff --git a/utils/config.js b/utils/config.js index b6ef843..f78cd3b 100644 --- a/utils/config.js +++ b/utils/config.js @@ -81,6 +81,7 @@ const defaultConfig = { defaultTimeoutMs: 120000, chromeTimeoutMS: 120000, sydneyFirstMessageTimeout: 40000, + sunoApiTimeout: 60, ttsSpace: '', // https://114514.201666.xyz huggingFaceReverseProxy: '',