From fc2d8b61f403ef0661fb1fcf4b9235a92abeb9be Mon Sep 17 00:00:00 2001 From: litianxiang Date: Thu, 30 Oct 2025 15:36:40 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8D=A2=E8=84=B8=E5=93=8D=E5=BA=94=E6=A0=BC?= =?UTF-8?q?=E5=BC=8F=E9=80=82=E9=85=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/TryOnEffectServiceImpl.java | 76 ++++++++++++------- 1 file changed, 48 insertions(+), 28 deletions(-) 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