修复 suno 生成歌曲没有歌词的 bug

This commit is contained in:
RockYang
2025-03-04 19:00:56 +08:00
parent ded041da0f
commit 1352369af0
4 changed files with 21 additions and 20 deletions

View File

@@ -91,7 +91,8 @@ type SunoTask struct {
Title string `json:"title"`
RefTaskId string `json:"ref_task_id,omitempty"`
RefSongId string `json:"ref_song_id,omitempty"`
Prompt string `json:"prompt"` // 提示词/歌词
Prompt string `json:"prompt"` // 提示词
Lyrics string `json:"lyrics,omitempty"` // 歌词
Tags string `json:"tags"`
Model string `json:"model"`
Instrumental bool `json:"instrumental"` // 是否纯音乐

View File

@@ -18,9 +18,10 @@ import (
"geekai/store/vo"
"geekai/utils"
"geekai/utils/resp"
"time"
"github.com/gin-gonic/gin"
"gorm.io/gorm"
"time"
)
type SunoHandler struct {
@@ -96,6 +97,7 @@ func (h *SunoHandler) Create(c *gin.Context) {
RefSongId: data.RefSongId,
ExtendSecs: data.ExtendSecs,
Prompt: data.Prompt,
Lyrics: data.Lyrics,
Tags: data.Tags,
Model: data.Model,
Instrumental: data.Instrumental,

View File

@@ -134,7 +134,7 @@ func (s *Service) Create(task types.SunoTask) (RespVo, error) {
if task.Type == 1 {
reqBody["gpt_description_prompt"] = task.Prompt
} else { // 自定义模式
reqBody["prompt"] = task.Prompt
reqBody["prompt"] = task.Lyrics
reqBody["tags"] = task.Tags
reqBody["mv"] = task.Model
reqBody["title"] = task.Title

View File

@@ -45,30 +45,28 @@ const LyricPromptTemplate = `
你是一位才华横溢的作曲家,拥有丰富的情感和细腻的笔触,你对文字有着独特的感悟力,能将各种情感和意境巧妙地融入歌词中。
请以【%s】为主题创作一首歌曲歌曲时间不要太短3分钟左右不要输出任何解释性的内容。
下面是一个标准的歌词输出模板:
{歌曲名称}
歌曲名称
[Verse]
假如时间能倒流回昨天
所有的梦想还未被搁浅
笔下的誓言还鲜明鲜艳
却未走远也未变淡
[歌词]
[Verse 2]
假如雨能冲淡过往的痕
凝视中还能看见你的身影
喧嚣中静默的那些瞬间
如梦又似乎触碰过真心
[歌词]
[Chorus]
假如我还能牵你的手
天空也许会更蔚蓝悠游
曾经那些未完成的错过
愿能变成今天的收获
[歌词]
[Verse 3]
假如风不再翻动尘封的页
那秘密是否还会被察觉
窗前花开的季节再重叠
唤醒我们曾遇见的那一夜
[歌词]
[Bridge]
[歌词]
[Chorus]
[歌词]
[Verse 4]
[歌词]
[Bridge]
假如此刻眼泪能倒流