Commit f78d13a83ce1fa4481b3fb0140b84ea4f5151bc6

Authored by YunaiV
1 parent 3e164121

【代码优化】AI:完善各种注释

Showing 17 changed files with 52 additions and 96 deletions
yudao-dependencies/pom.xml
@@ -75,7 +75,6 @@ @@ -75,7 +75,6 @@
75 <jimureport.version>1.6.6-beta2</jimureport.version> 75 <jimureport.version>1.6.6-beta2</jimureport.version>
76 <xercesImpl.version>2.12.2</xercesImpl.version> 76 <xercesImpl.version>2.12.2</xercesImpl.version>
77 <weixin-java.version>4.6.0</weixin-java.version> 77 <weixin-java.version>4.6.0</weixin-java.version>
78 - <ureport2.version>2.2.9</ureport2.version>  
79 <spring-ai-bom.version>0.8.0</spring-ai-bom.version> 78 <spring-ai-bom.version>0.8.0</spring-ai-bom.version>
80 </properties> 79 </properties>
81 80
yudao-module-ai/pom.xml
@@ -2,28 +2,26 @@ @@ -2,28 +2,26 @@
2 <project xmlns="http://maven.apache.org/POM/4.0.0" 2 <project xmlns="http://maven.apache.org/POM/4.0.0"
3 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 3 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4 xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4 xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
5 - <modelVersion>4.0.0</modelVersion>  
6 <parent> 5 <parent>
7 <groupId>cn.iocoder.boot</groupId> 6 <groupId>cn.iocoder.boot</groupId>
8 <artifactId>yudao</artifactId> 7 <artifactId>yudao</artifactId>
9 <version>${revision}</version> 8 <version>${revision}</version>
10 </parent> 9 </parent>
11 - <packaging>pom</packaging>  
12 - <artifactId>yudao-module-ai</artifactId>  
13 - 10 + <modelVersion>4.0.0</modelVersion>
14 <modules> 11 <modules>
15 <module>yudao-module-ai-api</module> 12 <module>yudao-module-ai-api</module>
16 <module>yudao-module-ai-biz</module> 13 <module>yudao-module-ai-biz</module>
17 <module>yudao-spring-boot-starter-ai</module> 14 <module>yudao-spring-boot-starter-ai</module>
18 </modules> 15 </modules>
  16 + <packaging>pom</packaging>
  17 + <artifactId>yudao-module-ai</artifactId>
19 18
20 - <properties>  
21 - <maven.compiler.source>17</maven.compiler.source>  
22 - <maven.compiler.target>17</maven.compiler.target>  
23 - <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>  
24 - </properties>  
25 -  
26 - <dependencies>  
27 - </dependencies> 19 + <name>${project.artifactId}</name>
  20 + <description>
  21 + ai 模块下,接入 LLM 大模型,支持聊天、绘图、音乐、写作、思维脑图等功能。
  22 + 目前已接入各种模型,不限于:
  23 + 国内:通义千问、文心一言、讯飞星火
  24 + 国外:OpenAI、Ollama、Midjourney、StableDiffusion、Suno
  25 + </description>
28 26
29 </project> 27 </project>
30 \ No newline at end of file 28 \ No newline at end of file
yudao-module-ai/yudao-module-ai-api/pom.xml
@@ -2,32 +2,26 @@ @@ -2,32 +2,26 @@
2 <project xmlns="http://maven.apache.org/POM/4.0.0" 2 <project xmlns="http://maven.apache.org/POM/4.0.0"
3 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 3 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4 xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4 xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
5 - <modelVersion>4.0.0</modelVersion>  
6 <parent> 5 <parent>
7 <groupId>cn.iocoder.boot</groupId> 6 <groupId>cn.iocoder.boot</groupId>
8 <artifactId>yudao-module-ai</artifactId> 7 <artifactId>yudao-module-ai</artifactId>
9 <version>${revision}</version> 8 <version>${revision}</version>
10 </parent> 9 </parent>
11 - 10 + <modelVersion>4.0.0</modelVersion>
12 <artifactId>yudao-module-ai-api</artifactId> 11 <artifactId>yudao-module-ai-api</artifactId>
  12 + <packaging>jar</packaging>
13 13
14 - <properties>  
15 - <maven.compiler.source>17</maven.compiler.source>  
16 - <maven.compiler.target>17</maven.compiler.target>  
17 - <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>  
18 - </properties> 14 + <name>${project.artifactId}</name>
  15 + <description>
  16 + ai 模块 API,暴露给其它模块调用
  17 + </description>
19 18
20 <dependencies> 19 <dependencies>
21 - <!-- yudao-common -->  
22 <dependency> 20 <dependency>
23 <groupId>cn.iocoder.boot</groupId> 21 <groupId>cn.iocoder.boot</groupId>
24 <artifactId>yudao-common</artifactId> 22 <artifactId>yudao-common</artifactId>
25 </dependency> 23 </dependency>
26 - <!-- lombok -->  
27 - <dependency>  
28 - <groupId>org.projectlombok</groupId>  
29 - <artifactId>lombok</artifactId>  
30 - </dependency> 24 +
31 <!-- 参数校验 --> 25 <!-- 参数校验 -->
32 <dependency> 26 <dependency>
33 <groupId>org.springframework.boot</groupId> 27 <groupId>org.springframework.boot</groupId>
yudao-module-ai/yudao-module-ai-api/src/main/java/cn/iocoder/yudao/module/ai/enums/ErrorCodeConstants.java
@@ -12,6 +12,9 @@ public interface ErrorCodeConstants { @@ -12,6 +12,9 @@ public interface ErrorCodeConstants {
12 // ========== API 密钥 1-040-000-000 ========== 12 // ========== API 密钥 1-040-000-000 ==========
13 ErrorCode API_KEY_NOT_EXISTS = new ErrorCode(1_040_000_000, "API 密钥不存在"); 13 ErrorCode API_KEY_NOT_EXISTS = new ErrorCode(1_040_000_000, "API 密钥不存在");
14 ErrorCode API_KEY_DISABLE = new ErrorCode(1_040_000_001, "API 密钥已禁用!"); 14 ErrorCode API_KEY_DISABLE = new ErrorCode(1_040_000_001, "API 密钥已禁用!");
  15 + ErrorCode API_KEY_MIDJOURNEY_NOT_FOUND = new ErrorCode(1_040_000_900, "Midjourney 模型不存在");
  16 + ErrorCode API_KEY_SUNO_NOT_FOUND = new ErrorCode(1_040_000_901, "Suno 模型不存在");
  17 + ErrorCode API_KEY_IMAGE_NODE_FOUND = new ErrorCode(1_040_000_902, "平台({}) 图片模型未配置");
15 18
16 // ========== API 聊天模型 1-040-001-000 ========== 19 // ========== API 聊天模型 1-040-001-000 ==========
17 ErrorCode CHAT_MODEL_NOT_EXISTS = new ErrorCode(1_040_001_000, "模型不存在!"); 20 ErrorCode CHAT_MODEL_NOT_EXISTS = new ErrorCode(1_040_001_000, "模型不存在!");
yudao-module-ai/yudao-module-ai-biz/pom.xml
@@ -2,21 +2,21 @@ @@ -2,21 +2,21 @@
2 <project xmlns="http://maven.apache.org/POM/4.0.0" 2 <project xmlns="http://maven.apache.org/POM/4.0.0"
3 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 3 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4 xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4 xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
5 - <modelVersion>4.0.0</modelVersion>  
6 <parent> 5 <parent>
7 <groupId>cn.iocoder.boot</groupId> 6 <groupId>cn.iocoder.boot</groupId>
8 <artifactId>yudao-module-ai</artifactId> 7 <artifactId>yudao-module-ai</artifactId>
9 <version>${revision}</version> 8 <version>${revision}</version>
10 </parent> 9 </parent>
11 - 10 + <modelVersion>4.0.0</modelVersion>
12 <artifactId>yudao-module-ai-biz</artifactId> 11 <artifactId>yudao-module-ai-biz</artifactId>
13 12
14 - <properties>  
15 - <maven.compiler.source>8</maven.compiler.source>  
16 - <maven.compiler.target>8</maven.compiler.target>  
17 - <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>  
18 - </properties>  
19 - 13 + <name>${project.artifactId}</name>
  14 + <description>
  15 + ai 模块下,接入 LLM 大模型,支持聊天、绘图、音乐、写作、思维脑图等功能。
  16 + 目前已接入各种模型,不限于:
  17 + 国内:通义千问、文心一言、讯飞星火
  18 + 国外:OpenAI、Ollama、Midjourney、StableDiffusion、Suno
  19 + </description>
20 20
21 <dependencies> 21 <dependencies>
22 <dependency> 22 <dependency>
@@ -24,44 +24,36 @@ @@ -24,44 +24,36 @@
24 <artifactId>yudao-module-ai-api</artifactId> 24 <artifactId>yudao-module-ai-api</artifactId>
25 <version>${revision}</version> 25 <version>${revision}</version>
26 </dependency> 26 </dependency>
  27 +
  28 + <!-- 业务组件 -->
27 <dependency> 29 <dependency>
28 <groupId>cn.iocoder.boot</groupId> 30 <groupId>cn.iocoder.boot</groupId>
29 <artifactId>yudao-spring-boot-starter-ai</artifactId> 31 <artifactId>yudao-spring-boot-starter-ai</artifactId>
30 <version>${revision}</version> 32 <version>${revision}</version>
31 </dependency> 33 </dependency>
32 - <!-- yudao framwork -->  
33 - <dependency>  
34 - <groupId>cn.iocoder.boot</groupId>  
35 - <artifactId>yudao-common</artifactId>  
36 - </dependency> 34 +
  35 + <!-- Web 相关 -->
37 <dependency> 36 <dependency>
38 <groupId>cn.iocoder.boot</groupId> 37 <groupId>cn.iocoder.boot</groupId>
39 <artifactId>yudao-spring-boot-starter-security</artifactId> 38 <artifactId>yudao-spring-boot-starter-security</artifactId>
40 </dependency> 39 </dependency>
  40 +
  41 + <!-- DB 相关 -->
41 <dependency> 42 <dependency>
42 <groupId>cn.iocoder.boot</groupId> 43 <groupId>cn.iocoder.boot</groupId>
43 <artifactId>yudao-spring-boot-starter-mybatis</artifactId> 44 <artifactId>yudao-spring-boot-starter-mybatis</artifactId>
44 </dependency> 45 </dependency>
45 - <!-- 测试 --> 46 +
  47 + <!-- Job 相关 -->
46 <dependency> 48 <dependency>
47 <groupId>cn.iocoder.boot</groupId> 49 <groupId>cn.iocoder.boot</groupId>
48 - <artifactId>yudao-spring-boot-starter-test</artifactId> 50 + <artifactId>yudao-spring-boot-starter-job</artifactId>
49 </dependency> 51 </dependency>
  52 +
  53 + <!-- Test 测试相关 -->
50 <dependency> 54 <dependency>
51 <groupId>cn.iocoder.boot</groupId> 55 <groupId>cn.iocoder.boot</groupId>
52 - <artifactId>yudao-spring-boot-starter-job</artifactId> 56 + <artifactId>yudao-spring-boot-starter-test</artifactId>
53 </dependency> 57 </dependency>
54 </dependencies> 58 </dependencies>
55 - <build>  
56 - <plugins>  
57 - <plugin>  
58 - <groupId>org.apache.maven.plugins</groupId>  
59 - <artifactId>maven-compiler-plugin</artifactId>  
60 - <configuration>  
61 - <source>17</source>  
62 - <target>17</target>  
63 - </configuration>  
64 - </plugin>  
65 - </plugins>  
66 - </build>  
67 </project> 59 </project>
68 \ No newline at end of file 60 \ No newline at end of file
yudao-module-ai/yudao-module-ai-biz/src/main/java/cn/iocoder/yudao/module/ai/controller/admin/image/vo/AiImagePageReqVO.java
@@ -13,8 +13,6 @@ import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_ @@ -13,8 +13,6 @@ import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_
13 13
14 @Schema(description = "管理后台 - AI 绘画分页 Request VO") 14 @Schema(description = "管理后台 - AI 绘画分页 Request VO")
15 @Data 15 @Data
16 -@EqualsAndHashCode(callSuper = true)  
17 -@ToString(callSuper = true)  
18 public class AiImagePageReqVO extends PageParam { 16 public class AiImagePageReqVO extends PageParam {
19 17
20 @Schema(description = "用户编号", example = "28987") 18 @Schema(description = "用户编号", example = "28987")
yudao-module-ai/yudao-module-ai-biz/src/main/java/cn/iocoder/yudao/module/ai/controller/admin/image/vo/midjourney/AiMidjourneyImagineReqVO.java
@@ -5,8 +5,6 @@ import jakarta.validation.constraints.NotEmpty; @@ -5,8 +5,6 @@ import jakarta.validation.constraints.NotEmpty;
5 import jakarta.validation.constraints.NotNull; 5 import jakarta.validation.constraints.NotNull;
6 import lombok.Data; 6 import lombok.Data;
7 7
8 -import java.util.List;  
9 -  
10 @Schema(description = "管理后台 - AI 绘画生成(Midjourney) Request VO") 8 @Schema(description = "管理后台 - AI 绘画生成(Midjourney) Request VO")
11 @Data 9 @Data
12 public class AiMidjourneyImagineReqVO { 10 public class AiMidjourneyImagineReqVO {
@@ -31,7 +29,7 @@ public class AiMidjourneyImagineReqVO { @@ -31,7 +29,7 @@ public class AiMidjourneyImagineReqVO {
31 @NotEmpty(message = "版本号不能为空") 29 @NotEmpty(message = "版本号不能为空")
32 private String version; 30 private String version;
33 31
34 - @Schema(description = "参考图") 32 + @Schema(description = "参考图", example = "https://www.iocoder.cn/x.png")
35 private String referImageUrl; 33 private String referImageUrl;
36 34
37 } 35 }
yudao-module-ai/yudao-module-ai-biz/src/main/java/cn/iocoder/yudao/module/ai/controller/admin/model/vo/apikey/AiApiKeyPageReqVO.java
@@ -11,8 +11,6 @@ import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_ @@ -11,8 +11,6 @@ import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_
11 11
12 @Schema(description = "管理后台 - AI API 密钥分页 Request VO") 12 @Schema(description = "管理后台 - AI API 密钥分页 Request VO")
13 @Data 13 @Data
14 -@EqualsAndHashCode(callSuper = true)  
15 -@ToString(callSuper = true)  
16 public class AiApiKeyPageReqVO extends PageParam { 14 public class AiApiKeyPageReqVO extends PageParam {
17 15
18 @Schema(description = "名称", example = "文心一言") 16 @Schema(description = "名称", example = "文心一言")
yudao-module-ai/yudao-module-ai-biz/src/main/java/cn/iocoder/yudao/module/ai/controller/admin/model/vo/chatModel/AiChatModelPageReqVO.java
@@ -6,8 +6,6 @@ import cn.iocoder.yudao.framework.common.pojo.PageParam; @@ -6,8 +6,6 @@ import cn.iocoder.yudao.framework.common.pojo.PageParam;
6 6
7 @Schema(description = "管理后台 - API 聊天模型分页 Request VO") 7 @Schema(description = "管理后台 - API 聊天模型分页 Request VO")
8 @Data 8 @Data
9 -@EqualsAndHashCode(callSuper = true)  
10 -@ToString(callSuper = true)  
11 public class AiChatModelPageReqVO extends PageParam { 9 public class AiChatModelPageReqVO extends PageParam {
12 10
13 @Schema(description = "模型名字", example = "张三") 11 @Schema(description = "模型名字", example = "张三")
yudao-module-ai/yudao-module-ai-biz/src/main/java/cn/iocoder/yudao/module/ai/controller/admin/model/vo/chatRole/AiChatRolePageReqVO.java
@@ -6,8 +6,6 @@ import cn.iocoder.yudao.framework.common.pojo.PageParam; @@ -6,8 +6,6 @@ import cn.iocoder.yudao.framework.common.pojo.PageParam;
6 6
7 @Schema(description = "管理后台 - AI 聊天角色分页 Request VO") 7 @Schema(description = "管理后台 - AI 聊天角色分页 Request VO")
8 @Data 8 @Data
9 -@EqualsAndHashCode(callSuper = true)  
10 -@ToString(callSuper = true)  
11 public class AiChatRolePageReqVO extends PageParam { 9 public class AiChatRolePageReqVO extends PageParam {
12 10
13 @Schema(description = "角色名称", example = "李四") 11 @Schema(description = "角色名称", example = "李四")
yudao-module-ai/yudao-module-ai-biz/src/main/java/cn/iocoder/yudao/module/ai/controller/admin/music/vo/AiMusicPageReqVO.java
@@ -16,8 +16,6 @@ import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_ @@ -16,8 +16,6 @@ import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_
16 16
17 @Schema(description = "管理后台 - AI 音乐分页 Request VO") 17 @Schema(description = "管理后台 - AI 音乐分页 Request VO")
18 @Data 18 @Data
19 -@EqualsAndHashCode(callSuper = true)  
20 -@ToString(callSuper = true)  
21 public class AiMusicPageReqVO extends PageParam { 19 public class AiMusicPageReqVO extends PageParam {
22 20
23 @Schema(description = "用户编号", example = "12212") 21 @Schema(description = "用户编号", example = "12212")
yudao-module-ai/yudao-module-ai-biz/src/main/java/cn/iocoder/yudao/module/ai/service/image/AiImageServiceImpl.java
@@ -35,7 +35,6 @@ import org.springframework.scheduling.annotation.Async; @@ -35,7 +35,6 @@ import org.springframework.scheduling.annotation.Async;
35 import org.springframework.stereotype.Service; 35 import org.springframework.stereotype.Service;
36 import org.springframework.transaction.annotation.Transactional; 36 import org.springframework.transaction.annotation.Transactional;
37 37
38 -import java.util.ArrayList;  
39 import java.util.Collections; 38 import java.util.Collections;
40 import java.util.List; 39 import java.util.List;
41 import java.util.Map; 40 import java.util.Map;
@@ -192,10 +191,8 @@ public class AiImageServiceImpl implements AiImageService { @@ -192,10 +191,8 @@ public class AiImageServiceImpl implements AiImageService {
192 imageMapper.insert(image); 191 imageMapper.insert(image);
193 192
194 // 2. 调用 Midjourney Proxy 提交任务 193 // 2. 调用 Midjourney Proxy 提交任务
195 - List<String> base64Array = new ArrayList<>(8);  
196 - if (StrUtil.isNotBlank(reqVO.getReferImageUrl())) {  
197 - base64Array.add("data:image/jpeg;base64,".concat(Base64.encode(HttpUtil.downloadBytes(reqVO.getReferImageUrl()))));  
198 - } 194 + List<String> base64Array = StrUtil.isBlank(reqVO.getReferImageUrl()) ? null :
  195 + Collections.singletonList("data:image/jpeg;base64,".concat(Base64.encode(HttpUtil.downloadBytes(reqVO.getReferImageUrl()))));
199 MidjourneyApi.ImagineRequest imagineRequest = new MidjourneyApi.ImagineRequest( 196 MidjourneyApi.ImagineRequest imagineRequest = new MidjourneyApi.ImagineRequest(
200 base64Array, reqVO.getPrompt(),null, 197 base64Array, reqVO.getPrompt(),null,
201 MidjourneyApi.ImagineRequest.buildState(reqVO.getWidth(), 198 MidjourneyApi.ImagineRequest.buildState(reqVO.getWidth(),
yudao-module-ai/yudao-module-ai-biz/src/main/java/cn/iocoder/yudao/module/ai/service/model/AiApiKeyServiceImpl.java
@@ -108,7 +108,7 @@ public class AiApiKeyServiceImpl implements AiApiKeyService { @@ -108,7 +108,7 @@ public class AiApiKeyServiceImpl implements AiApiKeyService {
108 public ImageModel getImageClient(AiPlatformEnum platform) { 108 public ImageModel getImageClient(AiPlatformEnum platform) {
109 AiApiKeyDO apiKey = apiKeyMapper.selectFirstByPlatformAndStatus(platform.getName(), CommonStatusEnum.ENABLE.getStatus()); 109 AiApiKeyDO apiKey = apiKeyMapper.selectFirstByPlatformAndStatus(platform.getName(), CommonStatusEnum.ENABLE.getStatus());
110 if (apiKey == null) { 110 if (apiKey == null) {
111 - return null; 111 + throw exception(API_KEY_IMAGE_NODE_FOUND, platform.getName());
112 } 112 }
113 return clientFactory.getOrCreateImageClient(platform, apiKey.getApiKey(), apiKey.getUrl()); 113 return clientFactory.getOrCreateImageClient(platform, apiKey.getApiKey(), apiKey.getUrl());
114 } 114 }
@@ -117,9 +117,8 @@ public class AiApiKeyServiceImpl implements AiApiKeyService { @@ -117,9 +117,8 @@ public class AiApiKeyServiceImpl implements AiApiKeyService {
117 public MidjourneyApi getMidjourneyApi() { 117 public MidjourneyApi getMidjourneyApi() {
118 AiApiKeyDO apiKey = apiKeyMapper.selectFirstByPlatformAndStatus( 118 AiApiKeyDO apiKey = apiKeyMapper.selectFirstByPlatformAndStatus(
119 AiPlatformEnum.MIDJOURNEY.getPlatform(), CommonStatusEnum.ENABLE.getStatus()); 119 AiPlatformEnum.MIDJOURNEY.getPlatform(), CommonStatusEnum.ENABLE.getStatus());
120 - // todo @芋艿 这些地方直接抛异常会好点,不然调用到的地方都需要做判断  
121 if (apiKey == null) { 120 if (apiKey == null) {
122 - return null; 121 + throw exception(API_KEY_MIDJOURNEY_NOT_FOUND);
123 } 122 }
124 return clientFactory.getOrCreateMidjourneyApi(apiKey.getApiKey(), apiKey.getUrl()); 123 return clientFactory.getOrCreateMidjourneyApi(apiKey.getApiKey(), apiKey.getUrl());
125 } 124 }
@@ -129,7 +128,7 @@ public class AiApiKeyServiceImpl implements AiApiKeyService { @@ -129,7 +128,7 @@ public class AiApiKeyServiceImpl implements AiApiKeyService {
129 AiApiKeyDO apiKey = apiKeyMapper.selectFirstByPlatformAndStatus( 128 AiApiKeyDO apiKey = apiKeyMapper.selectFirstByPlatformAndStatus(
130 AiPlatformEnum.SUNO.getPlatform(), CommonStatusEnum.ENABLE.getStatus()); 129 AiPlatformEnum.SUNO.getPlatform(), CommonStatusEnum.ENABLE.getStatus());
131 if (apiKey == null) { 130 if (apiKey == null) {
132 - return null; 131 + throw exception(API_KEY_SUNO_NOT_FOUND);
133 } 132 }
134 return clientFactory.getOrCreateSunoApi(apiKey.getApiKey(), apiKey.getUrl()); 133 return clientFactory.getOrCreateSunoApi(apiKey.getApiKey(), apiKey.getUrl());
135 } 134 }
yudao-module-ai/yudao-spring-boot-starter-ai/pom.xml
@@ -8,8 +8,9 @@ @@ -8,8 +8,9 @@
8 <version>${revision}</version> 8 <version>${revision}</version>
9 </parent> 9 </parent>
10 <modelVersion>4.0.0</modelVersion> 10 <modelVersion>4.0.0</modelVersion>
11 -  
12 <artifactId>yudao-spring-boot-starter-ai</artifactId> 11 <artifactId>yudao-spring-boot-starter-ai</artifactId>
  12 + <packaging>jar</packaging>
  13 +
13 <name>${project.artifactId}</name> 14 <name>${project.artifactId}</name>
14 <description>AI 大模型拓展,接入国内外大模型</description> 15 <description>AI 大模型拓展,接入国内外大模型</description>
15 <properties> 16 <properties>
@@ -58,6 +59,7 @@ @@ -58,6 +59,7 @@
58 <version>2.14.0</version> 59 <version>2.14.0</version>
59 </dependency> 60 </dependency>
60 61
  62 + <!-- Test 测试相关 -->
61 <dependency> 63 <dependency>
62 <groupId>junit</groupId> 64 <groupId>junit</groupId>
63 <artifactId>junit</artifactId> 65 <artifactId>junit</artifactId>
yudao-module-ai/yudao-spring-boot-starter-ai/src/main/java/cn/iocoder/yudao/framework/ai/core/model/package-info.java deleted
1 -/**  
2 - * model 包,接入各种大模型,对标 https://github.com/spring-projects/spring-ai/tree/main/models  
3 - *  
4 - * 1. yiyan 包:【百度】文心一言  
5 - * 2. tongyi 包:【阿里】通义千问,对标 spring-cloud-alibaba 提供的 ai 包 TODO 芋艿:未来直接使用它  
6 - * 3. xinghuo 包:【讯飞】星火,自己实现  
7 - * 4. midjourney 包:Midjourney,接入 https://github.com/novicezk/midjourney-proxy 实现  
8 - * 5. suno 包:TODO 芋艿:  
9 - */  
10 -package cn.iocoder.yudao.framework.ai.core.model;  
11 \ No newline at end of file 0 \ No newline at end of file
yudao-module-ai/yudao-spring-boot-starter-ai/src/main/java/cn/iocoder/yudao/framework/ai/core/package-info.java deleted
1 -/**  
2 - * 芋道 AI Starter,整体参考 spring-ai 拓展  
3 - */  
4 -package cn.iocoder.yudao.framework.ai.core;  
5 \ No newline at end of file 0 \ No newline at end of file
yudao-module-ai/yudao-spring-boot-starter-ai/src/main/java/cn/iocoder/yudao/framework/ai/package-info.java
@@ -6,10 +6,8 @@ @@ -6,10 +6,8 @@
6 * 包路径: 6 * 包路径:
7 * 1. chat、parser、model、parser 包:https://github.com/spring-projects/spring-ai/tree/main/spring-ai-core 拷贝 7 * 1. chat、parser、model、parser 包:https://github.com/spring-projects/spring-ai/tree/main/spring-ai-core 拷贝
8 * 2. models 包:对标 https://github.com/spring-projects/spring-ai/tree/main/models 拷贝 8 * 2. models 包:对标 https://github.com/spring-projects/spring-ai/tree/main/models 拷贝
9 - * 2.1 tongyi 包:【阿里】通义千问,对标 spring-cloud-alibaba 提供的 ai 包  
10 - * 2.2 yiyan 包:【百度】文心一言,自己实现  
11 - * 2.3 xinghuo 包:【讯飞】星火,自己实现  
12 - * 2.4 openai 包:【OpenAI】ChatGPT,拷贝 spring-ai 提供的 models/openai 包  
13 - * 2.5 midjourney 包:Midjourney,参考 https://github.com/novicezk/midjourney-proxy 实现 9 + * 2.1 xinghuo 包:【讯飞】星火,自己实现
  10 + * 2.2 midjourney 包:Midjourney API,对接 https://github.com/novicezk/midjourney-proxy 实现
  11 + * 2.3 suno 包:Suno API,对接 https://github.com/gcui-art/suno-api 实现
14 */ 12 */
15 package cn.iocoder.yudao.framework.ai; 13 package cn.iocoder.yudao.framework.ai;
16 \ No newline at end of file 14 \ No newline at end of file