mirror of
https://gitee.com/huangge1199_admin/vue-pro.git
synced 2024-11-22 23:31:52 +08:00
【优化】AI 音乐:生成支持指定模型生成,支持回写音乐时长
This commit is contained in:
parent
bdd7d0c1fd
commit
3acd058635
@ -30,7 +30,7 @@ public class AiMusicDO extends BaseDO {
|
||||
|
||||
/**
|
||||
* 用户编号
|
||||
*
|
||||
* <p>
|
||||
* 关联 AdminUserDO 的 userId 字段
|
||||
*/
|
||||
private Long userId;
|
||||
@ -67,7 +67,7 @@ public class AiMusicDO extends BaseDO {
|
||||
|
||||
/**
|
||||
* 生成模式
|
||||
*
|
||||
* <p>
|
||||
* 枚举 {@link AiMusicGenerateModeEnum}
|
||||
*/
|
||||
private Integer generateMode;
|
||||
@ -113,4 +113,10 @@ public class AiMusicDO extends BaseDO {
|
||||
*/
|
||||
private String errorMessage;
|
||||
|
||||
|
||||
/**
|
||||
* 音乐时长
|
||||
*/
|
||||
private Double duration;
|
||||
|
||||
}
|
||||
|
@ -132,7 +132,7 @@ public class AiMusicServiceImpl implements AiMusicService {
|
||||
return convertList(musicList, musicData -> new AiMusicDO()
|
||||
.setTaskId(musicData.id()).setModel(musicData.modelName())
|
||||
.setPrompt(musicData.prompt()).setGptDescriptionPrompt(musicData.gptDescriptionPrompt())
|
||||
.setAudioUrl(createFile(musicData.audioUrl())).setVideoUrl(createFile(musicData.videoUrl())).setImageUrl(createFile(musicData.imageUrl()))
|
||||
.setAudioUrl(createFile(musicData.audioUrl())).setVideoUrl(createFile(musicData.videoUrl())).setImageUrl(createFile(musicData.imageUrl())).setDuration(musicData.duration())
|
||||
.setTitle(musicData.title()).setLyric(musicData.lyric()).setTags(StrUtil.split(musicData.tags(), StrPool.COMMA))
|
||||
.setStatus(Objects.equals("complete", musicData.status()) ?
|
||||
AiMusicStatusEnum.SUCCESS.getStatus() : AiMusicStatusEnum.IN_PROGRESS.getStatus()));
|
||||
|
@ -117,7 +117,7 @@ public class SunoApi {
|
||||
* @param prompt 用于生成音乐音频的提示
|
||||
* @param tags 音乐风格
|
||||
* @param title 音乐名称
|
||||
* @param mv 模型
|
||||
* @param model 模型
|
||||
* @param waitAudio false 表示后台模式,仅返回音频任务信息,需要调用 get API 获取详细的音频信息。
|
||||
* true 表示同步模式,API 最多等待 100s,音频生成完毕后直接返回音频链接等信息,建议在 GPT 等 agent 中使用。
|
||||
* @param makeInstrumental 指示音乐音频是否为定制,如果为 true,则从歌词生成,否则从提示生成
|
||||
@ -127,7 +127,7 @@ public class SunoApi {
|
||||
String prompt,
|
||||
String tags,
|
||||
String title,
|
||||
String mv,
|
||||
String model,
|
||||
@JsonProperty("wait_audio") boolean waitAudio,
|
||||
@JsonProperty("make_instrumental") boolean makeInstrumental
|
||||
) {
|
||||
@ -136,12 +136,12 @@ public class SunoApi {
|
||||
this(prompt, null, null, null, false, false);
|
||||
}
|
||||
|
||||
public MusicGenerateRequest(String prompt, String mv, boolean makeInstrumental) {
|
||||
this(prompt, null, null, mv, false, makeInstrumental);
|
||||
public MusicGenerateRequest(String prompt, String model, boolean makeInstrumental) {
|
||||
this(prompt, null, null, model, false, makeInstrumental);
|
||||
}
|
||||
|
||||
public MusicGenerateRequest(String prompt, String mv, String tags, String title) {
|
||||
this(prompt, tags, title, mv, false, false);
|
||||
public MusicGenerateRequest(String prompt, String model, String tags, String title) {
|
||||
this(prompt, tags, title, model, false, false);
|
||||
}
|
||||
|
||||
}
|
||||
@ -162,6 +162,7 @@ public class SunoApi {
|
||||
* @param prompt 生成音乐音频的提示
|
||||
* @param type 操作类型
|
||||
* @param tags 音乐类型标签
|
||||
* @param duration 音乐时长
|
||||
*/
|
||||
public record MusicData(
|
||||
String id,
|
||||
@ -176,7 +177,8 @@ public class SunoApi {
|
||||
@JsonProperty("gpt_description_prompt") String gptDescriptionPrompt,
|
||||
String prompt,
|
||||
String type,
|
||||
String tags
|
||||
String tags,
|
||||
Double duration
|
||||
) {
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user