Merge remote-tracking branch 'origin/dev/dev' into dev/dev

# Conflicts:
#	src/main/resources/application-dev.properties
This commit is contained in:
shahaibo
2024-06-17 17:38:04 +08:00
6 changed files with 42 additions and 18 deletions

View File

@@ -152,8 +152,8 @@ public class ChatRobotServiceImpl implements ChatRobotService {
RequestBody body = RequestBody.create(mediaType, param);
Request request = new Request.Builder()
// .url("http://127.0.0.1:5000/api/chat_stream_test")
// .url(accessPythonIp + ":" + accessPythonPort + "/api/chat_stream_test")
.url(fastApiPythonAddress + "/api/chat_robot")
.url(accessPythonIp + ":" + accessPythonPort + "/api/chat_stream_test")
// .url(fastApiPythonAddress + "/api/chat_robot")
// .url(accessPythonIp + ":10200/aifda/api/v1.0/generate")
.method("POST", body)
.addHeader("Content-Type", "application/json")

View File

@@ -88,6 +88,10 @@ public class GenerateServiceImpl extends ServiceImpl<GenerateMapper, Generate> i
@Value("${redis.key.toProductImageResultKey}")
private String toProductImageResultKey;
@Value("${access.python.generate_sr_port}")
private String generateServicePort;
@Override
public GenerateCaptionVO generateCaption(Long sketchElementId) {
CollectionElement collectionElement = collectionElementMapper.selectById(sketchElementId);
@@ -143,6 +147,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 = generateServicePort;
String jsonString = "";
HashMap<String, String> params = new HashMap<>();
// 3.1 确定不同类型的印花分别调哪个接口
@@ -157,9 +162,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":
@@ -173,7 +180,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);
@@ -525,8 +532,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();