换脸url写入配置
This commit is contained in:
@@ -0,0 +1,32 @@
|
|||||||
|
package com.aida.lanecarford.config;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 换脸API配置类
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@Component
|
||||||
|
@ConfigurationProperties(prefix = "faceswap.api")
|
||||||
|
public class FaceSwapConfig {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* API基础URL
|
||||||
|
*/
|
||||||
|
private String baseUrl;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 换脸接口端点
|
||||||
|
*/
|
||||||
|
private String refaceEndpoint;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取完整的换脸API URL
|
||||||
|
* @return 完整的API URL
|
||||||
|
*/
|
||||||
|
public String getRefaceUrl() {
|
||||||
|
return baseUrl + refaceEndpoint;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -3,6 +3,7 @@ package com.aida.lanecarford.service.impl;
|
|||||||
import cn.hutool.json.JSONObject;
|
import cn.hutool.json.JSONObject;
|
||||||
import com.aida.lanecarford.common.CommonConstant;
|
import com.aida.lanecarford.common.CommonConstant;
|
||||||
import com.aida.lanecarford.config.MinioConfig;
|
import com.aida.lanecarford.config.MinioConfig;
|
||||||
|
import com.aida.lanecarford.config.FaceSwapConfig;
|
||||||
import com.aida.lanecarford.common.response.ResultEnum;
|
import com.aida.lanecarford.common.response.ResultEnum;
|
||||||
import com.aida.lanecarford.common.constant.MinioFileConstants;
|
import com.aida.lanecarford.common.constant.MinioFileConstants;
|
||||||
import com.aida.lanecarford.entity.*;
|
import com.aida.lanecarford.entity.*;
|
||||||
@@ -52,6 +53,7 @@ public class TryOnEffectServiceImpl extends ServiceImpl<TryOnEffectMapper, TryOn
|
|||||||
|
|
||||||
private final MinioUtil minioUtil;
|
private final MinioUtil minioUtil;
|
||||||
private final MinioConfig minioConfig;
|
private final MinioConfig minioConfig;
|
||||||
|
private final FaceSwapConfig faceSwapConfig;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TryOnResultVo generateTryOnEffect(TryOnEffect tryOnEffectDto) {
|
public TryOnResultVo generateTryOnEffect(TryOnEffect tryOnEffectDto) {
|
||||||
@@ -559,7 +561,7 @@ public class TryOnEffectServiceImpl extends ServiceImpl<TryOnEffectMapper, TryOn
|
|||||||
requestBody.put("threshold", 0.2);
|
requestBody.put("threshold", 0.2);
|
||||||
|
|
||||||
// 调用换脸API
|
// 调用换脸API
|
||||||
String response = sendFaceSwapRequest("http://18.167.251.121:10004/api/v1/reface", requestBody.toString());
|
String response = sendFaceSwapRequest(faceSwapConfig.getRefaceUrl(), requestBody.toString());
|
||||||
|
|
||||||
// 处理响应
|
// 处理响应
|
||||||
return processFaceSwapResponse(response);
|
return processFaceSwapResponse(response);
|
||||||
|
|||||||
@@ -70,6 +70,12 @@ minio:
|
|||||||
# 文件访问URL前缀
|
# 文件访问URL前缀
|
||||||
url-prefix: ${minio.endpoint}/${minio.bucket-name}/
|
url-prefix: ${minio.endpoint}/${minio.bucket-name}/
|
||||||
|
|
||||||
|
# 换脸API配置
|
||||||
|
faceswap:
|
||||||
|
api:
|
||||||
|
base-url: http://18.167.251.121:10004
|
||||||
|
reface-endpoint: /api/v1/reface
|
||||||
|
|
||||||
# 日志配置
|
# 日志配置
|
||||||
logging:
|
logging:
|
||||||
level:
|
level:
|
||||||
|
|||||||
Reference in New Issue
Block a user