From 51a37f885b5e3698ce377572079df28ea5151644 Mon Sep 17 00:00:00 2001 From: YunaiV Date: Mon, 26 Aug 2024 12:38:00 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90=E4=BB=A3=E7=A0=81=E4=BC=98=E5=8C=96?= =?UTF-8?q?=E3=80=91=E5=A2=9E=E5=BC=BA=20JDK17=E3=80=81JDK8=20=E4=B9=8B?= =?UTF-8?q?=E9=97=B4=E7=9A=84=E5=85=BC=E5=AE=B9=E6=80=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ai/core/model/deepseek/DeepSeekChatModel.java | 5 +++-- .../framework/ai/core/model/xinghuo/XingHuoChatModel.java | 5 +++-- .../audio/transcription/TongYiAudioTranscriptionModel.java | 3 ++- .../com/alibaba/cloud/ai/tongyi/chat/TongYiChatModel.java | 3 ++- .../ai/tongyi/embedding/TongYiTextEmbeddingModel.java | 3 ++- .../cn/iocoder/yudao/framework/ai/music/SunoApiTests.java | 3 ++- .../statistics/CrmStatisticsPerformanceServiceImpl.java | 3 ++- .../framework/sms/core/client/impl/SmsClientTests.java | 7 ++++--- 8 files changed, 20 insertions(+), 12 deletions(-) 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); } diff --git a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/statistics/CrmStatisticsPerformanceServiceImpl.java b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/statistics/CrmStatisticsPerformanceServiceImpl.java index 98ca7d97f..fbe0c99c1 100644 --- a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/statistics/CrmStatisticsPerformanceServiceImpl.java +++ b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/statistics/CrmStatisticsPerformanceServiceImpl.java @@ -1,6 +1,7 @@ package cn.iocoder.yudao.module.crm.service.statistics; import cn.hutool.core.collection.CollUtil; +import cn.hutool.core.collection.ListUtil; import cn.hutool.core.util.ObjUtil; import cn.iocoder.yudao.module.crm.controller.admin.statistics.vo.performance.CrmStatisticsPerformanceReqVO; import cn.iocoder.yudao.module.crm.controller.admin.statistics.vo.performance.CrmStatisticsPerformanceRespVO; @@ -105,7 +106,7 @@ public class CrmStatisticsPerformanceServiceImpl implements CrmStatisticsPerform private List getUserIds(CrmStatisticsPerformanceReqVO reqVO) { // 情况一:选中某个用户 if (ObjUtil.isNotNull(reqVO.getUserId())) { - return List.of(reqVO.getUserId()); + return ListUtil.of(reqVO.getUserId()); } // 情况二:选中某个部门 // 2.1 获得部门列表 diff --git a/yudao-module-system/yudao-module-system-biz/src/test/java/cn/iocoder/yudao/module/system/framework/sms/core/client/impl/SmsClientTests.java b/yudao-module-system/yudao-module-system-biz/src/test/java/cn/iocoder/yudao/module/system/framework/sms/core/client/impl/SmsClientTests.java index 6eb22af1b..b1e96f195 100644 --- a/yudao-module-system/yudao-module-system-biz/src/test/java/cn/iocoder/yudao/module/system/framework/sms/core/client/impl/SmsClientTests.java +++ b/yudao-module-system/yudao-module-system-biz/src/test/java/cn/iocoder/yudao/module/system/framework/sms/core/client/impl/SmsClientTests.java @@ -1,5 +1,6 @@ package cn.iocoder.yudao.module.system.framework.sms.core.client.impl; +import cn.hutool.core.collection.ListUtil; import cn.iocoder.yudao.framework.common.core.KeyValue; import cn.iocoder.yudao.module.system.framework.sms.core.client.dto.SmsReceiveRespDTO; import cn.iocoder.yudao.module.system.framework.sms.core.client.dto.SmsSendRespDTO; @@ -47,7 +48,7 @@ public class SmsClientTests { String mobile = "15601691323"; String apiTemplateId = "SMS_207945135"; // 调用 - SmsSendRespDTO sendRespDTO = client.sendSms(sendLogId, mobile, apiTemplateId, List.of(new KeyValue<>("code", "1024"))); + SmsSendRespDTO sendRespDTO = client.sendSms(sendLogId, mobile, apiTemplateId, ListUtil.of(new KeyValue<>("code", "1024"))); // 打印结果 System.out.println(sendRespDTO); } @@ -96,7 +97,7 @@ public class SmsClientTests { String mobile = "15601691323"; String apiTemplateId = "2136358"; // 调用 - SmsSendRespDTO sendRespDTO = client.sendSms(sendLogId, mobile, apiTemplateId, List.of(new KeyValue<>("code", "1024"))); + SmsSendRespDTO sendRespDTO = client.sendSms(sendLogId, mobile, apiTemplateId, ListUtil.of(new KeyValue<>("code", "1024"))); // 打印结果 System.out.println(sendRespDTO); } @@ -131,7 +132,7 @@ public class SmsClientTests { Long sendLogId = System.currentTimeMillis(); String mobile = "15601691323"; String apiTemplateId = "xx test01"; - List> templateParams = List.of(new KeyValue<>("code", "1024")); + List> templateParams = ListUtil.of(new KeyValue<>("code", "1024")); // 调用 SmsSendRespDTO smsSendRespDTO = client.sendSms(sendLogId, mobile, apiTemplateId, templateParams); // 打印结果