Commit 911f5f8bf38c1de373dcc9c192092c0f4c3923a6
1 parent
c357e7ae
【代码评审】AI:PPT 相关
Showing
4 changed files
with
4 additions
and
19 deletions
yudao-module-ai/yudao-spring-boot-starter-ai/src/main/java/cn/iocoder/yudao/framework/ai/core/model/wenduoduo/api/WenDuoDuoPptApi.java
| @@ -25,7 +25,6 @@ import java.util.Objects; | @@ -25,7 +25,6 @@ import java.util.Objects; | ||
| 25 | import java.util.function.Function; | 25 | import java.util.function.Function; |
| 26 | import java.util.function.Predicate; | 26 | import java.util.function.Predicate; |
| 27 | 27 | ||
| 28 | - | ||
| 29 | /** | 28 | /** |
| 30 | * 文多多 API | 29 | * 文多多 API |
| 31 | * | 30 | * |
| @@ -50,11 +49,6 @@ public class WenDuoDuoPptApi { | @@ -50,11 +49,6 @@ public class WenDuoDuoPptApi { | ||
| 50 | sink.error(new IllegalStateException("[WenDuoDuoPptApi] 调用失败!")); | 49 | sink.error(new IllegalStateException("[WenDuoDuoPptApi] 调用失败!")); |
| 51 | }); | 50 | }); |
| 52 | 51 | ||
| 53 | - /** | ||
| 54 | - * 构造方法 | ||
| 55 | - * | ||
| 56 | - * @param token API令牌,可为空,后续API调用时单独指定 | ||
| 57 | - */ | ||
| 58 | public WenDuoDuoPptApi(String token) { | 52 | public WenDuoDuoPptApi(String token) { |
| 59 | Assert.hasText(token, "token 不能为空"); | 53 | Assert.hasText(token, "token 不能为空"); |
| 60 | this.webClient = WebClient.builder() | 54 | this.webClient = WebClient.builder() |
| @@ -96,7 +90,7 @@ public class WenDuoDuoPptApi { | @@ -96,7 +90,7 @@ public class WenDuoDuoPptApi { | ||
| 96 | * @param type 类型 | 90 | * @param type 类型 |
| 97 | * @param content 内容 | 91 | * @param content 内容 |
| 98 | * @param files 文件列表 | 92 | * @param files 文件列表 |
| 99 | - * @return 任务ID | 93 | + * @return 任务 ID |
| 100 | * @see <a href="https://docmee.cn/open-platform/api#%E5%88%9B%E5%BB%BA%E4%BB%BB%E5%8A%A1">创建任务</a> | 94 | * @see <a href="https://docmee.cn/open-platform/api#%E5%88%9B%E5%BB%BA%E4%BB%BB%E5%8A%A1">创建任务</a> |
| 101 | */ | 95 | */ |
| 102 | public ApiResponse createTask(Integer type, String content, List<MultipartFile> files) { | 96 | public ApiResponse createTask(Integer type, String content, List<MultipartFile> files) { |
| @@ -219,7 +213,7 @@ public class WenDuoDuoPptApi { | @@ -219,7 +213,7 @@ public class WenDuoDuoPptApi { | ||
| 219 | } | 213 | } |
| 220 | 214 | ||
| 221 | /** | 215 | /** |
| 222 | - * 创建Token请求参数 | 216 | + * 创建 Token 请求参数 |
| 223 | */ | 217 | */ |
| 224 | @JsonInclude(value = JsonInclude.Include.NON_NULL) | 218 | @JsonInclude(value = JsonInclude.Include.NON_NULL) |
| 225 | public record CreateTokenRequest( | 219 | public record CreateTokenRequest( |
yudao-module-ai/yudao-spring-boot-starter-ai/src/main/java/cn/iocoder/yudao/framework/ai/core/model/xinghuo/api/XunFeiPptApi.java
| @@ -448,7 +448,6 @@ public class XunFeiPptApi { | @@ -448,7 +448,6 @@ public class XunFeiPptApi { | ||
| 448 | */ | 448 | */ |
| 449 | private MultiValueMap<String, Object> buildCreatePptFormData(CreatePptRequest request) { | 449 | private MultiValueMap<String, Object> buildCreatePptFormData(CreatePptRequest request) { |
| 450 | MultiValueMap<String, Object> formData = new LinkedMultiValueMap<>(); | 450 | MultiValueMap<String, Object> formData = new LinkedMultiValueMap<>(); |
| 451 | - | ||
| 452 | if (request.file() != null) { | 451 | if (request.file() != null) { |
| 453 | try { | 452 | try { |
| 454 | formData.add("file", new ByteArrayResource(request.file().getBytes()) { | 453 | formData.add("file", new ByteArrayResource(request.file().getBytes()) { |
| @@ -493,7 +492,6 @@ public class XunFeiPptApi { | @@ -493,7 +492,6 @@ public class XunFeiPptApi { | ||
| 493 | isPresent = true; | 492 | isPresent = true; |
| 494 | } | 493 | } |
| 495 | } | 494 | } |
| 496 | - | ||
| 497 | if (isPresent) { | 495 | if (isPresent) { |
| 498 | map.put(key, value); | 496 | map.put(key, value); |
| 499 | } | 497 | } |
yudao-module-ai/yudao-spring-boot-starter-ai/src/test/java/cn/iocoder/yudao/framework/ai/mcp/DouBaoMcpTests.java
| @@ -9,10 +9,8 @@ import org.springframework.ai.openai.api.OpenAiApi; | @@ -9,10 +9,8 @@ import org.springframework.ai.openai.api.OpenAiApi; | ||
| 9 | import org.springframework.ai.tool.annotation.Tool; | 9 | import org.springframework.ai.tool.annotation.Tool; |
| 10 | import org.springframework.ai.tool.method.MethodToolCallbackProvider; | 10 | import org.springframework.ai.tool.method.MethodToolCallbackProvider; |
| 11 | 11 | ||
| 12 | - | ||
| 13 | public class DouBaoMcpTests { | 12 | public class DouBaoMcpTests { |
| 14 | 13 | ||
| 15 | - | ||
| 16 | private final OpenAiChatModel openAiChatModel = OpenAiChatModel.builder() | 14 | private final OpenAiChatModel openAiChatModel = OpenAiChatModel.builder() |
| 17 | .openAiApi(OpenAiApi.builder() | 15 | .openAiApi(OpenAiApi.builder() |
| 18 | .baseUrl(DouBaoChatModel.BASE_URL) | 16 | .baseUrl(DouBaoChatModel.BASE_URL) |
| @@ -121,4 +119,4 @@ public class DouBaoMcpTests { | @@ -121,4 +119,4 @@ public class DouBaoMcpTests { | ||
| 121 | 119 | ||
| 122 | } | 120 | } |
| 123 | 121 | ||
| 124 | -} | ||
| 125 | \ No newline at end of file | 122 | \ No newline at end of file |
| 123 | +} | ||
| 126 | \ No newline at end of file | 124 | \ No newline at end of file |
yudao-module-ai/yudao-spring-boot-starter-ai/src/test/java/cn/iocoder/yudao/framework/ai/ppt/wdd/WenDuoDuoPptApiTests.java
| @@ -16,13 +16,8 @@ import java.util.Objects; | @@ -16,13 +16,8 @@ import java.util.Objects; | ||
| 16 | */ | 16 | */ |
| 17 | public class WenDuoDuoPptApiTests { | 17 | public class WenDuoDuoPptApiTests { |
| 18 | 18 | ||
| 19 | - private final WenDuoDuoPptApi wenDuoDuoPptApi; | ||
| 20 | - | ||
| 21 | private final String token = ""; // API Token | 19 | private final String token = ""; // API Token |
| 22 | - | ||
| 23 | - { | ||
| 24 | - wenDuoDuoPptApi = new WenDuoDuoPptApi(token); | ||
| 25 | - } | 20 | + private final WenDuoDuoPptApi wenDuoDuoPptApi = new WenDuoDuoPptApi(token); |
| 26 | 21 | ||
| 27 | @Test | 22 | @Test |
| 28 | @Disabled | 23 | @Disabled |