From 1352369af0c95dc909af85f64f9c24273a7fbdc8 Mon Sep 17 00:00:00 2001 From: RockYang Date: Tue, 4 Mar 2025 19:00:56 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=20suno=20=E7=94=9F=E6=88=90?= =?UTF-8?q?=E6=AD=8C=E6=9B=B2=E6=B2=A1=E6=9C=89=E6=AD=8C=E8=AF=8D=E7=9A=84?= =?UTF-8?q?=20bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/core/types/task.go | 3 ++- api/handler/suno_handler.go | 4 +++- api/service/suno/service.go | 2 +- api/service/types.go | 32 +++++++++++++++----------------- 4 files changed, 21 insertions(+), 20 deletions(-) diff --git a/api/core/types/task.go b/api/core/types/task.go index 40872c20..599482af 100644 --- a/api/core/types/task.go +++ b/api/core/types/task.go @@ -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"` // 是否纯音乐 diff --git a/api/handler/suno_handler.go b/api/handler/suno_handler.go index 1ec2fa89..53ee507d 100644 --- a/api/handler/suno_handler.go +++ b/api/handler/suno_handler.go @@ -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, diff --git a/api/service/suno/service.go b/api/service/suno/service.go index 89a05efe..685153da 100644 --- a/api/service/suno/service.go +++ b/api/service/suno/service.go @@ -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 diff --git a/api/service/types.go b/api/service/types.go index 5b1d48cc..9c774cbf 100644 --- a/api/service/types.go +++ b/api/service/types.go @@ -45,30 +45,28 @@ const LyricPromptTemplate = ` 你是一位才华横溢的作曲家,拥有丰富的情感和细腻的笔触,你对文字有着独特的感悟力,能将各种情感和意境巧妙地融入歌词中。 请以【%s】为主题创作一首歌曲,歌曲时间不要太短,3分钟左右,不要输出任何解释性的内容。 下面是一个标准的歌词输出模板: -{歌曲名称} +歌曲名称 + [Verse] -假如时间能倒流回昨天 -所有的梦想还未被搁浅 -笔下的誓言还鲜明鲜艳 -却未走远也未变淡 +[歌词] [Verse 2] -假如雨能冲淡过往的痕 -凝视中还能看见你的身影 -喧嚣中静默的那些瞬间 -如梦又似乎触碰过真心 +[歌词] [Chorus] -假如我还能牵你的手 -天空也许会更蔚蓝悠游 -曾经那些未完成的错过 -愿能变成今天的收获 +[歌词] [Verse 3] -假如风不再翻动尘封的页 -那秘密是否还会被察觉 -窗前花开的季节再重叠 -唤醒我们曾遇见的那一夜 +[歌词] + +[Bridge] +[歌词] + +[Chorus] +[歌词] + +[Verse 4] +[歌词] [Bridge] 假如此刻眼泪能倒流