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