增加suno生成等待时间,修复下载视频参数错误

This commit is contained in:
zyc404 2024-05-07 23:18:32 +08:00
parent b20a3db006
commit 8bd58cf429
3 changed files with 11 additions and 3 deletions

View file

@ -1122,7 +1122,14 @@
"label": "Sydney模式接受首条信息超时时间",
"placeholder": "超过该时间阈值未收到Bing的任何消息则断开本次连接并重试",
"data": "sydneyFirstMessageTimeout"
},
{
"type": "number",
"label": "SunoApi获取超时时间",
"placeholder": "使用sunoApi获取数据时超时时间单位秒",
"data": "sunoApiTimeout"
}
]
},
{

View file

@ -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) {

View file

@ -81,6 +81,7 @@ const defaultConfig = {
defaultTimeoutMs: 120000,
chromeTimeoutMS: 120000,
sydneyFirstMessageTimeout: 40000,
sunoApiTimeout: 60,
ttsSpace: '',
// https://114514.201666.xyz
huggingFaceReverseProxy: '',