【增加】ai image对接通义
This commit is contained in:
parent
28018b1f7f
commit
d6b3b5e9bd
|
@ -137,9 +137,9 @@ public class AiImageServiceImpl implements AiImageService {
|
|||
.withStylePreset(String.valueOf(draw.getOptions().get("stylePreset")))
|
||||
.withClipGuidancePreset(String.valueOf(draw.getOptions().get("clipGuidancePreset")))
|
||||
.build();
|
||||
} else if (ObjUtil.equal(draw.getPlatform(), AiPlatformEnum.TONG_YI_WAN_XIANG.getPlatform())) {
|
||||
} else if (ObjUtil.equal(draw.getPlatform(), AiPlatformEnum.TONG_YI.getPlatform())) {
|
||||
return TongYiImagesOptions.builder()
|
||||
.withModel(draw.getModel()).withN(Integer.valueOf(draw.getOptions().get("n")))
|
||||
.withModel(draw.getModel()).withN(1)
|
||||
.withHeight(draw.getHeight()).withWidth(draw.getWidth())
|
||||
.build();
|
||||
}
|
||||
|
|
|
@ -106,7 +106,7 @@ public class AiApiKeyServiceImpl implements AiApiKeyService {
|
|||
|
||||
@Override
|
||||
public ImageModel getImageModel(AiPlatformEnum platform) {
|
||||
AiApiKeyDO apiKey = apiKeyMapper.selectFirstByPlatformAndStatus(platform.getName(), CommonStatusEnum.ENABLE.getStatus());
|
||||
AiApiKeyDO apiKey = apiKeyMapper.selectFirstByPlatformAndStatus(platform.getPlatform(), CommonStatusEnum.ENABLE.getStatus());
|
||||
if (apiKey == null) {
|
||||
throw exception(API_KEY_IMAGE_NODE_FOUND, platform.getName());
|
||||
}
|
||||
|
|
|
@ -28,7 +28,6 @@ public enum AiPlatformEnum {
|
|||
STABLE_DIFFUSION("StableDiffusion", "StableDiffusion"), // Stability AI
|
||||
MIDJOURNEY("Midjourney", "Midjourney"), // Midjourney
|
||||
SUNO("Suno", "Suno"), // Suno AI
|
||||
TONG_YI_WAN_XIANG("TongYiWanXiang", "通义万相"), // Suno AI
|
||||
|
||||
;
|
||||
|
||||
|
|
|
@ -17,6 +17,7 @@ import com.alibaba.cloud.ai.tongyi.TongYiAutoConfiguration;
|
|||
import com.alibaba.cloud.ai.tongyi.TongYiConnectionProperties;
|
||||
import com.alibaba.cloud.ai.tongyi.chat.TongYiChatModel;
|
||||
import com.alibaba.cloud.ai.tongyi.chat.TongYiChatProperties;
|
||||
import com.alibaba.cloud.ai.tongyi.image.TongYiImagesModel;
|
||||
import com.alibaba.dashscope.aigc.generation.Generation;
|
||||
import org.springframework.ai.autoconfigure.ollama.OllamaAutoConfiguration;
|
||||
import org.springframework.ai.autoconfigure.openai.OpenAiAutoConfiguration;
|
||||
|
@ -125,6 +126,8 @@ public class AiModelFactoryImpl implements AiModelFactory {
|
|||
return buildOpenAiImageModel(apiKey, url);
|
||||
case STABLE_DIFFUSION:
|
||||
return buildStabilityAiImageModel(apiKey, url);
|
||||
case TONG_YI:
|
||||
return SpringUtil.getBean(TongYiImagesModel.class);
|
||||
default:
|
||||
throw new IllegalArgumentException(StrUtil.format("未知平台({})", platform));
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue