TASK:batch toProductImage;chatStream;
This commit is contained in:
@@ -2039,9 +2039,9 @@ public class DesignServiceImpl extends ServiceImpl<DesignMapper, Design> impleme
|
||||
}else {
|
||||
s = "Snow moutain, snowy day, natural light";
|
||||
}
|
||||
Map<ToProductImageVO, Integer> toProductImageVOIntegerMap = allocateElements(toProductImageDTO.getToProductImageVOList(), cloudTaskDTO.getNums());
|
||||
for (ToProductImageVO toProductImageVO : toProductImageDTO.getToProductImageVOList()) {
|
||||
String taskId = UUID.randomUUID() + "-" + i + "-" + userHolder.getId();
|
||||
i ++;
|
||||
String taskId;
|
||||
if (toProductImageVO.getElementType().equals("ToProductImage")) {
|
||||
ToProductImageResult toProductImageResult1 = toProductImageResultMapper.selectById(toProductImageVO.getElementId());
|
||||
String relightType = "overall";
|
||||
@@ -2052,53 +2052,86 @@ public class DesignServiceImpl extends ServiceImpl<DesignMapper, Design> impleme
|
||||
if (design.getSingleOverall().equals("single")) {
|
||||
relightType = "single";
|
||||
}
|
||||
List<BatchParamDTO> paramList = new ArrayList<>();
|
||||
List<String> promptList = pythonService.getPrompt(s, toProductImageVOIntegerMap.get(toProductImageVO));
|
||||
for (int i1 = 0; i1 < toProductImageVOIntegerMap.get(toProductImageVO); i1++) {
|
||||
BatchParamDTO batchParamDTO = new BatchParamDTO();
|
||||
taskId = UUID.randomUUID() + "-" + i + "-" + userHolder.getId();
|
||||
batchParamDTO.setTasks_id(taskId);
|
||||
batchParamDTO.setPrompt(promptList.get(i1));
|
||||
batchParamDTO.setImage_url(toProductImageResult1.getUrl());
|
||||
batchParamDTO.setProduct_type(relightType);
|
||||
batchParamDTO.setDirection(toProductImageDTO.getDirection());
|
||||
paramList.add(batchParamDTO);
|
||||
|
||||
ToProductImageResult toProductImageResult = new ToProductImageResult();
|
||||
toProductImageResult.setElementId(toProductImageResult1.getId());
|
||||
toProductImageResult.setElementType("ToProductImage");
|
||||
toProductImageResult.setCreateTime(LocalDateTime.now());
|
||||
toProductImageResult.setToProductImageRecordId(toProductImageRecord.getId());
|
||||
toProductImageResult.setIsLike(0);
|
||||
toProductImageResult.setTaskId(taskId);
|
||||
toProductImageResult.setProjectId(projectId);
|
||||
toProductImageResult.setTaskIdBatch(batchTaskId);
|
||||
if (null != userLikeGroupId) {
|
||||
toProductImageResult.setUserLikeGroupId(userLikeGroupId);
|
||||
}
|
||||
if (toProductImageDTO.getBrightenValue() != null) {
|
||||
toProductImageResult.setBrightenValue(toProductImageDTO.getBrightenValue());
|
||||
}
|
||||
toProductImageResult.setDirection(toProductImageDTO.getDirection());
|
||||
toProductImageResultMapper.insert(toProductImageResult);
|
||||
result.add(toProductImageResult);
|
||||
|
||||
// 添加需要扣除的积分到预扣除区
|
||||
creditsService.addRecordToCreditsDeduction(userHolder.getId(), taskId, CreditsEventsEnum.RELIGHT);
|
||||
i ++;
|
||||
}
|
||||
// 走模型
|
||||
pythonService.relightBatch(batchTaskId, paramList, userHolder.getId().toString());
|
||||
}
|
||||
|
||||
// 走模型
|
||||
pythonService.relightBatch(toProductImageResult1.getUrl(), taskId, s, toProductImageDTO.getDirection(), relightType);
|
||||
ToProductImageResult toProductImageResult = new ToProductImageResult();
|
||||
toProductImageResult.setElementId(toProductImageResult1.getId());
|
||||
toProductImageResult.setElementType("ToProductImage");
|
||||
toProductImageResult.setCreateTime(LocalDateTime.now());
|
||||
toProductImageResult.setToProductImageRecordId(toProductImageRecord.getId());
|
||||
toProductImageResult.setIsLike(0);
|
||||
toProductImageResult.setTaskId(taskId);
|
||||
toProductImageResult.setProjectId(projectId);
|
||||
toProductImageResult.setTaskIdBatch(batchTaskId);
|
||||
if (null != userLikeGroupId) {
|
||||
toProductImageResult.setUserLikeGroupId(userLikeGroupId);
|
||||
}
|
||||
if (toProductImageDTO.getBrightenValue() != null) {
|
||||
toProductImageResult.setBrightenValue(toProductImageDTO.getBrightenValue());
|
||||
}
|
||||
toProductImageResult.setDirection(toProductImageDTO.getDirection());
|
||||
toProductImageResultMapper.insert(toProductImageResult);
|
||||
result.add(toProductImageResult);
|
||||
}else {
|
||||
ToProductElement toProductElement = toProductElementMapper.selectById(toProductImageVO.getElementId());
|
||||
// 走模型
|
||||
pythonService.relightBatch(toProductElement.getUrl(), taskId, s, toProductImageDTO.getDirection(), "overall");
|
||||
ToProductImageResult toProductImageResult = new ToProductImageResult();
|
||||
toProductImageResult.setElementId(toProductElement.getId());
|
||||
toProductImageResult.setElementType("ProductElement");
|
||||
toProductImageResult.setCreateTime(LocalDateTime.now());
|
||||
toProductImageResult.setToProductImageRecordId(toProductImageRecord.getId());
|
||||
toProductImageResult.setIsLike(0);
|
||||
toProductImageResult.setTaskId(taskId);
|
||||
toProductImageResult.setProjectId(projectId);
|
||||
toProductImageResult.setTaskIdBatch(batchTaskId);
|
||||
if (null != userLikeGroupId) {
|
||||
toProductImageResult.setUserLikeGroupId(userLikeGroupId);
|
||||
List<BatchParamDTO> paramList = new ArrayList<>();
|
||||
List<String> promptList = pythonService.getPrompt(s, toProductImageVOIntegerMap.get(toProductImageVO));
|
||||
for (int i1 = 0; i1 < toProductImageVOIntegerMap.get(toProductImageVO); i1++) {
|
||||
BatchParamDTO batchParamDTO = new BatchParamDTO();
|
||||
taskId = UUID.randomUUID() + "-" + i + "-" + userHolder.getId();
|
||||
batchParamDTO.setTasks_id(taskId);
|
||||
batchParamDTO.setPrompt(promptList.get(i1));
|
||||
batchParamDTO.setImage_url(toProductElement.getUrl());
|
||||
batchParamDTO.setProduct_type("overall");
|
||||
batchParamDTO.setDirection(toProductImageDTO.getDirection());
|
||||
paramList.add(batchParamDTO);
|
||||
|
||||
ToProductImageResult toProductImageResult = new ToProductImageResult();
|
||||
toProductImageResult.setElementId(toProductElement.getId());
|
||||
toProductImageResult.setElementType("ProductElement");
|
||||
toProductImageResult.setCreateTime(LocalDateTime.now());
|
||||
toProductImageResult.setToProductImageRecordId(toProductImageRecord.getId());
|
||||
toProductImageResult.setIsLike(0);
|
||||
toProductImageResult.setTaskId(taskId);
|
||||
toProductImageResult.setProjectId(projectId);
|
||||
toProductImageResult.setTaskIdBatch(batchTaskId);
|
||||
if (null != userLikeGroupId) {
|
||||
toProductImageResult.setUserLikeGroupId(userLikeGroupId);
|
||||
}
|
||||
if (toProductImageDTO.getBrightenValue() != null) {
|
||||
toProductImageResult.setBrightenValue(toProductImageDTO.getBrightenValue());
|
||||
}
|
||||
toProductImageResult.setDirection(toProductImageDTO.getDirection());
|
||||
toProductImageResultMapper.insert(toProductImageResult);
|
||||
result.add(toProductImageResult);
|
||||
|
||||
// 添加需要扣除的积分到预扣除区
|
||||
creditsService.addRecordToCreditsDeduction(userHolder.getId(), taskId, CreditsEventsEnum.RELIGHT);
|
||||
i ++;
|
||||
}
|
||||
if (toProductImageDTO.getBrightenValue() != null) {
|
||||
toProductImageResult.setBrightenValue(toProductImageDTO.getBrightenValue());
|
||||
}
|
||||
toProductImageResult.setDirection(toProductImageDTO.getDirection());
|
||||
toProductImageResultMapper.insert(toProductImageResult);
|
||||
result.add(toProductImageResult);
|
||||
// 走模型
|
||||
pythonService.relightBatch(batchTaskId, paramList, userHolder.getId().toString());
|
||||
}
|
||||
// 添加需要扣除的积分到预扣除区
|
||||
creditsService.addRecordToCreditsDeduction(userHolder.getId(), taskId, CreditsEventsEnum.RELIGHT);
|
||||
}
|
||||
CloudTask cloudTask = CopyUtil.copyObject(cloudTaskDTO, CloudTask.class);
|
||||
cloudTask.setProjectId(projectId);
|
||||
|
||||
Reference in New Issue
Block a user