mirror of
https://gitee.com/huangge1199_admin/vue-pro.git
synced 2025-01-31 09:30:05 +08:00
【代码优化】AI:音乐生成
This commit is contained in:
parent
23baaff84d
commit
d4cfcd0a1a
@ -0,0 +1,13 @@
|
||||
### 生成音乐:Suno +
|
||||
POST {{baseUrl}}/ai/music/generate
|
||||
Content-Type: application/json
|
||||
Authorization: {{token}}
|
||||
|
||||
{
|
||||
"platform": "Suno",
|
||||
"generateMode": 1,
|
||||
"prompt": "来一首快乐的歌曲",
|
||||
"modelVersion": "chirp-v3.5",
|
||||
"tags": ["Happy"],
|
||||
"title": "Happy Song"
|
||||
}
|
@ -15,6 +15,7 @@ import org.springframework.web.bind.annotation.RestController;
|
||||
import java.util.List;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||
import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId;
|
||||
|
||||
@Tag(name = "管理后台 - AI 音乐")
|
||||
@RestController
|
||||
@ -27,7 +28,7 @@ public class AiMusicController {
|
||||
@PostMapping("/generate")
|
||||
@Operation(summary = "音乐生成")
|
||||
public CommonResult<List<Long>> generateMusic(@RequestBody @Valid AiSunoGenerateReqVO reqVO) {
|
||||
return success(musicService.generateMusic(reqVO));
|
||||
return success(musicService.generateMusic(getLoginUserId(), reqVO));
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -17,7 +17,7 @@ public class AiSunoGenerateReqVO {
|
||||
|
||||
@Schema(description = "生成模式", requiredMode = Schema.RequiredMode.REQUIRED, example = "2")
|
||||
@NotNull(message = "生成模式不能为空")
|
||||
private Integer generateMode; // 参见 AiMusicGenerateEnum 枚举
|
||||
private Integer generateMode; // 参见 AiMusicGenerateModeEnum 枚举
|
||||
|
||||
@Schema(description = "用于生成音乐音频的提示", requiredMode = Schema.RequiredMode.REQUIRED,
|
||||
example = "创作一首带有轻松吉他旋律的流行歌曲,[verse] 描述夏日海滩的宁静,[chorus] 节奏加快,表达对自由的向往。")
|
||||
@ -26,7 +26,7 @@ public class AiSunoGenerateReqVO {
|
||||
@Schema(description = "是否纯音乐", requiredMode = Schema.RequiredMode.NOT_REQUIRED, example = "true")
|
||||
private Boolean makeInstrumental;
|
||||
|
||||
@Schema(description = "模型版本, 默认 chirp-v3.5", requiredMode = Schema.RequiredMode.NOT_REQUIRED, example = "chirp-v3.5")
|
||||
@Schema(description = "模型版本", requiredMode = Schema.RequiredMode.NOT_REQUIRED, example = "chirp-v3.5")
|
||||
private String modelVersion; // 参见 AiModelEnum 枚举
|
||||
|
||||
@Schema(description = "音乐风格", requiredMode = Schema.RequiredMode.NOT_REQUIRED, example = "[\"pop\",\"jazz\",\"punk\"]")
|
||||
|
@ -63,7 +63,7 @@ public class YudaoAiAutoConfiguration {
|
||||
YudaoAiProperties.QianWenProperties qianWenProperties = yudaoAiProperties.getQianwen();
|
||||
// 转换配置
|
||||
QianWenOptions qianWenOptions = new QianWenOptions();
|
||||
qianWenOptions.setModel(qianWenProperties.getModel().getModel());
|
||||
// qianWenOptions.setModel(qianWenProperties.getModel().getModel()); TODO @fan:这里报错了
|
||||
qianWenOptions.setTemperature(qianWenProperties.getTemperature());
|
||||
// qianWenOptions.setTopK(qianWenProperties.getTopK()); TODO 芋艿:后续弄
|
||||
qianWenOptions.setTopP(qianWenProperties.getTopP());
|
||||
|
@ -24,6 +24,7 @@ import java.util.List;
|
||||
import java.util.Scanner;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
// TODO 芋艿:整理单测
|
||||
/**
|
||||
* author: fansili
|
||||
* time: 2024/3/13 21:37
|
||||
|
@ -18,6 +18,7 @@ import java.security.NoSuchAlgorithmException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.*;
|
||||
|
||||
// TODO 芋艿:整理单测
|
||||
/**
|
||||
* author: fansili
|
||||
* time: 2024/3/13 20:47
|
||||
|
@ -18,6 +18,7 @@ import java.util.List;
|
||||
import java.util.Scanner;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
// TODO 芋艿:整理单测
|
||||
/**
|
||||
* 讯飞星火 tests
|
||||
* <p>
|
||||
|
@ -17,6 +17,7 @@ import java.security.NoSuchAlgorithmException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.*;
|
||||
|
||||
// TODO 芋艿:整理单测
|
||||
/**
|
||||
* 讯飞星火 tests
|
||||
* <p>
|
||||
|
@ -17,6 +17,7 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Scanner;
|
||||
|
||||
// TODO 芋艿:整理单测
|
||||
/**
|
||||
* chat 文心一言
|
||||
* <p>
|
||||
|
@ -1,4 +1,4 @@
|
||||
package cn.iocoder.yudao.framework.ai.openai;
|
||||
package cn.iocoder.yudao.framework.ai.image;
|
||||
|
||||
import org.springframework.ai.image.ImagePrompt;
|
||||
import org.springframework.ai.image.ImageResponse;
|
||||
@ -15,6 +15,7 @@ import java.io.IOException;
|
||||
import java.util.Base64;
|
||||
import java.util.Scanner;
|
||||
|
||||
// TODO 芋艿:整理单测
|
||||
/**
|
||||
* author: fansili
|
||||
* time: 2024/3/17 10:40
|
@ -1,4 +1,4 @@
|
||||
package cn.iocoder.yudao.framework.ai.suno;
|
||||
package cn.iocoder.yudao.framework.ai.music;
|
||||
|
||||
import cn.iocoder.yudao.framework.ai.core.model.suno.api.SunoApi;
|
||||
import org.junit.Before;
|
||||
@ -6,24 +6,24 @@ import org.junit.Test;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
// TODO 芋艿:整理单测
|
||||
/**
|
||||
* @Author xiaoxin
|
||||
* @Date 2024/5/27
|
||||
*/
|
||||
public class SunoTests {
|
||||
|
||||
SunoApi sunoApi;
|
||||
private SunoApi sunoApi;
|
||||
|
||||
@Before
|
||||
public void setup() {
|
||||
String url = "https://suno-imrqwwui8-status2xxs-projects.vercel.app";
|
||||
String url = "https://suno-om0w1cy6e-status2xxs-projects.vercel.app";
|
||||
this.sunoApi = new SunoApi(url);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void selectById() {
|
||||
System.out.println(sunoApi.getMusicList(List.of("d460ddda-7c87-4f34-b751-419b08a590ca,ff90ea66-49cd-4fd2-b44c-44267dfd5551")));
|
||||
|
||||
}
|
||||
|
||||
@Test
|
Loading…
Reference in New Issue
Block a user