BUGFIX:无法获取wx pose transfer的结果

This commit is contained in:
2025-06-16 15:07:22 +08:00
parent 9ad6acf28c
commit 4dd3ddb1d0
2 changed files with 18 additions and 5 deletions

View File

@@ -31,6 +31,8 @@ public class PoseTransformation extends BaseEntity {
private byte isDeleted;
private String modelName;
public PoseTransformation() {
}

View File

@@ -36,7 +36,6 @@ import io.minio.errors.MinioException;
import io.netty.util.internal.StringUtil;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.http.HttpHost;
import org.apache.http.client.config.RequestConfig;
import org.apache.http.client.methods.HttpGet;
@@ -691,7 +690,7 @@ public class GenerateServiceImpl extends ServiceImpl<GenerateMapper, Generate> i
GenerateResultVO generateResultVO = new Gson().fromJson(redisUtil.getFromString(key), GenerateResultVO.class);
if (flag) {
type = resolveModelType(taskId);
type = resolveModelType(taskId, null);
flag = false;
}
// 暂定万象每次生成1个
@@ -1123,16 +1122,17 @@ public class GenerateServiceImpl extends ServiceImpl<GenerateMapper, Generate> i
// 3、生成唯一id 使用uuid,由于uuid重复的几率很小故取消对uuid重复性的校验
String taskId;
Boolean flag = false;
PoseTransformation poseTransformation = new PoseTransformation();
if (poseTransformDTO.getModelName().equals("wx")){
taskId = animateAnyone(poseTransformDTO, accountId);
if (!StringUtil.isNullOrEmpty(taskId)) flag = true;
poseTransformation.setModelName("wx");
}else {
String uuid = UUID.randomUUID().toString();
taskId = uuid + "-" + accountId;
flag = pythonService.poseTransformation(productImage, poseId, taskId);
}
PoseTransformation poseTransformation = new PoseTransformation();
poseTransformation.setProjectId(projectId);
poseTransformation.setAccountId(accountId);
poseTransformation.setUniqueId(taskId);
@@ -1189,7 +1189,7 @@ public class GenerateServiceImpl extends ServiceImpl<GenerateMapper, Generate> i
}
public PoseTransformationVO getPoseTransformationResult(String taskId){
String type = resolveModelType(taskId);
String type = resolveModelType(taskId, CreditsEventsEnum.POSE_TRANSFORMATION.getValue());
if (type.equals("wx")){
return getAnimateResult(taskId);
}
@@ -2003,8 +2003,19 @@ public class GenerateServiceImpl extends ServiceImpl<GenerateMapper, Generate> i
return description;
}
private String resolveModelType(String taskId){
private String resolveModelType(String taskId, String func){
// 判断当前task来自哪个模型
if (!StringUtil.isNullOrEmpty(func)
&& func.equals(CreditsEventsEnum.POSE_TRANSFORMATION.getValue())){
List<PoseTransformation> poseTransformations = poseTransformationMapper.selectList(
new QueryWrapper<PoseTransformation>().eq("unique_id", taskId));
if (!poseTransformations.isEmpty() && poseTransformations.get(0).getModelName().equals("wx")){
return "wx";
}else {
return "local";
}
}
Generate generate = selectByUniqueId(taskId);
if (!StringUtil.isNullOrEmpty(generate.getModelName()) &&
(generate.getModelName().equals("wx")