统一管理python端服务ip和端口

This commit is contained in:
2024-01-02 11:53:09 +08:00
parent d19aa7083b
commit dd5997fea6
6 changed files with 37 additions and 27 deletions

View File

@@ -72,7 +72,7 @@ public class DesignDetailController {
return response;
}
@ApiOperation(value = "编辑图层大小和位置")
@ApiOperation(value = "编辑图层大小和位置 废弃")
@PostMapping("/editLayers")
public Response<ComposeLayersVO> editPositionAndScale(@Valid @RequestBody EditLayersPositionAndScaleVO positionAndScaleVO) throws IOException {
return Response.success(designItemService.editLayersPositionAndScale(positionAndScaleVO));

View File

@@ -28,7 +28,7 @@ public class GenerateController {
@Resource
private GenerateService generateService;
@ApiOperation("自动识别sketch的caption")
@ApiOperation("自动识别sketch的caption 暂时未上")
@PostMapping("/caption")
public Response<GenerateCaptionVO> generateCaption(@RequestParam Long sketchElementId) {
return Response.success(generateService.generateCaption(sketchElementId));

View File

@@ -55,11 +55,13 @@ public class PythonService {
private DesignHistoryService designHistoryService;
@Value("${access.python.ip:''}")
private String accessPythonIp;
@Value("${access.python.port:''}")
private String accessPythonPort;
@Resource
private PythonTAllInfoService pythonTAllInfoService;
/**
* 生成打印的图片 二合一
* 生成打印的图片 二合一 (废弃于2024/01/02)
*
* @param printPath
* @return
@@ -83,7 +85,7 @@ public class PythonService {
RequestBody body = RequestBody.create(mediaType, JSON.toJSONString(content));
Request request = new Request.Builder()
// .url(accessPythonIp + ":9999/aifda/api/v1.0/fusion_test")
.url(accessPythonIp + ":9991/api/image_fusion")
.url(accessPythonIp + ":" + accessPythonPort + "/api/image_fusion")
.method("POST", body)
.addHeader("Authorization", "Basic YWlkbGFiOjEyMw==")
.addHeader("Content-Type", "application/json")
@@ -1684,7 +1686,7 @@ public class PythonService {
log.info("design请求python 参数:####{}", param);
RequestBody body = RequestBody.create(mediaType, param);
Request request = new Request.Builder()
.url("http://18.167.251.121:9991/api/design")
.url(accessPythonIp + ":" + accessPythonPort + "/api/design")
// .url(accessPythonIp + ":10200/aifda/api/v1.0/generate")
.method("POST", body)
.addHeader("Authorization", "Basic YWlkbGFiOjEyMw==")
@@ -1717,7 +1719,7 @@ public class PythonService {
}
/**
* 生成高级图片
* 生成高级图片(废弃)
*
* @param designPath
* @return
@@ -1790,7 +1792,7 @@ public class PythonService {
System.out.println(JSON.toJSONString(content));
RequestBody body = RequestBody.create(mediaType, JSON.toJSONString(content));
Request request = new Request.Builder()
.url("http://18.167.251.121:9991/api/attribute_retrieve")
.url(accessPythonIp + ":" + accessPythonPort + "/api/attribute_retrieve")
// .url(accessPythonIp+":9991/aifda/api/v1.0/attribute_retrieval")
.method("POST", body)
.addHeader("Authorization", "Basic YWlkbGFiOjEyMw==")
@@ -2155,7 +2157,7 @@ public class PythonService {
log.info("design请求python 参数:####{}", param);
RequestBody body = RequestBody.create(mediaType, param);
Request request = new Request.Builder()
.url("http://18.167.251.121:9991/api/design")
.url(accessPythonIp + ":" + accessPythonPort + "/api/design")
// .url(accessPythonIp + ":10200/aifda/api/v1.0/generate")
.method("POST", body)
.addHeader("Authorization", "Basic YWlkbGFiOjEyMw==")
@@ -2191,7 +2193,7 @@ public class PythonService {
throw new BusinessException("design.interface.exception");
}
/** 暂时未用 */
public String generateSketchCaption(String url) {
//限流校验
AccessLimitUtils.validate("generateSketchCaption", 5);
@@ -2204,7 +2206,7 @@ public class PythonService {
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, url);
Request request = new Request.Builder()
.url(accessPythonIp + ":2828/aida/interrogator")
.url(accessPythonIp + ":" + accessPythonPort + "/aida/interrogator")
.method("POST", body)
.addHeader("Authorization", "Basic YWlkbGFiOjEyMw==")
.addHeader("Content-Type", "application/json")
@@ -2250,13 +2252,13 @@ public class PythonService {
content.put("category", category);
content.put("mode", mode);
content.put("str", text);
content.put("version", modelName);
content.put("version", "1");
content.put("gender", gender);
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")
.url("http://18.167.251.121:9991/api/diffusion")
.url(accessPythonIp + ":" + accessPythonPort + "/api/diffusion")
.method("POST", body)
.addHeader("Authorization", "Basic YWlkbGFiOjEyMw==")
.addHeader("Content-Type", "application/json")
@@ -2309,7 +2311,7 @@ public class PythonService {
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, content);
Request request = new Request.Builder()
.url("http://18.167.251.121" + ":" + portAndRoute)
.url(accessPythonIp + ":" + accessPythonPort + portAndRoute)
.method("POST", body)
.addHeader("Authorization", "Basic YWlkbGFiOjEyMw==")
.addHeader("Content-Type", "application/json")
@@ -2345,7 +2347,7 @@ public class PythonService {
String jsonString = JSON.toJSONString(content, SerializerFeature.WriteNullStringAsEmpty);
// todo 添加限流
Response response = this.sendPostToModel(jsonString, "9991/api/preview_control", "composeLayers");
Response response = this.sendPostToModel(jsonString, "/api/preview_control", "composeLayers");
// todo 结束限流
String bodyString;
@@ -2386,7 +2388,7 @@ public class PythonService {
String jsonString = JSON.toJSONString(contents, SerializerFeature.WriteNullStringAsEmpty);
// todo 添加限流
Response response = this.sendPostToModel(jsonString, "9991/api/category_recognition", "getClothCategory");
Response response = this.sendPostToModel(jsonString, "/api/category_recognition", "getClothCategory");
// todo 结束限流
String bodyString;

View File

@@ -105,7 +105,7 @@ public class GenerateServiceImpl extends ServiceImpl<GenerateMapper, Generate> i
GenerateModeEnum.TEXT_IMAGE.getCode();
String category = generateThroughImageTextDTO.getLevel1Type().equals(SKETCH_BOARD.getRealName()) ? "sketch" :
generateThroughImageTextDTO.getLevel1Type().equals(PRINT_BOARD.getRealName()) ? "print" : "moodboard";
text = !StringUtil.isNullOrEmpty(text) && generateThroughImageTextDTO.getVersion().equals("1") ? "painting style, " + text : text;
// text = !StringUtil.isNullOrEmpty(text) && generateThroughImageTextDTO.getVersion().equals("1") ? "painting style, " + text : text;
List<String> generatedSketchUrl = pythonService.generateSketchOrPrint(accountId, Objects.isNull(elementId) ? null : collectionElement.getUrl(),
category, text, mode, generateThroughImageTextDTO.getVersion(), generateThroughImageTextDTO.getGender());

View File

@@ -2,9 +2,12 @@ server.port=5567
#datasource
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
spring.datasource.url=jdbc:mysql://18.167.251.121:33006/aida?useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true
spring.datasource.username=root
spring.datasource.password=root
#spring.datasource.url=jdbc:mysql://18.167.251.121:33006/aida?useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true
#spring.datasource.username=root
#spring.datasource.password=root
spring.datasource.url=jdbc:mysql://18.167.251.121:33008/aida?useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true
spring.datasource.username=aida_con
spring.datasource.password=123456
#spring.datasource.password=QWa998345
#security
@@ -15,7 +18,7 @@ spring.security.jwtTokenPrefix=Bearer-
spring.security.jwtExpiration=8640000000
#spring security权限设置 认证了token还要认证权限 不然报错Full authentication is required to access this resource
spring.security.ignorePaths=/,/favicon.ico,/doc.html,/webjars/**,/swagger-resources,/v2/api-docs,\
/api/account/**,/api/element/**,/api/python/**,/api/design/**,/api/history/**,/api/library/**,/api/third/party/**,/api/workspace/**
/api/account/**,/api/element/**,/api/python/**,/api/design/**,/api/history/**,/api/library/**,/api/third/party/**,/api/generate/**,/api/workspace/**,/api/classification/**
spring.security.authApi=/auth/login
@@ -39,15 +42,19 @@ file.windows.path=D:\\upload\\
spring.servlet.multipart.max-file-size = 5MB
spring.servlet.multipart.max-request-size= 5MB
#访问python服务的ip(对应环境)
access.python.ip=http://43.198.80.117
#access.python.ip=http://18.167.251.121
#access.python.ip=http://43.198.80.117
access.python.ip=http://18.167.251.121
#access.python.ip=http://18.167.251.121:9991/
access.python.port=9992
minio.endpoint=http://18.167.251.121:9000
minio.accessKey=minioadmin
minio.secretKey=minioadmin
#minio.endpoint=http://18.167.251.121:9000
#minio.accessKey=minioadmin
#minio.secretKey=minioadmin
minio.endpoint=https://www.minio.aida.com.hk:9000
minio.accessKey=admin
minio.secretKey=admin123
minio.bucketName.clothing=aida-clothing
minio.bucketName.mannequins=aida-mannequins
minio.bucketName.results=aida-results
minio.bucketName.sysImage=aida-sys-image
minio.bucketName.users=aida-users
minio.bucketName.collectionElement=aida-collection-element

View File

@@ -50,6 +50,7 @@ spring.servlet.multipart.max-request-size= 5MB
#access.python.ip=http://43.198.80.117
access.python.ip=http://18.167.251.121
#access.python.ip=http://18.167.251.121:9991/
access.python.port=9991
# minIO服务配置之信息
minio.endpoint=https://www.minio.aida.com.hk:9000