Commit 18aeb072a6187b09b9451f6a93d0bb342f38ebd3
1 parent
db7315b8
【优化】buildImageOptions 支持千帆
Showing
1 changed file
with
6 additions
and
0 deletions
yudao-module-ai/yudao-module-ai-biz/src/main/java/cn/iocoder/yudao/module/ai/service/image/AiImageServiceImpl.java
| @@ -31,6 +31,7 @@ import org.springframework.ai.image.ImageOptions; | @@ -31,6 +31,7 @@ import org.springframework.ai.image.ImageOptions; | ||
| 31 | import org.springframework.ai.image.ImagePrompt; | 31 | import org.springframework.ai.image.ImagePrompt; |
| 32 | import org.springframework.ai.image.ImageResponse; | 32 | import org.springframework.ai.image.ImageResponse; |
| 33 | import org.springframework.ai.openai.OpenAiImageOptions; | 33 | import org.springframework.ai.openai.OpenAiImageOptions; |
| 34 | +import org.springframework.ai.qianfan.QianFanImageOptions; | ||
| 34 | import org.springframework.ai.stabilityai.api.StabilityAiImageOptions; | 35 | import org.springframework.ai.stabilityai.api.StabilityAiImageOptions; |
| 35 | import org.springframework.scheduling.annotation.Async; | 36 | import org.springframework.scheduling.annotation.Async; |
| 36 | import org.springframework.stereotype.Service; | 37 | import org.springframework.stereotype.Service; |
| @@ -142,6 +143,11 @@ public class AiImageServiceImpl implements AiImageService { | @@ -142,6 +143,11 @@ public class AiImageServiceImpl implements AiImageService { | ||
| 142 | .withModel(draw.getModel()).withN(1) | 143 | .withModel(draw.getModel()).withN(1) |
| 143 | .withHeight(draw.getHeight()).withWidth(draw.getWidth()) | 144 | .withHeight(draw.getHeight()).withWidth(draw.getWidth()) |
| 144 | .build(); | 145 | .build(); |
| 146 | + } else if (ObjUtil.equal(draw.getPlatform(), AiPlatformEnum.YI_YAN.getPlatform())) { | ||
| 147 | + return QianFanImageOptions.builder() | ||
| 148 | + .withModel(draw.getModel()).withN(1) | ||
| 149 | + .withHeight(draw.getHeight()).withWidth(draw.getWidth()) | ||
| 150 | + .build(); | ||
| 145 | } | 151 | } |
| 146 | throw new IllegalArgumentException("不支持的 AI 平台:" + draw.getPlatform()); | 152 | throw new IllegalArgumentException("不支持的 AI 平台:" + draw.getPlatform()); |
| 147 | } | 153 | } |