generate 接口疏通
This commit is contained in:
@@ -1638,8 +1638,8 @@ public class PythonService {
|
|||||||
content.put("category", category);
|
content.put("category", category);
|
||||||
content.put("mode",mode);
|
content.put("mode",mode);
|
||||||
content.put("str", text);
|
content.put("str", text);
|
||||||
content.put("version",2);
|
content.put("version","2");
|
||||||
RequestBody body = RequestBody.create(mediaType, JSON.toJSONString(content));
|
RequestBody body = RequestBody.create(mediaType, JSON.toJSONString(content,SerializerFeature.WriteMapNullValue));
|
||||||
Request request = new Request.Builder()
|
Request request = new Request.Builder()
|
||||||
// .url(accessPythonIp + ":2828/aida/diffusion")
|
// .url(accessPythonIp + ":2828/aida/diffusion")
|
||||||
// .url("http://18.167.251.121:9992")
|
// .url("http://18.167.251.121:9992")
|
||||||
@@ -1651,7 +1651,7 @@ public class PythonService {
|
|||||||
Response response = null;
|
Response response = null;
|
||||||
String bodyString = null;
|
String bodyString = null;
|
||||||
try {
|
try {
|
||||||
log.info("generateSketchOrPrint请求入参content###{}", JSON.toJSONString(content));
|
log.info("generateSketchOrPrint请求入参content###{}", JSON.toJSONString(content,SerializerFeature.WriteMapNullValue));
|
||||||
response = client.newCall(request).execute();
|
response = client.newCall(request).execute();
|
||||||
bodyString = response.body().string();
|
bodyString = response.body().string();
|
||||||
// bodyString = "{\n" +
|
// bodyString = "{\n" +
|
||||||
@@ -1676,12 +1676,12 @@ public class PythonService {
|
|||||||
JSONObject jsonObject = JSON.parseObject(bodyString);
|
JSONObject jsonObject = JSON.parseObject(bodyString);
|
||||||
Boolean result = JSON.parseObject(JSON.toJSONString(response)).getBoolean("successful");
|
Boolean result = JSON.parseObject(JSON.toJSONString(response)).getBoolean("successful");
|
||||||
// Boolean result = Boolean.TRUE;
|
// Boolean result = Boolean.TRUE;
|
||||||
if (result) {
|
if (result && jsonObject.get("code").equals(200)) {
|
||||||
return setGenerateImageList(jsonObject.getJSONObject("data"));
|
return setGenerateImageList(jsonObject.getJSONObject("data"));
|
||||||
}
|
}
|
||||||
log.info("generateSketchOrPrintPrint失败###{}", jsonObject);
|
log.info("generateSketchOrPrintPrint失败###{}", jsonObject);
|
||||||
//生成失败
|
//生成失败
|
||||||
throw new BusinessException("generate exception!");
|
throw new BusinessException("Generate Exception! Code : " + jsonObject.get("code"));
|
||||||
}
|
}
|
||||||
|
|
||||||
public String sendPostToModel(Map<String,Object> content,String portAndRoute,String functionName){
|
public String sendPostToModel(Map<String,Object> content,String portAndRoute,String functionName){
|
||||||
|
|||||||
Reference in New Issue
Block a user