Merge remote-tracking branch 'origin/master-jdk21-ai' into master-jdk21-ai

This commit is contained in:
cherishsince 2024-06-27 17:14:46 +08:00
commit dcab49bb78
21 changed files with 152 additions and 192 deletions

View File

@ -1,37 +0,0 @@
package cn.iocoder.yudao.module.ai.enums.music;
import lombok.AllArgsConstructor;
import lombok.Getter;
// TODO @xiaoxin这个也叫 AiMusicGenerateModeEnum 虽然长但是和项目统一一点
/**
* AI 音乐状态的枚举
*
* @author xiaoxin
*/
@AllArgsConstructor
@Getter
public enum AiMusicGenerateEnum {
LYRIC("1", "歌词模式"),
DESCRIPTION("2", "描述模式");
/**
* 模式
*/
private final String mode;
/**
* 模式名
*/
private final String name;
public static AiMusicGenerateEnum valueOfMode(String mode) {
for (AiMusicGenerateEnum modeEnum : AiMusicGenerateEnum.values()) {
if (modeEnum.getMode().equals(mode)) {
return modeEnum;
}
}
throw new IllegalArgumentException("未知模式: " + mode);
}
}

View File

@ -0,0 +1,27 @@
package cn.iocoder.yudao.module.ai.enums.music;
import lombok.AllArgsConstructor;
import lombok.Getter;
/**
* AI 音乐状态的枚举
*
* @author xiaoxin
*/
@AllArgsConstructor
@Getter
public enum AiMusicGenerateModeEnum {
LYRIC(1, "歌词模式"),
DESCRIPTION(2, "描述模式");
/**
* 模式
*/
private final Integer mode;
/**
* 模式名
*/
private final String name;
}

View File

@ -12,14 +12,13 @@ import lombok.Getter;
@Getter @Getter
public enum AiMusicStatusEnum { public enum AiMusicStatusEnum {
// @xin 文档中无失败这个返回值 TODO @xin Integer 另外个枚举类也是 IN_PROGRESS(10, "进行中"),
STREAMING("10", "进行中"), SUCCESS(20, "已完成");
COMPLETE("20", "完成");
/** /**
* 状态 * 状态
*/ */
private final String status; private final Integer status;
/** /**
* 状态名 * 状态名

View File

@ -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"
}

View File

@ -15,6 +15,7 @@ import org.springframework.web.bind.annotation.RestController;
import java.util.List; import java.util.List;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId;
@Tag(name = "管理后台 - AI 音乐") @Tag(name = "管理后台 - AI 音乐")
@RestController @RestController
@ -27,7 +28,7 @@ public class AiMusicController {
@PostMapping("/generate") @PostMapping("/generate")
@Operation(summary = "音乐生成") @Operation(summary = "音乐生成")
public CommonResult<List<Long>> generateMusic(@RequestBody @Valid AiSunoGenerateReqVO reqVO) { public CommonResult<List<Long>> generateMusic(@RequestBody @Valid AiSunoGenerateReqVO reqVO) {
return success(musicService.generateMusic(reqVO)); return success(musicService.generateMusic(getLoginUserId(), reqVO));
} }
} }

View File

@ -2,36 +2,37 @@ package cn.iocoder.yudao.module.ai.controller.admin.music.vo;
import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotBlank; import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import lombok.Data; import lombok.Data;
import java.util.List; import java.util.List;
@Schema(description = "管理后台 - 音乐生成 Request VO") @Schema(description = "管理后台 - AI 音乐生成 Request VO")
@Data @Data
public class AiSunoGenerateReqVO { public class AiSunoGenerateReqVO {
// TODO @xin每个参数必要的是否必填校验
@Schema(description = "用于生成音乐音频的提示", example = "创作一首带有轻松吉他旋律的流行歌曲,[verse] 描述夏日海滩的宁静,[chorus] 节奏加快,表达对自由的向往。")
private String prompt;
@Schema(description = "是否纯音乐", example = "true")
private Boolean makeInstrumental;
@Schema(description = "模型版本, 默认 chirp-v3.5", example = "chirp-v3.5")
private String modelVersion; // 参见 AiModelEnum 枚举
@Schema(description = "音乐风格", example = "[\"pop\",\"jazz\",\"punk\"]")
private List<String> tags;
@Schema(description = "音乐/歌曲名称", example = "夜空中最亮的星")
private String title;
@Schema(description = "平台", requiredMode = Schema.RequiredMode.REQUIRED, example = "Suno") @Schema(description = "平台", requiredMode = Schema.RequiredMode.REQUIRED, example = "Suno")
@NotBlank(message = "平台不能为空") @NotBlank(message = "平台不能为空")
private String platform; // 参见 AiPlatformEnum 枚举 private String platform; // 参见 AiPlatformEnum 枚举
@Schema(description = "生成模式", requiredMode = Schema.RequiredMode.REQUIRED, example = "2") @Schema(description = "生成模式", requiredMode = Schema.RequiredMode.REQUIRED, example = "2")
@NotBlank(message = "生成模式不能为空") @NotNull(message = "生成模式不能为空")
private String generateMode; // 参见 AiMusicGenerateEnum 枚举 private Integer generateMode; // 参见 AiMusicGenerateModeEnum 枚举
@Schema(description = "用于生成音乐音频的提示", requiredMode = Schema.RequiredMode.REQUIRED,
example = "创作一首带有轻松吉他旋律的流行歌曲,[verse] 描述夏日海滩的宁静,[chorus] 节奏加快,表达对自由的向往。")
private String prompt;
@Schema(description = "是否纯音乐", requiredMode = Schema.RequiredMode.NOT_REQUIRED, example = "true")
private Boolean makeInstrumental;
@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\"]")
private List<String> tags;
@Schema(description = "音乐/歌曲名称", requiredMode = Schema.RequiredMode.NOT_REQUIRED, example = "夜空中最亮的星")
private String title;
} }

View File

@ -1,6 +1,8 @@
package cn.iocoder.yudao.module.ai.dal.dataobject.music; package cn.iocoder.yudao.module.ai.dal.dataobject.music;
import cn.iocoder.yudao.framework.ai.core.enums.AiPlatformEnum;
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
import cn.iocoder.yudao.module.ai.enums.music.AiMusicGenerateModeEnum;
import cn.iocoder.yudao.module.ai.enums.music.AiMusicStatusEnum; import cn.iocoder.yudao.module.ai.enums.music.AiMusicStatusEnum;
import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableField;
@ -38,21 +40,19 @@ public class AiMusicDO extends BaseDO {
*/ */
private String title; private String title;
/**
* 图片地址
*/
private String imageUrl;
/** /**
* 歌词 * 歌词
*/ */
private String lyric; private String lyric;
/**
* 图片地址
*/
private String imageUrl;
/** /**
* 音频地址 * 音频地址
*/ */
private String audioUrl; private String audioUrl;
/** /**
* 视频地址 * 视频地址
*/ */
@ -63,7 +63,14 @@ public class AiMusicDO extends BaseDO {
* <p> * <p>
* 枚举 {@link AiMusicStatusEnum} * 枚举 {@link AiMusicStatusEnum}
*/ */
private String status; private Integer status;
/**
* 生成模式
*
* 枚举 {@link AiMusicGenerateModeEnum}
*/
private Integer generateMode;
/** /**
* 描述词 * 描述词
@ -74,28 +81,17 @@ public class AiMusicDO extends BaseDO {
*/ */
private String prompt; private String prompt;
/**
* 生成模式
*/
private String generateMode;
/** /**
* 平台 * 平台
* <p> * <p>
* 枚举 {@link cn.iocoder.yudao.framework.ai.core.enums.AiPlatformEnum} * 枚举 {@link AiPlatformEnum}
*/ */
private String platform; private String platform;
/** /**
* 模型 * 模型
*/ */
private String model; private String model;
/**
* 错误信息
*/
private String errorMessage;
/** /**
* 音乐风格标签 * 音乐风格标签
*/ */
@ -107,4 +103,9 @@ public class AiMusicDO extends BaseDO {
*/ */
private String taskId; private String taskId;
/**
* 错误信息
*/
private String errorMessage;
} }

View File

@ -4,10 +4,18 @@ import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.ai.dal.dataobject.music.AiMusicDO; import cn.iocoder.yudao.module.ai.dal.dataobject.music.AiMusicDO;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import java.util.List;
/** /**
* AI 音乐 Mapper * AI 音乐 Mapper
*
* @author xiaoxin * @author xiaoxin
*/ */
@Mapper @Mapper
public interface AiMusicMapper extends BaseMapperX<AiMusicDO> { public interface AiMusicMapper extends BaseMapperX<AiMusicDO> {
default List<AiMusicDO> selectListByStatus(Integer status) {
return selectList(AiMusicDO::getStatus, status);
}
} }

View File

@ -1,4 +1,4 @@
package cn.iocoder.yudao.module.ai.job.sun; package cn.iocoder.yudao.module.ai.job.music;
import cn.iocoder.yudao.framework.quartz.core.handler.JobHandler; import cn.iocoder.yudao.framework.quartz.core.handler.JobHandler;
import cn.iocoder.yudao.module.ai.service.music.AiMusicService; import cn.iocoder.yudao.module.ai.service.music.AiMusicService;

View File

@ -1,7 +1,6 @@
package cn.iocoder.yudao.module.ai.service.music; package cn.iocoder.yudao.module.ai.service.music;
import cn.iocoder.yudao.module.ai.controller.admin.music.vo.AiSunoGenerateReqVO; import cn.iocoder.yudao.module.ai.controller.admin.music.vo.AiSunoGenerateReqVO;
import cn.iocoder.yudao.module.ai.dal.dataobject.music.AiMusicDO;
import java.util.List; import java.util.List;
@ -15,17 +14,11 @@ public interface AiMusicService {
/** /**
* 音乐生成 * 音乐生成
* *
* @param userId 用户编号
* @param reqVO 请求参数 * @param reqVO 请求参数
* @return 生成的音乐ID * @return 生成的音乐ID
*/ */
List<Long> generateMusic(AiSunoGenerateReqVO reqVO); List<Long> generateMusic(Long userId, AiSunoGenerateReqVO reqVO);
/**
* 获取未完成状态的任务
*
* @return 未完成任务列表
*/
List<AiMusicDO> getUnCompletedTask();
/** /**
* 同步音乐任务 * 同步音乐任务
@ -34,12 +27,4 @@ public interface AiMusicService {
*/ */
Integer syncMusic(); Integer syncMusic();
/**
* 批量更新音乐信息
*
* @param musicDOS 音乐信息
* @return 是否成功
*/
Boolean updateBatch(List<AiMusicDO> musicDOS);
} }

View File

@ -4,21 +4,19 @@ import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.text.StrPool; import cn.hutool.core.text.StrPool;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
import cn.iocoder.yudao.framework.ai.core.model.suno.api.SunoApi; import cn.iocoder.yudao.framework.ai.core.model.suno.api.SunoApi;
import cn.iocoder.yudao.framework.common.util.collection.CollectionUtils;
import cn.iocoder.yudao.module.ai.controller.admin.music.vo.AiSunoGenerateReqVO; import cn.iocoder.yudao.module.ai.controller.admin.music.vo.AiSunoGenerateReqVO;
import cn.iocoder.yudao.module.ai.dal.dataobject.music.AiMusicDO; import cn.iocoder.yudao.module.ai.dal.dataobject.music.AiMusicDO;
import cn.iocoder.yudao.module.ai.dal.mysql.music.AiMusicMapper; import cn.iocoder.yudao.module.ai.dal.mysql.music.AiMusicMapper;
import cn.iocoder.yudao.module.ai.enums.music.AiMusicGenerateEnum; import cn.iocoder.yudao.module.ai.enums.music.AiMusicGenerateModeEnum;
import cn.iocoder.yudao.module.ai.enums.music.AiMusicStatusEnum; import cn.iocoder.yudao.module.ai.enums.music.AiMusicStatusEnum;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import jakarta.annotation.Resource; import jakarta.annotation.Resource;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.*; import java.util.*;
import java.util.stream.Collectors;
import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId; import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertList;
import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertMap;
/** /**
* AI 音乐 Service 实现类 * AI 音乐 Service 实现类
@ -36,112 +34,70 @@ public class AiMusicServiceImpl implements AiMusicService {
private AiMusicMapper musicMapper; private AiMusicMapper musicMapper;
@Override @Override
public List<Long> generateMusic(AiSunoGenerateReqVO reqVO) { public List<Long> generateMusic(Long userId, AiSunoGenerateReqVO reqVO) {
// 1. 调用 Suno 生成音乐
List<SunoApi.MusicData> musicDataList; List<SunoApi.MusicData> musicDataList;
if (Objects.equals(AiMusicGenerateEnum.LYRIC.getMode(), reqVO.getGenerateMode())) { if (Objects.equals(AiMusicGenerateModeEnum.LYRIC.getMode(), reqVO.getGenerateMode())) {
// 1.1 歌词模式 // 1.1 歌词模式
SunoApi.MusicGenerateRequest sunoReq = new SunoApi.MusicGenerateRequest( SunoApi.MusicGenerateRequest generateRequest = new SunoApi.MusicGenerateRequest(
reqVO.getPrompt(), reqVO.getModelVersion(), CollUtil.join(reqVO.getTags(), StrPool.COMMA), reqVO.getTitle()); reqVO.getPrompt(), reqVO.getModelVersion(), CollUtil.join(reqVO.getTags(), StrPool.COMMA), reqVO.getTitle());
musicDataList = sunoApi.customGenerate(sunoReq); musicDataList = sunoApi.customGenerate(generateRequest);
} else if (Objects.equals(AiMusicGenerateEnum.DESCRIPTION.getMode(), reqVO.getGenerateMode())) { } else if (Objects.equals(AiMusicGenerateModeEnum.DESCRIPTION.getMode(), reqVO.getGenerateMode())) {
// 1.2 描述模式 // 1.2 描述模式
SunoApi.MusicGenerateRequest sunoReq = new SunoApi.MusicGenerateRequest( SunoApi.MusicGenerateRequest generateRequest = new SunoApi.MusicGenerateRequest(
reqVO.getPrompt(), reqVO.getModelVersion(), reqVO.getMakeInstrumental()); reqVO.getPrompt(), reqVO.getModelVersion(), reqVO.getMakeInstrumental());
musicDataList = sunoApi.generate(sunoReq); musicDataList = sunoApi.generate(generateRequest);
} else { } else {
// TODO @xin不用 log error直接抛异常 reqVO 呆进去有全局处理的哈 throw new IllegalArgumentException(StrUtil.format("未知生成模式({})", reqVO));
log.error("未知的生成模式:{}", reqVO.getGenerateMode());
throw new IllegalArgumentException("未知的生成模式");
} }
// 2. 插入数据库 // 2. 插入数据库
// TODO @xin因为 insertMusicData 复用的比较少所以不用愁单独的方法直接写在这里就好啦 if (CollUtil.isEmpty(musicDataList)) {
return insertMusicData(musicDataList, reqVO.getGenerateMode(), reqVO.getPlatform()); return Collections.emptyList();
} }
List<AiMusicDO> musicList = buildMusicDOList(musicDataList);
// TODO @xin1service 里面不要直接查询 db2不要用 ne STREAMING musicList.forEach(music -> music.setUserId(userId).setPlatform(music.getPlatform()).setGenerateMode(reqVO.getGenerateMode()));
@Override musicMapper.insertBatch(musicList);
public List<AiMusicDO> getUnCompletedTask() { return convertList(musicList, AiMusicDO::getId);
return musicMapper.selectList(new LambdaQueryWrapper<AiMusicDO>().ne(AiMusicDO::getStatus, AiMusicStatusEnum.COMPLETE.getStatus()));
} }
@Override @Override
public Integer syncMusic() { public Integer syncMusic() {
List<AiMusicDO> unCompletedTask = this.getUnCompletedTask(); List<AiMusicDO> streamingTask = musicMapper.selectListByStatus(AiMusicStatusEnum.IN_PROGRESS.getStatus());
if (CollUtil.isEmpty(unCompletedTask)) { if (CollUtil.isEmpty(streamingTask)) {
// TODO @xin这里不用打反正 Job 也打了
log.info("Suno 无进行中任务需要更新!");
return 0; return 0;
} }
log.info("[syncMusic][Suno 开始同步, 共 ({}) 个任务]", unCompletedTask.size()); log.info("[syncMusic][Suno 开始同步, 共 ({}) 个任务]", streamingTask.size());
// GET 请求为避免参数过长分批次处理 // GET 请求为避免参数过长分批次处理
// TODO @xin建议批量更大一些 CollUtil.split(streamingTask, 36).forEach(chunkList -> {
CollUtil.split(unCompletedTask, 4).forEach(chunk -> { Map<String, Long> taskIdMap = convertMap(chunkList, AiMusicDO::getTaskId, AiMusicDO::getId);
// TODO @xin可以使用 CollectionUtils 里的 map 转换
Map<String, Long> taskIdMap = CollUtil.toMap(chunk, new HashMap<>(), AiMusicDO::getTaskId, AiMusicDO::getId);
List<SunoApi.MusicData> musicTaskList = sunoApi.getMusicList(new ArrayList<>(taskIdMap.keySet())); List<SunoApi.MusicData> musicTaskList = sunoApi.getMusicList(new ArrayList<>(taskIdMap.keySet()));
// TODO @xin查询不到直接 return这样真正逻辑的 85 - 87 就不用多一层括号 if (CollUtil.isEmpty(musicTaskList)) {
if (CollUtil.isNotEmpty(musicTaskList)) {
List<AiMusicDO> aiMusicDOS = buildMusicDOList(musicTaskList);
//回填id
aiMusicDOS.forEach(aiMusicDO -> aiMusicDO.setId(taskIdMap.get(aiMusicDO.getTaskId())));
this.updateBatch(aiMusicDOS);
} else {
log.warn("Suno 任务同步失败, 任务ID: [{}]", taskIdMap.keySet()); log.warn("Suno 任务同步失败, 任务ID: [{}]", taskIdMap.keySet());
return;
} }
// 更新进度
List<AiMusicDO> updateMusicList = buildMusicDOList(musicTaskList);
updateMusicList.forEach(music -> music.setId(taskIdMap.get(music.getTaskId())));
musicMapper.updateBatch(updateMusicList);
}); });
return unCompletedTask.size(); return streamingTask.size();
}
// TODO @xin这个方法看着不用啦
@Override
public Boolean updateBatch(List<AiMusicDO> musicDOS) {
return musicMapper.updateBatch(musicDOS);
}
/**
* 新增音乐数据并提交 suno任务
*
* @param musicDataList 音乐数据列表
* @return 音乐id集合
*/
private List<Long> insertMusicData(List<SunoApi.MusicData> musicDataList, String generateMode, String platform) {
if (CollUtil.isEmpty(musicDataList)) {
return Collections.emptyList();
}
List<AiMusicDO> aiMusicDOList = buildMusicDOList(musicDataList).stream()
.map(musicDO -> musicDO.setUserId(getLoginUserId())
.setGenerateMode(generateMode)
.setPlatform(platform))
.toList();
musicMapper.insertBatch(aiMusicDOList);
// TODO @xin CollectionUtils 简化操作
return aiMusicDOList.stream()
.map(AiMusicDO::getId)
.collect(Collectors.toList());
} }
/** /**
* 构建 AiMusicDO 集合 * 构建 AiMusicDO 集合
* *
* @param musicTaskList suno 音乐任务列表 * @param musicList suno 音乐任务列表
* @return AiMusicDO 集合 * @return AiMusicDO 集合
*/ */
private static List<AiMusicDO> buildMusicDOList(List<SunoApi.MusicData> musicTaskList) { private static List<AiMusicDO> buildMusicDOList(List<SunoApi.MusicData> musicList) {
// TODO @xin想通的变量放在同一行避免过长 return convertList(musicList, musicData -> new AiMusicDO()
return CollectionUtils.convertList(musicTaskList, musicData -> new AiMusicDO() .setTaskId(musicData.id()).setModel(musicData.modelName())
.setTaskId(musicData.id()) .setPrompt(musicData.prompt()).setGptDescriptionPrompt(musicData.gptDescriptionPrompt())
.setPrompt(musicData.prompt()) .setAudioUrl(musicData.audioUrl()).setVideoUrl(musicData.videoUrl()).setImageUrl(musicData.imageUrl())
.setGptDescriptionPrompt(musicData.gptDescriptionPrompt()) .setTitle(musicData.title()).setLyric(musicData.lyric()).setTags(StrUtil.split(musicData.tags(), StrPool.COMMA))
.setAudioUrl(musicData.audioUrl()) .setStatus(Objects.equals("complete", musicData.status()) ? AiMusicStatusEnum.SUCCESS.getStatus() : AiMusicStatusEnum.IN_PROGRESS.getStatus()));
.setVideoUrl(musicData.videoUrl())
.setImageUrl(musicData.imageUrl())
.setLyric(musicData.lyric())
.setTitle(musicData.title())
.setStatus(Objects.equals("complete", musicData.status()) ? AiMusicStatusEnum.COMPLETE.getStatus() : AiMusicStatusEnum.STREAMING.getStatus())
.setModel(musicData.modelName())
// TODO @xin可以用 hutool StrUtil split 之类的
.setTags(StrUtil.isNotBlank(musicData.tags()) ? List.of(musicData.tags().split(StrPool.COMMA)) : null));
}
} }
}

View File

@ -63,7 +63,7 @@ public class YudaoAiAutoConfiguration {
YudaoAiProperties.QianWenProperties qianWenProperties = yudaoAiProperties.getQianwen(); YudaoAiProperties.QianWenProperties qianWenProperties = yudaoAiProperties.getQianwen();
// 转换配置 // 转换配置
QianWenOptions qianWenOptions = new QianWenOptions(); QianWenOptions qianWenOptions = new QianWenOptions();
qianWenOptions.setModel(qianWenProperties.getModel().getModel()); // qianWenOptions.setModel(qianWenProperties.getModel().getModel()); TODO @fan这里报错了
qianWenOptions.setTemperature(qianWenProperties.getTemperature()); qianWenOptions.setTemperature(qianWenProperties.getTemperature());
// qianWenOptions.setTopK(qianWenProperties.getTopK()); TODO 芋艿后续弄 // qianWenOptions.setTopK(qianWenProperties.getTopK()); TODO 芋艿后续弄
qianWenOptions.setTopP(qianWenProperties.getTopP()); qianWenOptions.setTopP(qianWenProperties.getTopP());

View File

@ -19,7 +19,7 @@ import java.util.function.Predicate;
/** /**
* Suno API * Suno API
* * <p>
* 对接 Suno Proxy<a href="https://github.com/gcui-art/suno-api">suno-api</a> * 对接 Suno Proxy<a href="https://github.com/gcui-art/suno-api">suno-api</a>
* *
* @author xiaoxin * @author xiaoxin

View File

@ -24,6 +24,7 @@ import java.util.List;
import java.util.Scanner; import java.util.Scanner;
import java.util.function.Consumer; import java.util.function.Consumer;
// TODO 芋艿整理单测
/** /**
* author: fansili * author: fansili
* time: 2024/3/13 21:37 * time: 2024/3/13 21:37

View File

@ -18,6 +18,7 @@ import java.security.NoSuchAlgorithmException;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.*; import java.util.*;
// TODO 芋艿整理单测
/** /**
* author: fansili * author: fansili
* time: 2024/3/13 20:47 * time: 2024/3/13 20:47

View File

@ -18,6 +18,7 @@ import java.util.List;
import java.util.Scanner; import java.util.Scanner;
import java.util.function.Consumer; import java.util.function.Consumer;
// TODO 芋艿整理单测
/** /**
* 讯飞星火 tests * 讯飞星火 tests
* <p> * <p>

View File

@ -17,6 +17,7 @@ import java.security.NoSuchAlgorithmException;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.*; import java.util.*;
// TODO 芋艿整理单测
/** /**
* 讯飞星火 tests * 讯飞星火 tests
* <p> * <p>

View File

@ -17,6 +17,7 @@ import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Scanner; import java.util.Scanner;
// TODO 芋艿整理单测
/** /**
* chat 文心一言 * chat 文心一言
* <p> * <p>

View File

@ -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.ImagePrompt;
import org.springframework.ai.image.ImageResponse; import org.springframework.ai.image.ImageResponse;
@ -15,6 +15,7 @@ import java.io.IOException;
import java.util.Base64; import java.util.Base64;
import java.util.Scanner; import java.util.Scanner;
// TODO 芋艿整理单测
/** /**
* author: fansili * author: fansili
* time: 2024/3/17 10:40 * time: 2024/3/17 10:40

View File

@ -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 cn.iocoder.yudao.framework.ai.core.model.suno.api.SunoApi;
import org.junit.Before; import org.junit.Before;
@ -6,24 +6,24 @@ import org.junit.Test;
import java.util.List; import java.util.List;
// TODO 芋艿整理单测
/** /**
* @Author xiaoxin * @Author xiaoxin
* @Date 2024/5/27 * @Date 2024/5/27
*/ */
public class SunoTests { public class SunoTests {
SunoApi sunoApi; private SunoApi sunoApi;
@Before @Before
public void setup() { 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); this.sunoApi = new SunoApi(url);
} }
@Test @Test
public void selectById() { public void selectById() {
System.out.println(sunoApi.getMusicList(List.of("d460ddda-7c87-4f34-b751-419b08a590ca,ff90ea66-49cd-4fd2-b44c-44267dfd5551"))); System.out.println(sunoApi.getMusicList(List.of("d460ddda-7c87-4f34-b751-419b08a590ca,ff90ea66-49cd-4fd2-b44c-44267dfd5551")));
} }
@Test @Test

View File

@ -201,7 +201,7 @@ yudao.ai:
notify-url: http://java.nat300.top/admin-api/ai/image/midjourney/notify notify-url: http://java.nat300.top/admin-api/ai/image/midjourney/notify
suno: suno:
enable: true enable: true
base-url: https://suno-imrqwwui8-status2xxs-projects.vercel.app base-url: https://suno-om0w1cy6e-status2xxs-projects.vercel.app
--- #################### 芋道相关配置 #################### --- #################### 芋道相关配置 ####################