Commit 99d5e7c5094875bd379f7cd98d05d387677eccae
1 parent
b9e84957
【依赖升级】AI:spring-ai-alibaba-starter 升级到最新,解决流式返回报错的问题
Showing
4 changed files
with
4 additions
and
5 deletions
yudao-module-ai/yudao-spring-boot-starter-ai/pom.xml
yudao-module-ai/yudao-spring-boot-starter-ai/src/main/java/cn/iocoder/yudao/framework/ai/core/util/AiUtils.java
| ... | ... | @@ -22,8 +22,7 @@ public class AiUtils { |
| 22 | 22 | // noinspection EnhancedSwitchMigration |
| 23 | 23 | switch (platform) { |
| 24 | 24 | case TONG_YI: |
| 25 | - // TODO @芋艿:tongyi 暂时没 maxTokens 选项 | |
| 26 | - return DashScopeChatOptions.builder().withModel(model).withTemperature(temperature).build(); | |
| 25 | + return DashScopeChatOptions.builder().withModel(model).withTemperature(temperature).withMaxToken(maxTokens).build(); | |
| 27 | 26 | case YI_YAN: |
| 28 | 27 | return QianFanChatOptions.builder().model(model).temperature(temperature).maxTokens(maxTokens).build(); |
| 29 | 28 | case ZHI_PU: | ... | ... |
yudao-module-ai/yudao-spring-boot-starter-ai/src/test/java/cn/iocoder/yudao/framework/ai/chat/TongYiChatModelTests.java
| ... | ... | @@ -28,6 +28,7 @@ public class TongYiChatModelTests { |
| 28 | 28 | .withModel("qwen1.5-72b-chat") // 模型 |
| 29 | 29 | // .withModel("deepseek-r1") // 模型(deepseek-r1) |
| 30 | 30 | // .withModel("deepseek-v3") // 模型(deepseek-v3) |
| 31 | +// .withModel("deepseek-r1-distill-qwen-1.5b") // 模型(deepseek-r1-distill-qwen-1.5b) | |
| 31 | 32 | .build()); |
| 32 | 33 | |
| 33 | 34 | @Test | ... | ... |
yudao-module-ai/yudao-spring-boot-starter-ai/src/test/java/cn/iocoder/yudao/framework/ai/image/TongYiImagesModelTest.java
| ... | ... | @@ -3,7 +3,6 @@ package cn.iocoder.yudao.framework.ai.image; |
| 3 | 3 | import com.alibaba.cloud.ai.dashscope.api.DashScopeImageApi; |
| 4 | 4 | import com.alibaba.cloud.ai.dashscope.image.DashScopeImageModel; |
| 5 | 5 | import com.alibaba.cloud.ai.dashscope.image.DashScopeImageOptions; |
| 6 | -import com.alibaba.dashscope.aigc.imagesynthesis.ImageSynthesis; | |
| 7 | 6 | import org.junit.jupiter.api.Disabled; |
| 8 | 7 | import org.junit.jupiter.api.Test; |
| 9 | 8 | import org.springframework.ai.image.ImageOptions; |
| ... | ... | @@ -25,7 +24,7 @@ public class TongYiImagesModelTest { |
| 25 | 24 | public void imageCallTest() { |
| 26 | 25 | // 准备参数 |
| 27 | 26 | ImageOptions options = DashScopeImageOptions.builder() |
| 28 | - .withModel(ImageSynthesis.Models.WANX_V1) | |
| 27 | + .withModel("wanx-v1") | |
| 29 | 28 | .withHeight(256).withWidth(256) |
| 30 | 29 | .build(); |
| 31 | 30 | ImagePrompt prompt = new ImagePrompt("中国长城!", options); | ... | ... |