Skip to content

Commit

Permalink
Merge branch 'master-jdk17' of https://gitee.com/zhijiantianya/yudao-…
Browse files Browse the repository at this point in the history
  • Loading branch information
YunaiV committed Aug 26, 2024
2 parents 4e200c5 + 51a37f8 commit f63b752
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 8 deletions.
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -70,12 +71,12 @@ public ChatResponse call(Prompt prompt) {
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<OpenAiApi.ChatCompletion.Choice> 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 返回
Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -72,12 +73,12 @@ public ChatResponse call(Prompt prompt) {
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<OpenAiApi.ChatCompletion.Choice> 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 返回
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -82,7 +83,7 @@ public AudioTranscriptionResponse call(AudioTranscriptionPrompt prompt) {
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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -207,7 +208,7 @@ public Flux<ChatResponse> stream(Prompt prompt) {
.getChoices()
.get(0)
));
return new ChatResponse(List.of(gen));
return new ChatResponse(ListUtil.of(gen));
})
)
.publishOn(Schedulers.parallel());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -100,7 +101,7 @@ public List<Double> embed(Document document) {

return this.call(
new EmbeddingRequest(
List.of(document.getFormattedContent(this.metadataMode)),
ListUtil.of(document.getFormattedContent(this.metadataMode)),
null)
).getResults().stream()
.map(Embedding::getOutput)
Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -66,7 +67,7 @@ public void testGetMusicList() {
String id = "584729e5-0fe9-4157-86da-1b4803ff42bf";

// 调用方法
List<SunoApi.MusicData> musicList = sunoApi.getMusicList(List.of(id));
List<SunoApi.MusicData> musicList = sunoApi.getMusicList(ListUtil.of(id));
// 打印结果
System.out.println(musicList);
}
Expand Down

0 comments on commit f63b752

Please sign in to comment.