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
| @@ -49,7 +49,7 @@ | @@ -49,7 +49,7 @@ | ||
| 49 | <!-- 通义千问 --> | 49 | <!-- 通义千问 --> |
| 50 | <groupId>com.alibaba.cloud.ai</groupId> | 50 | <groupId>com.alibaba.cloud.ai</groupId> |
| 51 | <artifactId>spring-ai-alibaba-starter</artifactId> | 51 | <artifactId>spring-ai-alibaba-starter</artifactId> |
| 52 | - <version>1.0.0-M5.1</version> | 52 | + <version>${spring-ai.version}.1</version> |
| 53 | </dependency> | 53 | </dependency> |
| 54 | <dependency> | 54 | <dependency> |
| 55 | <!-- 文心一言 --> | 55 | <!-- 文心一言 --> |
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,8 +22,7 @@ public class AiUtils { | ||
| 22 | // noinspection EnhancedSwitchMigration | 22 | // noinspection EnhancedSwitchMigration |
| 23 | switch (platform) { | 23 | switch (platform) { |
| 24 | case TONG_YI: | 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 | case YI_YAN: | 26 | case YI_YAN: |
| 28 | return QianFanChatOptions.builder().model(model).temperature(temperature).maxTokens(maxTokens).build(); | 27 | return QianFanChatOptions.builder().model(model).temperature(temperature).maxTokens(maxTokens).build(); |
| 29 | case ZHI_PU: | 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,6 +28,7 @@ public class TongYiChatModelTests { | ||
| 28 | .withModel("qwen1.5-72b-chat") // 模型 | 28 | .withModel("qwen1.5-72b-chat") // 模型 |
| 29 | // .withModel("deepseek-r1") // 模型(deepseek-r1) | 29 | // .withModel("deepseek-r1") // 模型(deepseek-r1) |
| 30 | // .withModel("deepseek-v3") // 模型(deepseek-v3) | 30 | // .withModel("deepseek-v3") // 模型(deepseek-v3) |
| 31 | +// .withModel("deepseek-r1-distill-qwen-1.5b") // 模型(deepseek-r1-distill-qwen-1.5b) | ||
| 31 | .build()); | 32 | .build()); |
| 32 | 33 | ||
| 33 | @Test | 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,7 +3,6 @@ package cn.iocoder.yudao.framework.ai.image; | ||
| 3 | import com.alibaba.cloud.ai.dashscope.api.DashScopeImageApi; | 3 | import com.alibaba.cloud.ai.dashscope.api.DashScopeImageApi; |
| 4 | import com.alibaba.cloud.ai.dashscope.image.DashScopeImageModel; | 4 | import com.alibaba.cloud.ai.dashscope.image.DashScopeImageModel; |
| 5 | import com.alibaba.cloud.ai.dashscope.image.DashScopeImageOptions; | 5 | import com.alibaba.cloud.ai.dashscope.image.DashScopeImageOptions; |
| 6 | -import com.alibaba.dashscope.aigc.imagesynthesis.ImageSynthesis; | ||
| 7 | import org.junit.jupiter.api.Disabled; | 6 | import org.junit.jupiter.api.Disabled; |
| 8 | import org.junit.jupiter.api.Test; | 7 | import org.junit.jupiter.api.Test; |
| 9 | import org.springframework.ai.image.ImageOptions; | 8 | import org.springframework.ai.image.ImageOptions; |
| @@ -25,7 +24,7 @@ public class TongYiImagesModelTest { | @@ -25,7 +24,7 @@ public class TongYiImagesModelTest { | ||
| 25 | public void imageCallTest() { | 24 | public void imageCallTest() { |
| 26 | // 准备参数 | 25 | // 准备参数 |
| 27 | ImageOptions options = DashScopeImageOptions.builder() | 26 | ImageOptions options = DashScopeImageOptions.builder() |
| 28 | - .withModel(ImageSynthesis.Models.WANX_V1) | 27 | + .withModel("wanx-v1") |
| 29 | .withHeight(256).withWidth(256) | 28 | .withHeight(256).withWidth(256) |
| 30 | .build(); | 29 | .build(); |
| 31 | ImagePrompt prompt = new ImagePrompt("中国长城!", options); | 30 | ImagePrompt prompt = new ImagePrompt("中国长城!", options); |