mirror of
https://github.com/ikechan8370/chatgpt-plugin.git
synced 2025-12-18 06:17:06 +00:00
fix: 生成较长时suno token过期重新刷新
This commit is contained in:
parent
d004699e21
commit
32af7b9a74
2 changed files with 6 additions and 2 deletions
|
|
@ -86,6 +86,10 @@ export class Vocal extends plugin {
|
||||||
}
|
}
|
||||||
|
|
||||||
let songs = await client.createSong(description)
|
let songs = await client.createSong(description)
|
||||||
|
if (!songs || songs.length === 0) {
|
||||||
|
e.reply('生成失败,可能是提示词太长或者违规,请检查日志')
|
||||||
|
return
|
||||||
|
}
|
||||||
let messages = ['提示词:' + description]
|
let messages = ['提示词:' + description]
|
||||||
for (let song of songs) {
|
for (let song of songs) {
|
||||||
messages.push(`歌名:${song.title}\n风格: ${song.metadata.tags}\n长度: ${lodash.round(song.metadata.duration, 0)}秒\n歌词:\n${song.metadata.prompt}\n`)
|
messages.push(`歌名:${song.title}\n风格: ${song.metadata.tags}\n长度: ${lodash.round(song.metadata.duration, 0)}秒\n歌词:\n${song.metadata.prompt}\n`)
|
||||||
|
|
|
||||||
|
|
@ -75,8 +75,8 @@ export class SunoClient {
|
||||||
}
|
}
|
||||||
let queryData = await queryRes.json()
|
let queryData = await queryRes.json()
|
||||||
logger.debug(queryData)
|
logger.debug(queryData)
|
||||||
allDone = queryData.every(clip => clip.status === 'complete')
|
allDone = queryData.every(clip => clip.status === 'complete' || clip.status === 'error')
|
||||||
songs = queryData
|
songs = queryData.filter(clip => clip.status === 'complete')
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error(err)
|
console.error(err)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue