slogan
This commit is contained in:
@@ -72,7 +72,7 @@ public class GenerateConsumer {
|
||||
try {
|
||||
generateService.generateThroughImageText(generateThroughImageTextDTO);
|
||||
}catch (Exception e){
|
||||
log.error(e.getMessage());
|
||||
log.error("error message : {}", e.getMessage());
|
||||
}
|
||||
// 将消息从redis排队队列中删除,需保证被消费的消息存储到db之后再从redis删除
|
||||
redisUtil.removeFromZSet(consumptionOrderKey, uniqueId);
|
||||
|
||||
@@ -12,18 +12,23 @@ public class MQConfig {
|
||||
// public static final String GENERATE_QUEUE = "generate-queue-test";
|
||||
// ==================================================================
|
||||
// public static final String GENERATE_QUEUE = "generate-queue-local";
|
||||
public static final String GENERATE_QUEUE = "generate-queue-prod";
|
||||
|
||||
public static final String GENERATE_QUEUE = "generate-queue-dev";
|
||||
// public static final String GENERATE_QUEUE = "generate-queue-prod";
|
||||
//
|
||||
// public static final String SR_QUEUE = "SR-queue-local";
|
||||
public static final String SR_QUEUE = "SR-queue-prod";
|
||||
|
||||
public static final String SR_QUEUE = "SR-queue-dev";
|
||||
// public static final String SR_QUEUE = "SR-queue-prod";
|
||||
//
|
||||
// public static final String SR_RESULT_QUEUE = "SuperResolution-local";
|
||||
public static final String SR_RESULT_QUEUE = "SuperResolution-prod";
|
||||
|
||||
public static final String SR_RESULT_QUEUE = "SuperResolution-dev";
|
||||
// public static final String SR_RESULT_QUEUE = "SuperResolution-prod";
|
||||
//
|
||||
// public static final String GENERATE_RESULT_QUEUE = "GenerateImage-local";
|
||||
public static final String GENERATE_RESULT_QUEUE = "GenerateImage-prod";
|
||||
|
||||
public static final String TO_PRODUCT_IMAGE_RESULT_QUEUE = "ToProductImage-local";
|
||||
public static final String GENERATE_RESULT_QUEUE = "GenerateImage-dev";
|
||||
// public static final String GENERATE_RESULT_QUEUE = "GenerateImage-prod";
|
||||
//
|
||||
// public static final String TO_PRODUCT_IMAGE_RESULT_QUEUE = "ToProductImage-local";
|
||||
public static final String TO_PRODUCT_IMAGE_RESULT_QUEUE = "ToProductImage-dev";
|
||||
public MQConfig() {
|
||||
}
|
||||
|
||||
|
||||
@@ -21,6 +21,12 @@ public class CommonConstant {
|
||||
|
||||
public static final String GENERATE_SINGLE_LOGO = "/api/generate_single_logo";
|
||||
|
||||
public static final String GENERATE_SLOGAN = "/api/slogan";
|
||||
public static final String GENERATE_SLOGAN = "/apislogan";
|
||||
|
||||
public static final String PYTHON_PORT_9996 = "9996";
|
||||
|
||||
public static final String PYTHON_PORT_9997 = "9997";
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -2977,7 +2977,7 @@ public class PythonService {
|
||||
throw new BusinessException("system error!");
|
||||
}
|
||||
|
||||
public Boolean generateSketchOrPrint(String params, String servicePath) {
|
||||
public Boolean generateSketchOrPrint(String params, String port, String servicePath) {
|
||||
//限流校验
|
||||
// AccessLimitUtils.validate("generateSketchOrPrint", 5);
|
||||
OkHttpClient client = new OkHttpClient().newBuilder()
|
||||
@@ -2994,7 +2994,7 @@ public class PythonService {
|
||||
// .url("http://127.0.0.1:5000/api/diffusion")
|
||||
// .url(accessPythonIp + ":" + accessPythonPort + "/api/diffusion")
|
||||
// .url(accessPythonIp + ":" + accessPythonPort + "/api/generate_image")
|
||||
.url(fastApiPythonAddress + servicePath)
|
||||
.url(accessPythonIp + ":" + port + servicePath)
|
||||
.method("POST", body)
|
||||
// .addHeader("Authorization", "Basic YWlkbGFiOjEyMw==")
|
||||
.addHeader("Content-Type", "application/json")
|
||||
@@ -3259,8 +3259,8 @@ public class PythonService {
|
||||
String jsonString = JSON.toJSONString(content, SerializerFeature.WriteNullStringAsEmpty);
|
||||
RequestBody body = RequestBody.create(mediaType, jsonString);
|
||||
Request request = new Request.Builder()
|
||||
.url(accessPythonIp + ":" + accessPythonPort + "/api/translateToEN")
|
||||
// .url(fastApiPythonAddress + "/api/translateToEN")
|
||||
// .url(accessPythonIp + ":" + accessPythonPort + "/api/translateToEN")
|
||||
.url(fastApiPythonAddress + "/api/translateToEN")
|
||||
.method("POST", body)
|
||||
.addHeader("Content-Type", "application/json")
|
||||
.build();
|
||||
|
||||
@@ -142,6 +142,7 @@ public class GenerateServiceImpl extends ServiceImpl<GenerateMapper, Generate> i
|
||||
String category = generateThroughImageTextDTO.getLevel1Type().equals(SKETCH_BOARD.getRealName()) ? "sketch" :
|
||||
generateThroughImageTextDTO.getLevel1Type().equals(PRINT_BOARD.getRealName()) ? "print" : "moodboard";
|
||||
String path = CommonConstant.GENERATE_PATH;
|
||||
String port = CommonConstant.PYTHON_PORT_9996;
|
||||
String jsonString = "";
|
||||
HashMap<String, String> params = new HashMap<>();
|
||||
// 3.1 确定不同类型的印花分别调哪个接口
|
||||
@@ -156,9 +157,11 @@ public class GenerateServiceImpl extends ServiceImpl<GenerateMapper, Generate> i
|
||||
break;
|
||||
case "Slogan":
|
||||
path = CommonConstant.GENERATE_SLOGAN;
|
||||
port = CommonConstant.PYTHON_PORT_9997;
|
||||
params.put("num_point","16");
|
||||
params.put("tasks_id",generateThroughImageTextDTO.getUniqueId());
|
||||
params.put("prompt", text);
|
||||
params.put("svg", collectionElement.getUrl());
|
||||
params.put("image_url", collectionElement.getUrl());
|
||||
jsonString = JSON.toJSONString(params, SerializerFeature.WriteMapNullValue);
|
||||
break;
|
||||
case "Pattern":
|
||||
@@ -172,7 +175,7 @@ public class GenerateServiceImpl extends ServiceImpl<GenerateMapper, Generate> i
|
||||
jsonString = JSON.toJSONString(generateToPythonDTO, SerializerFeature.WriteMapNullValue);
|
||||
}
|
||||
|
||||
Boolean requestResult = pythonService.generateSketchOrPrint(jsonString, path);
|
||||
Boolean requestResult = pythonService.generateSketchOrPrint(jsonString, port, path);
|
||||
|
||||
// 4、将请求信息落库,将本次generate的请求信息添加到t_generate表中
|
||||
save(generate);
|
||||
@@ -524,8 +527,10 @@ public class GenerateServiceImpl extends ServiceImpl<GenerateMapper, Generate> i
|
||||
throw new BusinessException("Slogan can not be empty!");
|
||||
}
|
||||
|
||||
times = 1;
|
||||
// 将图片上传到图片服务器
|
||||
String path = minioUtil.base64UploadToPath(generateThroughImageTextDTO.getSloganBase64(), sloganBucket, null);
|
||||
// String path = "test/7c9114f93d08a702e00da928e66f321.png";
|
||||
String name = path.substring(path.lastIndexOf("/") + 1, path.lastIndexOf("."));
|
||||
// 保存到db,collection-element
|
||||
CollectionElement collectionElement = new CollectionElement();
|
||||
|
||||
Reference in New Issue
Block a user