mirror of
https://github.com/ikechan8370/chatgpt-plugin.git
synced 2025-12-17 05:47:11 +00:00
增加视频下载延迟
This commit is contained in:
parent
8bd58cf429
commit
f66b4a8548
1 changed files with 3 additions and 3 deletions
|
|
@ -16,7 +16,7 @@ export default class BingSunoClient {
|
||||||
messages.push(`歌名:${song.title}\n风格: ${song.musicalStyle}\n歌词:\n${song.prompt}\n`)
|
messages.push(`歌名:${song.title}\n风格: ${song.musicalStyle}\n歌词:\n${song.prompt}\n`)
|
||||||
messages.push(`音频链接:${song.audioURL}\n视频链接:${song.videoURL}\n封面链接:${song.imageURL}\n`)
|
messages.push(`音频链接:${song.audioURL}\n视频链接:${song.videoURL}\n封面链接:${song.imageURL}\n`)
|
||||||
messages.push(segment.image(song.imageURL))
|
messages.push(segment.image(song.imageURL))
|
||||||
let retry = 3
|
let retry = 10
|
||||||
let videoPath
|
let videoPath
|
||||||
while (!videoPath && retry >= 0) {
|
while (!videoPath && retry >= 0) {
|
||||||
try {
|
try {
|
||||||
|
|
@ -25,12 +25,12 @@ export default class BingSunoClient {
|
||||||
})
|
})
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
retry--
|
retry--
|
||||||
await common.sleep(1000)
|
await common.sleep(3000)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (videoPath) {
|
if (videoPath) {
|
||||||
const data = fs.readFileSync(videoPath)
|
const data = fs.readFileSync(videoPath)
|
||||||
messages.push(segment.video(`base64://${data.toString('base64')}`))
|
await e.reply(segment.video(`base64://${data.toString('base64')}`))
|
||||||
// 60秒后删除文件避免占用体积
|
// 60秒后删除文件避免占用体积
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
fs.unlinkSync(videoPath)
|
fs.unlinkSync(videoPath)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue