generate模型更换后的接口更改及异步获取结果
This commit is contained in:
@@ -2880,7 +2880,7 @@ public class PythonService {
|
||||
throw new BusinessException("system error!");
|
||||
}
|
||||
|
||||
public List<String> generateSketchOrPrint(GenerateToPythonDTO generateToPythonDTO) {
|
||||
public Boolean generateSketchOrPrint(GenerateToPythonDTO generateToPythonDTO) {
|
||||
//限流校验
|
||||
// AccessLimitUtils.validate("generateSketchOrPrint", 5);
|
||||
OkHttpClient client = new OkHttpClient().newBuilder()
|
||||
@@ -2895,7 +2895,8 @@ public class PythonService {
|
||||
// .url("http://18.167.251.121:9992")
|
||||
// .url("http://127.0.0.1:5000/api/diffusion")
|
||||
// .url(accessPythonIp + ":" + accessPythonPort + "/api/diffusion")
|
||||
.url(accessPythonIp + ":" + accessPythonPort + "/api/generate_image")
|
||||
// .url(accessPythonIp + ":" + accessPythonPort + "/api/generate_image")
|
||||
.url(srPythonPort + "/api/generate_image")
|
||||
.method("POST", body)
|
||||
// .addHeader("Authorization", "Basic YWlkbGFiOjEyMw==")
|
||||
.addHeader("Content-Type", "application/json")
|
||||
@@ -2936,12 +2937,13 @@ public class PythonService {
|
||||
|
||||
if (result && jsonObject.get("code").equals(200)) {
|
||||
log.info("Generate##responseObject###{}", jsonObject);
|
||||
return setGenerateImageList(jsonObject.getJSONObject("data"));
|
||||
// return setGenerateImageList(jsonObject.getJSONObject("data"));
|
||||
return Boolean.TRUE;
|
||||
}else {
|
||||
log.info("generateSketchOrPrintPrint失败###{}", jsonObject);
|
||||
log.info("Generate Exception! Code : " + jsonObject.get("code"));
|
||||
return Boolean.FALSE;
|
||||
}
|
||||
log.info("generateSketchOrPrintPrint失败###{}", jsonObject);
|
||||
log.info("Generate Exception! Code : " + jsonObject.get("code"));
|
||||
//生成失败
|
||||
throw new BusinessException("generate.interface.error");
|
||||
}
|
||||
|
||||
public Response sendPostToModel(String content, String portAndRoute, String functionName) {
|
||||
|
||||
Reference in New Issue
Block a user