【代码评审】AI:PPT 相关

This commit is contained in:
YunaiV 2025-04-12 08:54:35 +08:00
parent c357e7ae55
commit 911f5f8bf3
4 changed files with 4 additions and 19 deletions

View File

@ -25,7 +25,6 @@ import java.util.Objects;
import java.util.function.Function; import java.util.function.Function;
import java.util.function.Predicate; import java.util.function.Predicate;
/** /**
* 文多多 API * 文多多 API
* *
@ -50,11 +49,6 @@ public class WenDuoDuoPptApi {
sink.error(new IllegalStateException("[WenDuoDuoPptApi] 调用失败!")); sink.error(new IllegalStateException("[WenDuoDuoPptApi] 调用失败!"));
}); });
/**
* 构造方法
*
* @param token API令牌可为空后续API调用时单独指定
*/
public WenDuoDuoPptApi(String token) { public WenDuoDuoPptApi(String token) {
Assert.hasText(token, "token 不能为空"); Assert.hasText(token, "token 不能为空");
this.webClient = WebClient.builder() this.webClient = WebClient.builder()
@ -96,7 +90,7 @@ public class WenDuoDuoPptApi {
* @param type 类型 * @param type 类型
* @param content 内容 * @param content 内容
* @param files 文件列表 * @param files 文件列表
* @return 任务ID * @return 任务 ID
* @see <a href="https://docmee.cn/open-platform/api#%E5%88%9B%E5%BB%BA%E4%BB%BB%E5%8A%A1">创建任务</a> * @see <a href="https://docmee.cn/open-platform/api#%E5%88%9B%E5%BB%BA%E4%BB%BB%E5%8A%A1">创建任务</a>
*/ */
public ApiResponse createTask(Integer type, String content, List<MultipartFile> files) { public ApiResponse createTask(Integer type, String content, List<MultipartFile> files) {
@ -219,7 +213,7 @@ public class WenDuoDuoPptApi {
} }
/** /**
* 创建Token请求参数 * 创建 Token 请求参数
*/ */
@JsonInclude(value = JsonInclude.Include.NON_NULL) @JsonInclude(value = JsonInclude.Include.NON_NULL)
public record CreateTokenRequest( public record CreateTokenRequest(

View File

@ -448,7 +448,6 @@ public class XunFeiPptApi {
*/ */
private MultiValueMap<String, Object> buildCreatePptFormData(CreatePptRequest request) { private MultiValueMap<String, Object> buildCreatePptFormData(CreatePptRequest request) {
MultiValueMap<String, Object> formData = new LinkedMultiValueMap<>(); MultiValueMap<String, Object> formData = new LinkedMultiValueMap<>();
if (request.file() != null) { if (request.file() != null) {
try { try {
formData.add("file", new ByteArrayResource(request.file().getBytes()) { formData.add("file", new ByteArrayResource(request.file().getBytes()) {
@ -493,7 +492,6 @@ public class XunFeiPptApi {
isPresent = true; isPresent = true;
} }
} }
if (isPresent) { if (isPresent) {
map.put(key, value); map.put(key, value);
} }

View File

@ -9,10 +9,8 @@ import org.springframework.ai.openai.api.OpenAiApi;
import org.springframework.ai.tool.annotation.Tool; import org.springframework.ai.tool.annotation.Tool;
import org.springframework.ai.tool.method.MethodToolCallbackProvider; import org.springframework.ai.tool.method.MethodToolCallbackProvider;
public class DouBaoMcpTests { public class DouBaoMcpTests {
private final OpenAiChatModel openAiChatModel = OpenAiChatModel.builder() private final OpenAiChatModel openAiChatModel = OpenAiChatModel.builder()
.openAiApi(OpenAiApi.builder() .openAiApi(OpenAiApi.builder()
.baseUrl(DouBaoChatModel.BASE_URL) .baseUrl(DouBaoChatModel.BASE_URL)

View File

@ -16,13 +16,8 @@ import java.util.Objects;
*/ */
public class WenDuoDuoPptApiTests { public class WenDuoDuoPptApiTests {
private final WenDuoDuoPptApi wenDuoDuoPptApi;
private final String token = ""; // API Token private final String token = ""; // API Token
private final WenDuoDuoPptApi wenDuoDuoPptApi = new WenDuoDuoPptApi(token);
{
wenDuoDuoPptApi = new WenDuoDuoPptApi(token);
}
@Test @Test
@Disabled @Disabled