Merge branch 'dev/dev_xp' into dev/3.1_release_merge
# Conflicts: # src/main/java/com/ai/da/python/PythonService.java # src/main/java/com/ai/da/service/impl/GenerateServiceImpl.java
This commit is contained in:
@@ -32,7 +32,8 @@ public class CommonConstant {
|
||||
|
||||
public static final String GENERATE_LOGO_SINGLE_CANCEL = "/api/generate_single_logo_cancel/";
|
||||
|
||||
public static final String POSE_TRANSFORMATION_CANCEL = "/api/pose_transform_cancel/";
|
||||
// public static final String POSE_TRANSFORMATION_CANCEL = "/api/pose_transform_cancel/";
|
||||
public static final String POSE_TRANSFORMATION_CANCEL = "/api/comfyui_i_2_video_cancel/";
|
||||
|
||||
public static final String PYTHON_PORT_9996 = "9996";
|
||||
|
||||
|
||||
@@ -68,4 +68,7 @@ public enum CollectionLevel2TypeEnum {
|
||||
public static List<String> printType() {
|
||||
return Arrays.asList(LOGO.getRealName(), SLOGAN.getRealName(), Pattern.getRealName());
|
||||
}
|
||||
public static CollectionLevel2TypeEnum ofWithLoweCase(String realName) {
|
||||
return Stream.of(CollectionLevel2TypeEnum.values()).filter(v -> v.getRealName().toLowerCase().equals(realName)).findFirst().orElse(null);
|
||||
}
|
||||
}
|
||||
|
||||
29
src/main/java/com/ai/da/common/enums/MotionModeEnum.java
Normal file
29
src/main/java/com/ai/da/common/enums/MotionModeEnum.java
Normal file
@@ -0,0 +1,29 @@
|
||||
package com.ai.da.common.enums;
|
||||
|
||||
|
||||
import lombok.Getter;
|
||||
|
||||
import java.util.stream.Stream;
|
||||
|
||||
@Getter
|
||||
public enum MotionModeEnum {
|
||||
POSE_TO_VIDEO(1, "/api/comfyui_image_pose_2_video"),
|
||||
|
||||
PROMPT_TO_VIDEO(2, "/api/comfyui_image_2_video"),
|
||||
|
||||
FIRST_LAST_FRAME_TO_VIDEO(3, "/api/comfyui_flf_2_video")
|
||||
;
|
||||
|
||||
private int code;
|
||||
|
||||
private String url;
|
||||
|
||||
MotionModeEnum(int code, String url) {
|
||||
this.code = code;
|
||||
this.url = url;
|
||||
}
|
||||
|
||||
public static MotionModeEnum of(int code) {
|
||||
return Stream.of(MotionModeEnum.values()).filter(v -> v.getCode()== code).findFirst().orElse(null);
|
||||
}
|
||||
}
|
||||
@@ -64,6 +64,7 @@ public enum PoseEnum {
|
||||
Map<String, String> map = new HashMap<>();
|
||||
map.put("id", String.valueOf(id));
|
||||
map.put("gif", gifPath);
|
||||
map.put("video", videoPath);
|
||||
map.put("firstFrame", firstFramePath);
|
||||
return map;
|
||||
}
|
||||
|
||||
@@ -908,6 +908,47 @@ public class MinioUtil {
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* 将A桶中的对象复制到B桶中
|
||||
* @return
|
||||
*/
|
||||
public void copyObject(String sourceBucket, String sourceObject, String targetBucket, String targetObject) {
|
||||
// 检查目标桶是否存在
|
||||
boolean found;
|
||||
try {
|
||||
found = minioClient.bucketExists(BucketExistsArgs.builder()
|
||||
.bucket(targetBucket)
|
||||
.build());
|
||||
} catch (Exception e) {
|
||||
log.error("目标桶{},不存在", targetBucket);
|
||||
throw new BusinessException("Copy object failed");
|
||||
}
|
||||
|
||||
if (found) {
|
||||
// 复制对象
|
||||
try {
|
||||
minioClient.copyObject(
|
||||
CopyObjectArgs.builder()
|
||||
.bucket(targetBucket)
|
||||
.object(targetObject)
|
||||
.source(
|
||||
CopySource.builder()
|
||||
.bucket(sourceBucket)
|
||||
.object(sourceObject)
|
||||
.build()
|
||||
)
|
||||
.build()
|
||||
);
|
||||
} catch (Exception e) {
|
||||
log.error("对象复制失败");
|
||||
throw new BusinessException("Copy object failed");
|
||||
}
|
||||
log.info("对象复制成功");
|
||||
} else {
|
||||
log.error("目标桶{},不存在", targetBucket);
|
||||
throw new BusinessException("Copy object failed");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user