diff --git a/src/main/java/com/aida/lanecarford/service/impl/TryOnEffectServiceImpl.java b/src/main/java/com/aida/lanecarford/service/impl/TryOnEffectServiceImpl.java index 70b2578..bc4fb6d 100644 --- a/src/main/java/com/aida/lanecarford/service/impl/TryOnEffectServiceImpl.java +++ b/src/main/java/com/aida/lanecarford/service/impl/TryOnEffectServiceImpl.java @@ -244,8 +244,6 @@ public class TryOnEffectServiceImpl extends ServiceImpl urls) { - System.setProperty("https.proxyHost", "127.0.0.1"); - System.setProperty("https.proxyPort", "10809"); // log.info("开始执行AITryOnEffect - prompt: {}, url: {}", prompt, url); @@ -646,34 +644,34 @@ public class TryOnEffectServiceImpl extends ServiceImpl 0) { + String imagePath = outputArray.getString(0); + log.info("换脸成功,图片路径: {}", imagePath); + + // 构建完整的图片URL(假设需要添加基础URL) + String fullImageUrl = buildFullImageUrl(imagePath); + log.info("完整图片URL: {}", fullImageUrl); + + // 下载图片并上传到MinIO + return downloadAndUploadToMinio(fullImageUrl); + } else { + log.error("output数组为空"); + throw new BusinessException("Empty output array", "返回的图片数组为空", ResultEnum.ERROR.getCode()); + } + } else { + log.error("output字段不是数组格式: {}", outputObj); + throw new BusinessException("Invalid output format", "output字段格式不正确", ResultEnum.ERROR.getCode()); } + }else { + log.error("换脸API响应失败: {}", response); + throw new BusinessException("reface error", "换脸失败", ResultEnum.ERROR.getCode()); } - - // 检查是否有错误信息 - if (jsonResponse.containsKey("error")) { - String error = jsonResponse.getStr("error"); - log.error("换脸API返回错误: {}", error); - throw new BusinessException("Face swap failed", "换脸失败: " + error, ResultEnum.ERROR.getCode()); - } - - log.error("换脸API响应格式不正确: {}", response); - throw new BusinessException("Invalid response format", "响应格式不正确", ResultEnum.ERROR.getCode()); - } catch (BusinessException e) { throw e; } catch (Exception e) { @@ -682,6 +680,28 @@ public class TryOnEffectServiceImpl extends ServiceImpl