【依赖升级】AI:spring-ai-alibaba-starter 升级到最新,解决流式返回报错的问题

This commit is contained in:
YunaiV 2025-03-11 12:53:34 +08:00
parent b9e8495712
commit 99d5e7c509
4 changed files with 4 additions and 5 deletions

View File

@ -49,7 +49,7 @@
<!-- 通义千问 --> <!-- 通义千问 -->
<groupId>com.alibaba.cloud.ai</groupId> <groupId>com.alibaba.cloud.ai</groupId>
<artifactId>spring-ai-alibaba-starter</artifactId> <artifactId>spring-ai-alibaba-starter</artifactId>
<version>1.0.0-M5.1</version> <version>${spring-ai.version}.1</version>
</dependency> </dependency>
<dependency> <dependency>
<!-- 文心一言 --> <!-- 文心一言 -->

View File

@ -22,8 +22,7 @@ public class AiUtils {
// noinspection EnhancedSwitchMigration // noinspection EnhancedSwitchMigration
switch (platform) { switch (platform) {
case TONG_YI: case TONG_YI:
// TODO @芋艿tongyi 暂时没 maxTokens 选项 return DashScopeChatOptions.builder().withModel(model).withTemperature(temperature).withMaxToken(maxTokens).build();
return DashScopeChatOptions.builder().withModel(model).withTemperature(temperature).build();
case YI_YAN: case YI_YAN:
return QianFanChatOptions.builder().model(model).temperature(temperature).maxTokens(maxTokens).build(); return QianFanChatOptions.builder().model(model).temperature(temperature).maxTokens(maxTokens).build();
case ZHI_PU: case ZHI_PU:

View File

@ -28,6 +28,7 @@ public class TongYiChatModelTests {
.withModel("qwen1.5-72b-chat") // 模型 .withModel("qwen1.5-72b-chat") // 模型
// .withModel("deepseek-r1") // 模型deepseek-r1 // .withModel("deepseek-r1") // 模型deepseek-r1
// .withModel("deepseek-v3") // 模型deepseek-v3 // .withModel("deepseek-v3") // 模型deepseek-v3
// .withModel("deepseek-r1-distill-qwen-1.5b") // 模型deepseek-r1-distill-qwen-1.5b
.build()); .build());
@Test @Test

View File

@ -3,7 +3,6 @@ package cn.iocoder.yudao.framework.ai.image;
import com.alibaba.cloud.ai.dashscope.api.DashScopeImageApi; import com.alibaba.cloud.ai.dashscope.api.DashScopeImageApi;
import com.alibaba.cloud.ai.dashscope.image.DashScopeImageModel; import com.alibaba.cloud.ai.dashscope.image.DashScopeImageModel;
import com.alibaba.cloud.ai.dashscope.image.DashScopeImageOptions; import com.alibaba.cloud.ai.dashscope.image.DashScopeImageOptions;
import com.alibaba.dashscope.aigc.imagesynthesis.ImageSynthesis;
import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import org.springframework.ai.image.ImageOptions; import org.springframework.ai.image.ImageOptions;
@ -25,7 +24,7 @@ public class TongYiImagesModelTest {
public void imageCallTest() { public void imageCallTest() {
// 准备参数 // 准备参数
ImageOptions options = DashScopeImageOptions.builder() ImageOptions options = DashScopeImageOptions.builder()
.withModel(ImageSynthesis.Models.WANX_V1) .withModel("wanx-v1")
.withHeight(256).withWidth(256) .withHeight(256).withWidth(256)
.build(); .build();
ImagePrompt prompt = new ImagePrompt("中国长城!", options); ImagePrompt prompt = new ImagePrompt("中国长城!", options);