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