Merge remote-tracking branch 'origin/dev/dev' into prod/release_1.0

This commit is contained in:
litianxiang
2025-10-31 11:13:36 +08:00

View File

@@ -82,6 +82,10 @@ public class TryOnEffectServiceImpl extends ServiceImpl<TryOnEffectMapper, TryOn
CustomerPhoto customerPhoto = customerPhotoService.getById(customerPhotoId);
String customerPhotoUrl = customerPhoto.getPhotoUrl();
if (customerPhotoUrl != null && !customerPhotoUrl.trim().isEmpty()) {
if (imageUrls.isEmpty()){
throw BusinessException.parameterRequired("TryOn result");
}
//先放tryon图片后放脸
imageUrls.add(customerPhotoUrl);
}
}
@@ -375,7 +379,7 @@ public class TryOnEffectServiceImpl extends ServiceImpl<TryOnEffectMapper, TryOn
generationConfig.set("responseModalities", Arrays.asList("IMAGE"));
JSONObject imageConfig = new JSONObject();
imageConfig.set("aspectRatio", "9:16");
imageConfig.set("aspectRatio", "2:3");
generationConfig.set("imageConfig", imageConfig);
requestBody.set("generationConfig", generationConfig);
@@ -436,7 +440,8 @@ public class TryOnEffectServiceImpl extends ServiceImpl<TryOnEffectMapper, TryOn
try (Response response = client.newCall(request).execute()) {
if (!response.isSuccessful()) {
log.info("Google API响应 " + response.body());
String result = response.body().string();
log.info("Google 响应错误结果:{}", result);
log.warn("Google API响应失败状态码: {}", response.code());
if (attempt < maxRetries) {
Thread.sleep(retryDelay * attempt);
@@ -555,7 +560,6 @@ public class TryOnEffectServiceImpl extends ServiceImpl<TryOnEffectMapper, TryOn
requestBody.put("input_image_list", inputImageList);
requestBody.put("input_face", inputFaceUrl);
requestBody.put("threshold", 0.2);
log.info("换脸API请求体: {}", requestBody);
// 调用换脸API
String response = sendFaceSwapRequest(faceSwapConfig.getRefaceUrl(), requestBody.toString());