框选适配py

This commit is contained in:
litianxiang
2026-03-27 15:19:38 +08:00
parent 0da66ff210
commit e4940019bf

View File

@@ -72,6 +72,8 @@ public class PythonService {
private String accessPythonPort; private String accessPythonPort;
@Value("${minio.bucketName.gradient}") @Value("${minio.bucketName.gradient}")
private String gradientBucketName; private String gradientBucketName;
@Value("${minio.bucketName.users}")
private String userBucketName;
@Value("${access.python.generate_sr_port}") @Value("${access.python.generate_sr_port}")
private String srServicePort; private String srServicePort;
@@ -3343,7 +3345,7 @@ public class PythonService {
throw new BusinessException("system error!"); throw new BusinessException("system error!");
} }
public Boolean generateSketchOrPrint(String params, String port, String servicePath,String taskId) { public Boolean generateSketchOrPrint(String params, String port, String servicePath, String taskId) {
//限流校验 //限流校验
// AccessLimitUtils.validate("generateSketchOrPrint", 5); // AccessLimitUtils.validate("generateSketchOrPrint", 5);
OkHttpClient client = new OkHttpClient().newBuilder() OkHttpClient client = new OkHttpClient().newBuilder()
@@ -3405,7 +3407,7 @@ public class PythonService {
if (result && jsonObject.get("code").equals(200)) { if (result && jsonObject.get("code").equals(200)) {
log.info("Generate##responseObject###{}", jsonObject); log.info("Generate##responseObject###{}", jsonObject);
// return setGenerateImageList(jsonObject.getJSONObject("data")); // return setGenerateImageList(jsonObject.getJSONObject("data"));
if (servicePath== CommonConstant.GENERATE_PATH_FLUX2_KLEIN){ if (servicePath == CommonConstant.GENERATE_PATH_FLUX2_KLEIN) {
//放入结果到mq //放入结果到mq
JSONObject data = jsonObject.getJSONObject("data"); JSONObject data = jsonObject.getJSONObject("data");
String outputPath = data.getString("output_path"); String outputPath = data.getString("output_path");
@@ -4172,6 +4174,9 @@ public class PythonService {
.writeTimeout(60, TimeUnit.SECONDS) .writeTimeout(60, TimeUnit.SECONDS)
.build(); .build();
MediaType mediaType = MediaType.parse("application/json"); MediaType mediaType = MediaType.parse("application/json");
content.put("bucket", userBucketName);
content.put("object_name", content.get("user_id") + "/" + "segment" + "/" + UUID.randomUUID() + ".png");
content.remove("user_id");
RequestBody body = RequestBody.create(mediaType, JSON.toJSONString(content)); RequestBody body = RequestBody.create(mediaType, JSON.toJSONString(content));
String url = accessPythonIp + ":" + accessPythonPort + "/api/seg_anything"; String url = accessPythonIp + ":" + accessPythonPort + "/api/seg_anything";