diff --git a/yudao-module-ai/yudao-spring-boot-starter-ai/src/main/java/cn/iocoder/yudao/framework/ai/core/model/deepseek/DeepSeekChatModel.java b/yudao-module-ai/yudao-spring-boot-starter-ai/src/main/java/cn/iocoder/yudao/framework/ai/core/model/deepseek/DeepSeekChatModel.java index 1437404e8..e3097b83a 100644 --- a/yudao-module-ai/yudao-spring-boot-starter-ai/src/main/java/cn/iocoder/yudao/framework/ai/core/model/deepseek/DeepSeekChatModel.java +++ b/yudao-module-ai/yudao-spring-boot-starter-ai/src/main/java/cn/iocoder/yudao/framework/ai/core/model/deepseek/DeepSeekChatModel.java @@ -1,5 +1,6 @@ package cn.iocoder.yudao.framework.ai.core.model.deepseek; +import cn.hutool.core.collection.ListUtil; import cn.hutool.core.lang.Assert; import lombok.extern.slf4j.Slf4j; import org.springframework.ai.chat.metadata.ChatGenerationMetadata; @@ -70,12 +71,12 @@ public class DeepSeekChatModel implements ChatModel { OpenAiApi.ChatCompletion chatCompletion = completionEntity.getBody(); if (chatCompletion == null) { log.warn("No chat completion returned for prompt: {}", prompt); - return new ChatResponse(List.of()); + return new ChatResponse(ListUtil.of()); } List choices = chatCompletion.choices(); if (choices == null) { log.warn("No choices returned for prompt: {}", prompt); - return new ChatResponse(List.of()); + return new ChatResponse(ListUtil.of()); } // 2. 转换 ChatResponse 返回 diff --git a/yudao-module-ai/yudao-spring-boot-starter-ai/src/main/java/cn/iocoder/yudao/framework/ai/core/model/xinghuo/XingHuoChatModel.java b/yudao-module-ai/yudao-spring-boot-starter-ai/src/main/java/cn/iocoder/yudao/framework/ai/core/model/xinghuo/XingHuoChatModel.java index 60284bf2f..501d916db 100644 --- a/yudao-module-ai/yudao-spring-boot-starter-ai/src/main/java/cn/iocoder/yudao/framework/ai/core/model/xinghuo/XingHuoChatModel.java +++ b/yudao-module-ai/yudao-spring-boot-starter-ai/src/main/java/cn/iocoder/yudao/framework/ai/core/model/xinghuo/XingHuoChatModel.java @@ -1,5 +1,6 @@ package cn.iocoder.yudao.framework.ai.core.model.xinghuo; +import cn.hutool.core.collection.ListUtil; import cn.hutool.core.lang.Assert; import lombok.extern.slf4j.Slf4j; import org.springframework.ai.chat.metadata.ChatGenerationMetadata; @@ -72,12 +73,12 @@ public class XingHuoChatModel implements ChatModel { OpenAiApi.ChatCompletion chatCompletion = completionEntity.getBody(); if (chatCompletion == null) { log.warn("No chat completion returned for prompt: {}", prompt); - return new ChatResponse(List.of()); + return new ChatResponse(ListUtil.of()); } List choices = chatCompletion.choices(); if (choices == null) { log.warn("No choices returned for prompt: {}", prompt); - return new ChatResponse(List.of()); + return new ChatResponse(ListUtil.of()); } // 2. 转换 ChatResponse 返回 diff --git a/yudao-module-ai/yudao-spring-boot-starter-ai/src/main/java/com/alibaba/cloud/ai/tongyi/audio/transcription/TongYiAudioTranscriptionModel.java b/yudao-module-ai/yudao-spring-boot-starter-ai/src/main/java/com/alibaba/cloud/ai/tongyi/audio/transcription/TongYiAudioTranscriptionModel.java index 2068feeb5..0f0dca9c0 100644 --- a/yudao-module-ai/yudao-spring-boot-starter-ai/src/main/java/com/alibaba/cloud/ai/tongyi/audio/transcription/TongYiAudioTranscriptionModel.java +++ b/yudao-module-ai/yudao-spring-boot-starter-ai/src/main/java/com/alibaba/cloud/ai/tongyi/audio/transcription/TongYiAudioTranscriptionModel.java @@ -16,6 +16,7 @@ package com.alibaba.cloud.ai.tongyi.audio.transcription; +import cn.hutool.core.collection.ListUtil; import com.alibaba.cloud.ai.tongyi.audio.AudioTranscriptionModels; import com.alibaba.cloud.ai.tongyi.audio.transcription.api.AudioTranscriptionPrompt; import com.alibaba.cloud.ai.tongyi.audio.transcription.api.AudioTranscriptionResponse; @@ -82,7 +83,7 @@ public class TongYiAudioTranscriptionModel try { transcriptionParam = TranscriptionParam.builder() .model(AudioTranscriptionModels.Paraformer_V1) - .fileUrls(List.of(String.valueOf(instructions.getURL()))) + .fileUrls(ListUtil.of(String.valueOf(instructions.getURL()))) .build(); } catch (IOException e) { diff --git a/yudao-module-ai/yudao-spring-boot-starter-ai/src/main/java/com/alibaba/cloud/ai/tongyi/chat/TongYiChatModel.java b/yudao-module-ai/yudao-spring-boot-starter-ai/src/main/java/com/alibaba/cloud/ai/tongyi/chat/TongYiChatModel.java index c29ffbdfb..11328a02e 100644 --- a/yudao-module-ai/yudao-spring-boot-starter-ai/src/main/java/com/alibaba/cloud/ai/tongyi/chat/TongYiChatModel.java +++ b/yudao-module-ai/yudao-spring-boot-starter-ai/src/main/java/com/alibaba/cloud/ai/tongyi/chat/TongYiChatModel.java @@ -16,6 +16,7 @@ package com.alibaba.cloud.ai.tongyi.chat; +import cn.hutool.core.collection.ListUtil; import com.alibaba.cloud.ai.tongyi.common.exception.TongYiException; import com.alibaba.dashscope.aigc.conversation.ConversationParam; import com.alibaba.dashscope.aigc.generation.Generation; @@ -207,7 +208,7 @@ public class TongYiChatModel extends .getChoices() .get(0) )); - return new ChatResponse(List.of(gen)); + return new ChatResponse(ListUtil.of(gen)); }) ) .publishOn(Schedulers.parallel()); diff --git a/yudao-module-ai/yudao-spring-boot-starter-ai/src/main/java/com/alibaba/cloud/ai/tongyi/embedding/TongYiTextEmbeddingModel.java b/yudao-module-ai/yudao-spring-boot-starter-ai/src/main/java/com/alibaba/cloud/ai/tongyi/embedding/TongYiTextEmbeddingModel.java index ce92dae07..99a356fe8 100644 --- a/yudao-module-ai/yudao-spring-boot-starter-ai/src/main/java/com/alibaba/cloud/ai/tongyi/embedding/TongYiTextEmbeddingModel.java +++ b/yudao-module-ai/yudao-spring-boot-starter-ai/src/main/java/com/alibaba/cloud/ai/tongyi/embedding/TongYiTextEmbeddingModel.java @@ -16,6 +16,7 @@ package com.alibaba.cloud.ai.tongyi.embedding; +import cn.hutool.core.collection.ListUtil; import com.alibaba.cloud.ai.tongyi.common.exception.TongYiException; import com.alibaba.cloud.ai.tongyi.metadata.TongYiTextEmbeddingResponseMetadata; import com.alibaba.dashscope.embeddings.TextEmbedding; @@ -100,7 +101,7 @@ public class TongYiTextEmbeddingModel extends AbstractEmbeddingModel { return this.call( new EmbeddingRequest( - List.of(document.getFormattedContent(this.metadataMode)), + ListUtil.of(document.getFormattedContent(this.metadataMode)), null) ).getResults().stream() .map(Embedding::getOutput) diff --git a/yudao-module-ai/yudao-spring-boot-starter-ai/src/test/java/cn/iocoder/yudao/framework/ai/music/SunoApiTests.java b/yudao-module-ai/yudao-spring-boot-starter-ai/src/test/java/cn/iocoder/yudao/framework/ai/music/SunoApiTests.java index ed8ecc6c6..2d80fcf06 100644 --- a/yudao-module-ai/yudao-spring-boot-starter-ai/src/test/java/cn/iocoder/yudao/framework/ai/music/SunoApiTests.java +++ b/yudao-module-ai/yudao-spring-boot-starter-ai/src/test/java/cn/iocoder/yudao/framework/ai/music/SunoApiTests.java @@ -1,5 +1,6 @@ package cn.iocoder.yudao.framework.ai.music; +import cn.hutool.core.collection.ListUtil; import cn.iocoder.yudao.framework.ai.core.model.suno.api.SunoApi; import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Test; @@ -66,7 +67,7 @@ public class SunoApiTests { String id = "584729e5-0fe9-4157-86da-1b4803ff42bf"; // 调用方法 - List musicList = sunoApi.getMusicList(List.of(id)); + List musicList = sunoApi.getMusicList(ListUtil.of(id)); // 打印结果 System.out.println(musicList); }