This commit is contained in:
2024-06-17 10:21:49 +08:00
parent fc48d8931f
commit 0017568cc7
5 changed files with 33 additions and 17 deletions

View File

@@ -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();