From 19bd2bedd6d23d41c0e7d49613e06b8338724aa6 Mon Sep 17 00:00:00 2001 From: "mose-x.zm" Date: Wed, 11 Mar 2026 18:19:13 +0800 Subject: [PATCH 1/2] support wan 2.7 --- samples/VideoSynthesisUsage.java | 87 +++++- .../imagegeneration/ImageGenerationParam.java | 14 +- .../aigc/videosynthesis/VideoSynthesis.java | 12 + .../videosynthesis/VideoSynthesisParam.java | 270 ++++++++++++++++-- .../alibaba/dashscope/utils/ApiKeywords.java | 8 + 5 files changed, 354 insertions(+), 37 deletions(-) diff --git a/samples/VideoSynthesisUsage.java b/samples/VideoSynthesisUsage.java index d6cb21e..3d33369 100644 --- a/samples/VideoSynthesisUsage.java +++ b/samples/VideoSynthesisUsage.java @@ -18,8 +18,8 @@ public class VideoSynthesisUsage { */ public static void basicCall() throws ApiException, NoApiKeyException, InputRequiredException { VideoSynthesis vs = new VideoSynthesis(); - List referenceVideoUrls = new ArrayList<>(); - referenceVideoUrls.add("https://cdn.wanx.aliyuncs.com/wanx/1014827220770308/upload-video-cut/cda0f4dc063ec258184263691558af36.mp4"); + List referenceUrls = new ArrayList<>(); + referenceUrls.add("https://cdn.wanx.aliyuncs.com/wanx/1014827220770308/upload-video-cut/cda0f4dc063ec258184263691558af36.mp4"); List referenceVideoDescription = new ArrayList<>(); referenceVideoDescription.add("这段视频展示一位年轻女性()身着灰色长袖上衣与裤子,乌黑长发垂落,面容清秀。她先低头后抬头,目光侧移,继而转身背对再面向镜头,动作流畅自然。背景为素净灰色墙面,环境简约无装饰。镜头由面部特写缓缓拉远至全身,光影柔和,突出人物形态与情绪。"); @@ -27,7 +27,7 @@ public static void basicCall() throws ApiException, NoApiKeyException, InputRequ VideoSynthesisParam.builder() .model("wan2.6-r2v") .prompt(" character1 站在海边,吹着海风,夕阳西下,阳光洒在她的脸上") - .referenceVideoUrls(referenceVideoUrls) + .referenceUrls(referenceUrls) .referenceVideoDescription(referenceVideoDescription) .shotType(VideoSynthesis.ShotType.MULTI) .watermark(Boolean.TRUE) @@ -39,6 +39,83 @@ public static void basicCall() throws ApiException, NoApiKeyException, InputRequ VideoSynthesisResult result = vs.call(param); System.out.println(result); } + /** + * Create a video compositing task and wait for the task to complete. + */ + public static void basicCallI2V27() throws ApiException, NoApiKeyException, InputRequiredException { + VideoSynthesis vs = new VideoSynthesis(); + final String prompt = "一幅都市奇幻艺术的场景。一个充满动感的涂鸦艺术角色。一个由喷漆所画成的少年,正从一面混凝土墙上活过来。他一边用极快的语速演唱一首英文rap,一边摆着一个经典的、充满活力的说唱歌手姿势。场景设定在夜晚一个充满都市感的铁路桥下。灯光来自一盏孤零零的街灯,营造出电影般的氛围,充满高能量和惊人的细节。视频的音频部分完全由他的rap构成,没有其他对话或杂音。"; + final String negativePrompt = "ugly, bad anatomy"; + List media = new ArrayList(){{ + add(VideoSynthesisParam.Media.builder() + .url("https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20250925/wpimhv/rap.png") + .type(VideoSynthesis.MediaType.FIRST_CLIP) + .build()); + add(VideoSynthesisParam.Media.builder() + .url("https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20250925/ozwpvi/rap.mp3") + .type(VideoSynthesis.MediaType.DRIVING_AUDIO) + .build()); + }}; + VideoSynthesisParam param = + VideoSynthesisParam.builder() + .model("wan2.7-i2v") + .prompt(prompt) + .media(media) + .watermark(Boolean.TRUE) + .duration(10) + .negativePrompt(negativePrompt) + .size("1280*720") + .build(); + VideoSynthesisResult result = vs.call(param); + System.out.println(result); + } + /** + * Create a video compositing task and wait for the task to complete. + */ + public static void basicCallR2V27() throws ApiException, NoApiKeyException, InputRequiredException { + VideoSynthesis vs = new VideoSynthesis(); + final String prompt = "一幅都市奇幻艺术的场景。一个充满动感的涂鸦艺术角色。一个由喷漆所画成的少年,正从一面混凝土墙上活过来。他一边用极快的语速演唱一首英文rap,一边摆着一个经典的、充满活力的说唱歌手姿势。场景设定在夜晚一个充满都市感的铁路桥下。灯光来自一盏孤零零的街灯,营造出电影般的氛围,充满高能量和惊人的细节。视频的音频部分完全由他的rap构成,没有其他对话或杂音。"; + final String negativePrompt = "ugly, bad anatomy"; + List media = new ArrayList(){{ + add(VideoSynthesisParam.Media.builder() + .url("https://test-data-center.oss-accelerate.aliyuncs.com/wanx/image/res240_269.jpg") + .type(VideoSynthesis.MediaType.REFERENCE_IMAGE) + .build()); + add(VideoSynthesisParam.Media.builder() + .url("https://test-data-center.oss-accelerate.aliyuncs.com/wanx/image/man_5K_7_7K_18_4M.JPG") + .referenceVoice("https://test-data-center.oss-accelerate.aliyuncs.com/wanx/audio/2s.wav") + .type(VideoSynthesis.MediaType.REFERENCE_IMAGE) + .build()); + add(VideoSynthesisParam.Media.builder() + .url("https://test-data-center.oss-accelerate.aliyuncs.com/wanx/video/resources/cast/100M.mov") + .referenceVoice("https://test-data-center.oss-accelerate.aliyuncs.com/wanx/audio/mp3_1s.mp3") + .type(VideoSynthesis.MediaType.REFERENCE_VIDEO) + .build()); + add(VideoSynthesisParam.Media.builder() + .url("https://test-data-center.oss-accelerate.aliyuncs.com/wanx/video/resources/cast/29_99s.mp4") + .referenceDescription("这是一个身穿蓝衣的男子,他有着浓密的络腮胡") + .type(VideoSynthesis.MediaType.REFERENCE_VIDEO) + .build()); + add(VideoSynthesisParam.Media.builder() + .url("https://test-data-center.oss-accelerate.aliyuncs.com/wanx/video/resources/cast/cat_127.mp4") + .referenceVoice("https://test-data-center.oss-accelerate.aliyuncs.com/wanx/audio/wav_10s.wav") + .referenceDescription("这是一只毛绒小猫,它正在对着镜头微笑") + .type(VideoSynthesis.MediaType.REFERENCE_VIDEO) + .build()); + }}; + VideoSynthesisParam param = + VideoSynthesisParam.builder() + .model("wan2.7-r2v") + .prompt(prompt) + .media(media) + .watermark(Boolean.TRUE) + .duration(10) + .negativePrompt(negativePrompt) + .size("1280*720") + .build(); + VideoSynthesisResult result = vs.call(param); + System.out.println(result); + } /** * List all tasks. @@ -63,7 +140,9 @@ public static void fetchTask(String taskId) throws ApiException, NoApiKeyExcepti public static void main(String[] args) { try { - basicCall(); +// basicCall(); +// basicCallI2V27(); + basicCallR2V27(); // listTask(); // fetchTask("b451725d-c48f-4f08-9d26-xxx-xxx"); } catch (ApiException | NoApiKeyException | InputRequiredException e) { diff --git a/src/main/java/com/alibaba/dashscope/aigc/imagegeneration/ImageGenerationParam.java b/src/main/java/com/alibaba/dashscope/aigc/imagegeneration/ImageGenerationParam.java index b727c85..4bf26f3 100644 --- a/src/main/java/com/alibaba/dashscope/aigc/imagegeneration/ImageGenerationParam.java +++ b/src/main/java/com/alibaba/dashscope/aigc/imagegeneration/ImageGenerationParam.java @@ -7,12 +7,16 @@ import com.alibaba.dashscope.utils.JsonUtils; import com.alibaba.dashscope.utils.ParamUtils; import com.google.gson.JsonObject; +import lombok.Builder; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.Singular; +import lombok.experimental.SuperBuilder; + import java.nio.ByteBuffer; import java.util.HashMap; import java.util.List; import java.util.Map; -import lombok.*; -import lombok.experimental.SuperBuilder; @EqualsAndHashCode(callSuper = true) @Data @@ -73,6 +77,8 @@ public class ImageGenerationParam extends HalfDuplexServiceParam { private Integer maxImages; + private Boolean enableSequential; + @Override public JsonObject getHttpBody() { JsonObject requestObject = new JsonObject(); @@ -149,6 +155,10 @@ public Map getParameters() { params.put("max_images", maxImages); } + if (enableSequential != null) { + params.put("enable_sequential", enableSequential); + } + params.putAll(parameters); return params; } diff --git a/src/main/java/com/alibaba/dashscope/aigc/videosynthesis/VideoSynthesis.java b/src/main/java/com/alibaba/dashscope/aigc/videosynthesis/VideoSynthesis.java index 5749a63..570d2e1 100644 --- a/src/main/java/com/alibaba/dashscope/aigc/videosynthesis/VideoSynthesis.java +++ b/src/main/java/com/alibaba/dashscope/aigc/videosynthesis/VideoSynthesis.java @@ -57,6 +57,18 @@ public static class Resolution { public static class ShotType { public static final String MULTI = "multi"; public static final String SINGLE = "single"; + public static final String AUTO = "auto"; + } + + public static class MediaType { + public static final String FIRST_FRAME = "first_frame"; + public static final String LAST_FRAME = "last_frame"; + public static final String REFERENCE_IMAGE = "reference_image"; + public static final String REFERENCE_VIDEO = "reference_video"; + public static final String REFERENCE_VOICE = "reference_voice"; + public static final String VIDEO = "video"; + public static final String FIRST_CLIP = "first_clip"; + public static final String DRIVING_AUDIO = "driving_audio"; } /** diff --git a/src/main/java/com/alibaba/dashscope/aigc/videosynthesis/VideoSynthesisParam.java b/src/main/java/com/alibaba/dashscope/aigc/videosynthesis/VideoSynthesisParam.java index 146bc10..42429da 100644 --- a/src/main/java/com/alibaba/dashscope/aigc/videosynthesis/VideoSynthesisParam.java +++ b/src/main/java/com/alibaba/dashscope/aigc/videosynthesis/VideoSynthesisParam.java @@ -1,8 +1,6 @@ // Copyright (c) Alibaba, Inc. and its affiliates. package com.alibaba.dashscope.aigc.videosynthesis; -import static com.alibaba.dashscope.utils.ApiKeywords.*; - import com.alibaba.dashscope.base.HalfDuplexServiceParam; import com.alibaba.dashscope.exception.InputRequiredException; import com.alibaba.dashscope.exception.NoApiKeyException; @@ -11,22 +9,36 @@ import com.alibaba.dashscope.utils.JsonUtils; import com.alibaba.dashscope.utils.PreprocessInputImage; import com.google.gson.JsonObject; -import java.nio.ByteBuffer; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; import lombok.Builder; import lombok.Data; import lombok.EqualsAndHashCode; import lombok.Singular; import lombok.experimental.SuperBuilder; +import java.nio.ByteBuffer; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.concurrent.*; +import java.util.stream.Collectors; + +import static com.alibaba.dashscope.utils.ApiKeywords.*; + @EqualsAndHashCode(callSuper = true) @Data @SuperBuilder public class VideoSynthesisParam extends HalfDuplexServiceParam { + @Data + @SuperBuilder + public static class Media { + @Builder.Default private String url = null; + @Builder.Default private String type = null; + @Builder.Default private String referenceVoice = null; + @Builder.Default private String referenceDescription = null; + } + @Builder.Default private Map inputChecks = new HashMap<>(); @Builder.Default private String size = null; @@ -58,6 +70,15 @@ public class VideoSynthesisParam extends HalfDuplexServiceParam { /** list of character reference video file urls uploaded by the user */ @Builder.Default private List referenceVideoUrls = null; + /** list of character reference file urls uploaded by the user */ + @Builder.Default private List referenceUrls = null; + + /** list of character reference file url uploaded by the user */ + @Builder.Default private String referenceUrl = null; + + /** list of media file urls uploaded by the user */ + @Builder.Default private List media = null; + /** * For the description information of the picture and sound of the reference video, corresponding * to ref video, it needs to be in the order of the url. If the quantity is different, an error @@ -97,6 +118,8 @@ public class VideoSynthesisParam extends HalfDuplexServiceParam { /** The enable_overlays parameter. */ @Builder.Default private Boolean enableOverlays = null; + @Builder.Default private String ratio = null; + /** The inputs of the model. */ @Override public JsonObject getInput() { @@ -147,6 +170,18 @@ public JsonObject getInput() { jsonObject.add(REFERENCE_VIDEO_DESCRIPTION, JsonUtils.toJsonArray(referenceVideoDescription)); } + if (referenceUrls != null && !referenceUrls.isEmpty()) { + jsonObject.add(REFERENCE_URLS, JsonUtils.toJsonArray(referenceUrls)); + } + + if (referenceUrl != null && !referenceUrl.isEmpty()) { + jsonObject.addProperty(REFERENCE_URL, referenceUrl); + } + + if (media != null && !media.isEmpty()) { + jsonObject.add(MEDIA_URLS, JsonUtils.toJsonArray(media)); + } + if (extraInputs != null && !extraInputs.isEmpty()) { JsonObject extraInputsJsonObject = JsonUtils.parametersToJsonObject(extraInputs); JsonUtils.merge(jsonObject, extraInputsJsonObject); @@ -193,6 +228,9 @@ public Map getParameters() { if (enableOverlays != null) { params.put(ENABLE_OVERLAYS, enableOverlays); } + if (ratio != null) { + params.put(RATIO, ratio); + } params.putAll(super.getParameters()); return params; @@ -223,40 +261,210 @@ public ByteBuffer getBinaryData() { public void validate() throws InputRequiredException {} public void checkAndUpload() throws NoApiKeyException, UploadFileException { - Map inputChecks = new HashMap<>(); - inputChecks.put(IMG_URL, this.imgUrl); - inputChecks.put(AUDIO_URL, this.audioUrl); - inputChecks.put(FIRST_FRAME_URL, this.firstFrameUrl); - inputChecks.put(LAST_FRAME_URL, this.lastFrameUrl); - inputChecks.put(HEAD_FRAME, this.headFrame); - inputChecks.put(TAIL_FRAME, this.tailFrame); - int rvs = 0; + class UploadTaskResult { + final String key; + final String newUrl; + final boolean uploaded; + + UploadTaskResult(String key, String newUrl, boolean uploaded) { + this.key = key; + this.newUrl = newUrl; + this.uploaded = uploaded; + } + } + + List> futures = new ArrayList<>(); + + class TaskItem { + final String keyPrefix; + final String keyItemPrefix; + final String value; + final int index; + + TaskItem(String keyPrefix, String keyItemPrefix, String value, int index) { + this.keyPrefix = keyPrefix; + this.keyItemPrefix = keyItemPrefix; + this.value = value; + this.index = index; + } + + TaskItem(String keyPrefix, String value, int index) { + this.keyPrefix = keyPrefix; + this.keyItemPrefix = ""; + this.value = value; + this.index = index; + } + + TaskItem(String keyPrefix, String value) { + this.keyPrefix = keyPrefix; + this.keyItemPrefix = ""; + this.value = value; + this.index = -1; + } + + String getFullKey() { + return index >= 0 ? keyPrefix + keyItemPrefix + "[" + index + "]" : keyPrefix; + } + } + + List itemsToProcess = new ArrayList<>(); + + if (this.imgUrl != null) itemsToProcess.add(new TaskItem(IMG_URL, this.imgUrl)); + if (this.audioUrl != null) itemsToProcess.add(new TaskItem(AUDIO_URL, this.audioUrl)); + if (this.firstFrameUrl != null) + itemsToProcess.add(new TaskItem(FIRST_FRAME_URL, this.firstFrameUrl)); + if (this.lastFrameUrl != null) + itemsToProcess.add(new TaskItem(LAST_FRAME_URL, this.lastFrameUrl)); + if (this.headFrame != null) itemsToProcess.add(new TaskItem(HEAD_FRAME, this.headFrame)); + if (this.tailFrame != null) itemsToProcess.add(new TaskItem(TAIL_FRAME, this.tailFrame)); + if (this.referenceUrl != null) + itemsToProcess.add(new TaskItem(REFERENCE_URL, this.referenceUrl)); + if (this.referenceVideoUrls != null) { - rvs = this.referenceVideoUrls.size(); - for (int i = 0; i < rvs; i++) { - inputChecks.put(REFERENCE_VIDEO_URLS + "[" + i + "]", this.referenceVideoUrls.get(i)); + for (int i = 0; i < this.referenceVideoUrls.size(); i++) { + String url = this.referenceVideoUrls.get(i); + if (url != null) { + itemsToProcess.add(new TaskItem(REFERENCE_VIDEO_URLS, url, i)); + } } } - boolean isUpload = - PreprocessInputImage.checkAndUploadImage(getModel(), inputChecks, getApiKey()); + if (this.referenceUrls != null) { + for (int i = 0; i < this.referenceUrls.size(); i++) { + String url = this.referenceUrls.get(i); + if (url != null) { + itemsToProcess.add(new TaskItem(REFERENCE_URLS, url, i)); + } + } + } + + if (this.media != null) { + for (int i = 0; i < this.media.size(); i++) { + Media media = this.media.get(i); + if (media != null) { + if (media.getUrl() != null) { + itemsToProcess.add(new TaskItem(MEDIA_URLS, "_URL", media.getUrl(), i)); + } + if (media.getReferenceVoice() != null) { + itemsToProcess.add( + new TaskItem(MEDIA_URLS, "_REFERENCE_VOICE", media.getReferenceVoice(), i)); + } + } + } + } + + if (itemsToProcess.isEmpty()) { + return; + } - if (isUpload) { + ExecutorService executor = Executors.newFixedThreadPool(5); + try { + for (TaskItem item : itemsToProcess) { + CompletableFuture future = + CompletableFuture.supplyAsync( + () -> { + Map singleCheckMap = new HashMap<>(); + String fullKey = item.getFullKey(); + singleCheckMap.put(fullKey, item.value); + + boolean isUploaded; + try { + isUploaded = + PreprocessInputImage.checkAndUploadImage( + getModel(), singleCheckMap, getApiKey()); + } catch (NoApiKeyException | UploadFileException e) { + throw new RuntimeException(e); + } + + return new UploadTaskResult(fullKey, singleCheckMap.get(fullKey), isUploaded); + }, + executor); + futures.add(future); + } + } finally { + executor.shutdown(); + try { + if (!executor.awaitTermination(60, TimeUnit.SECONDS)) { + executor.shutdownNow(); + } + } catch (InterruptedException e) { + executor.shutdownNow(); + Thread.currentThread().interrupt(); + } + } + + List results = new ArrayList<>(); + boolean globalIsUpload = false; + + try { + for (CompletableFuture future : futures) { + UploadTaskResult result = future.get(); + results.add(result); + if (result.uploaded) { + globalIsUpload = true; + } + } + } catch (InterruptedException e) { + Thread.currentThread().interrupt(); + throw new RuntimeException("Upload process interrupted", e); + } catch (ExecutionException e) { + Throwable cause = e.getCause(); + if (cause instanceof NoApiKeyException) { + throw (NoApiKeyException) cause; + } else if (cause instanceof UploadFileException) { + throw (UploadFileException) cause; + } else { + throw new RuntimeException("Upload failed", cause); + } + } + + if (globalIsUpload) { this.putHeader("X-DashScope-OssResourceResolve", "enable"); - this.imgUrl = inputChecks.get(IMG_URL); - this.audioUrl = inputChecks.get(AUDIO_URL); - this.firstFrameUrl = inputChecks.get(FIRST_FRAME_URL); - this.lastFrameUrl = inputChecks.get(LAST_FRAME_URL); - this.headFrame = inputChecks.get(HEAD_FRAME); - this.tailFrame = inputChecks.get(TAIL_FRAME); - if (rvs > 0) { - List newVideos = new ArrayList<>(); - for (int i = 0; i < rvs; i++) { - newVideos.add(inputChecks.get(REFERENCE_VIDEO_URLS + "[" + i + "]")); + Map resultMap = + results.stream().collect(Collectors.toMap(r -> r.key, r -> r.newUrl)); + + if (resultMap.containsKey(IMG_URL)) this.imgUrl = resultMap.get(IMG_URL); + if (resultMap.containsKey(AUDIO_URL)) this.audioUrl = resultMap.get(AUDIO_URL); + if (resultMap.containsKey(FIRST_FRAME_URL)) + this.firstFrameUrl = resultMap.get(FIRST_FRAME_URL); + if (resultMap.containsKey(LAST_FRAME_URL)) this.lastFrameUrl = resultMap.get(LAST_FRAME_URL); + if (resultMap.containsKey(HEAD_FRAME)) this.headFrame = resultMap.get(HEAD_FRAME); + if (resultMap.containsKey(TAIL_FRAME)) this.tailFrame = resultMap.get(TAIL_FRAME); + if (resultMap.containsKey(REFERENCE_URL)) this.referenceUrl = resultMap.get(REFERENCE_URL); + + if (this.referenceVideoUrls != null && !this.referenceVideoUrls.isEmpty()) { + List newVideos = new ArrayList<>(this.referenceVideoUrls.size()); + for (int i = 0; i < this.referenceVideoUrls.size(); i++) { + String key = REFERENCE_VIDEO_URLS + "[" + i + "]"; + newVideos.add(resultMap.getOrDefault(key, this.referenceVideoUrls.get(i))); } this.referenceVideoUrls = newVideos; } + + if (this.referenceUrls != null && !this.referenceUrls.isEmpty()) { + List newRefs = new ArrayList<>(this.referenceUrls.size()); + for (int i = 0; i < this.referenceUrls.size(); i++) { + String key = REFERENCE_URLS + "[" + i + "]"; + newRefs.add(resultMap.getOrDefault(key, this.referenceUrls.get(i))); + } + this.referenceUrls = newRefs; + } + + if (this.media != null && !this.media.isEmpty()) { + for (int i = 0; i < this.media.size(); i++) { + Media mediaItem = this.media.get(i); + + String urlKey = MEDIA_URLS + "_URL[" + i + "]"; + String voiceKey = MEDIA_URLS + "_REFERENCE_VOICE[" + i + "]"; + if (resultMap.containsKey(urlKey)) { + mediaItem.setUrl(resultMap.get(urlKey)); + } + if (resultMap.containsKey(voiceKey)) { + mediaItem.setReferenceVoice(resultMap.get(voiceKey)); + } + } + } } } } diff --git a/src/main/java/com/alibaba/dashscope/utils/ApiKeywords.java b/src/main/java/com/alibaba/dashscope/utils/ApiKeywords.java index 50eaba7..9d42153 100644 --- a/src/main/java/com/alibaba/dashscope/utils/ApiKeywords.java +++ b/src/main/java/com/alibaba/dashscope/utils/ApiKeywords.java @@ -194,6 +194,14 @@ public class ApiKeywords { public static final String REFERENCE_VIDEO_URLS = "reference_video_urls"; + public static final String REFERENCE_URLS = "reference_urls"; + + public static final String MEDIA_URLS = "media"; + + public static final String REFERENCE_URL = "reference_url"; + + public static final String RATIO = "ratio"; + public static final String REFERENCE_VIDEO_DESCRIPTION = "reference_video_description"; public static final String SHOT_TYPE = "shot_type"; From d9d650e1c0fb512af8d65acef8390c2c566d419d Mon Sep 17 00:00:00 2001 From: "mose-x.zm" Date: Thu, 12 Mar 2026 09:41:48 +0800 Subject: [PATCH 2/2] lint commit --- .../imagegeneration/ImageGenerationParam.java | 9 ++++----- .../aigc/videosynthesis/VideoSynthesisParam.java | 15 +++++++-------- 2 files changed, 11 insertions(+), 13 deletions(-) diff --git a/src/main/java/com/alibaba/dashscope/aigc/imagegeneration/ImageGenerationParam.java b/src/main/java/com/alibaba/dashscope/aigc/imagegeneration/ImageGenerationParam.java index 4bf26f3..adc5239 100644 --- a/src/main/java/com/alibaba/dashscope/aigc/imagegeneration/ImageGenerationParam.java +++ b/src/main/java/com/alibaba/dashscope/aigc/imagegeneration/ImageGenerationParam.java @@ -7,17 +7,16 @@ import com.alibaba.dashscope.utils.JsonUtils; import com.alibaba.dashscope.utils.ParamUtils; import com.google.gson.JsonObject; +import java.nio.ByteBuffer; +import java.util.HashMap; +import java.util.List; +import java.util.Map; import lombok.Builder; import lombok.Data; import lombok.EqualsAndHashCode; import lombok.Singular; import lombok.experimental.SuperBuilder; -import java.nio.ByteBuffer; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - @EqualsAndHashCode(callSuper = true) @Data @SuperBuilder diff --git a/src/main/java/com/alibaba/dashscope/aigc/videosynthesis/VideoSynthesisParam.java b/src/main/java/com/alibaba/dashscope/aigc/videosynthesis/VideoSynthesisParam.java index 42429da..9f6412a 100644 --- a/src/main/java/com/alibaba/dashscope/aigc/videosynthesis/VideoSynthesisParam.java +++ b/src/main/java/com/alibaba/dashscope/aigc/videosynthesis/VideoSynthesisParam.java @@ -1,6 +1,8 @@ // Copyright (c) Alibaba, Inc. and its affiliates. package com.alibaba.dashscope.aigc.videosynthesis; +import static com.alibaba.dashscope.utils.ApiKeywords.*; + import com.alibaba.dashscope.base.HalfDuplexServiceParam; import com.alibaba.dashscope.exception.InputRequiredException; import com.alibaba.dashscope.exception.NoApiKeyException; @@ -9,12 +11,6 @@ import com.alibaba.dashscope.utils.JsonUtils; import com.alibaba.dashscope.utils.PreprocessInputImage; import com.google.gson.JsonObject; -import lombok.Builder; -import lombok.Data; -import lombok.EqualsAndHashCode; -import lombok.Singular; -import lombok.experimental.SuperBuilder; - import java.nio.ByteBuffer; import java.util.ArrayList; import java.util.HashMap; @@ -22,8 +18,11 @@ import java.util.Map; import java.util.concurrent.*; import java.util.stream.Collectors; - -import static com.alibaba.dashscope.utils.ApiKeywords.*; +import lombok.Builder; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.Singular; +import lombok.experimental.SuperBuilder; @EqualsAndHashCode(callSuper = true) @Data