fastapi -> flask

This commit is contained in:
2024-06-17 13:21:58 +08:00
parent 8ff8a7480f
commit 257c99698e
3 changed files with 11 additions and 9 deletions

View File

@@ -2359,8 +2359,8 @@ public class PythonService {
log.info("design请求python 参数:####{}", param); log.info("design请求python 参数:####{}", param);
RequestBody body = RequestBody.create(mediaType, param); RequestBody body = RequestBody.create(mediaType, param);
Request request = new Request.Builder() Request request = new Request.Builder()
// .url(accessPythonIp + ":" + accessPythonPort + "/api/design") .url(accessPythonIp + ":" + accessPythonPort + "/api/design")
.url(fastApiPythonAddress + "/api/design") // .url(fastApiPythonAddress + "/api/design")
// .url(accessPythonIp + ":10200/aifda/api/v1.0/generate") // .url(accessPythonIp + ":10200/aifda/api/v1.0/generate")
.method("POST", body) .method("POST", body)
.addHeader("Authorization", "Basic YWlkbGFiOjEyMw==") .addHeader("Authorization", "Basic YWlkbGFiOjEyMw==")
@@ -2466,8 +2466,8 @@ public class PythonService {
System.out.println(JSON.toJSONString(content)); System.out.println(JSON.toJSONString(content));
RequestBody body = RequestBody.create(mediaType, JSON.toJSONString(content)); RequestBody body = RequestBody.create(mediaType, JSON.toJSONString(content));
Request request = new Request.Builder() Request request = new Request.Builder()
// .url(accessPythonIp + ":" + accessPythonPort + "/api/attribute_retrieve") .url(accessPythonIp + ":" + accessPythonPort + "/api/attribute_retrieve")
.url(fastApiPythonAddress + "/api/attribute_retrieve") // .url(fastApiPythonAddress + "/api/attribute_retrieve")
// .url(accessPythonIp+":9991/aifda/api/v1.0/attribute_retrieval") // .url(accessPythonIp+":9991/aifda/api/v1.0/attribute_retrieval")
.method("POST", body) .method("POST", body)
.addHeader("Authorization", "Basic YWlkbGFiOjEyMw==") .addHeader("Authorization", "Basic YWlkbGFiOjEyMw==")
@@ -3262,9 +3262,11 @@ public class PythonService {
String jsonString = JSON.toJSONString(content, SerializerFeature.WriteNullStringAsEmpty); String jsonString = JSON.toJSONString(content, SerializerFeature.WriteNullStringAsEmpty);
RequestBody body = RequestBody.create(mediaType, jsonString); RequestBody body = RequestBody.create(mediaType, jsonString);
String path = accessPythonIp + ":" + accessPythonPort + "/api/translateToEN";
log.info("translateToEN 请求地址: {}", path);
Request request = new Request.Builder() Request request = new Request.Builder()
// .url(accessPythonIp + ":" + accessPythonPort + "/api/translateToEN") .url(path)
.url(fastApiPythonAddress + "/api/translateToEN") // .url(fastApiPythonAddress + "/api/translateToEN")
.method("POST", body) .method("POST", body)
.addHeader("Content-Type", "application/json") .addHeader("Content-Type", "application/json")
.build(); .build();

View File

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

View File

@@ -45,7 +45,7 @@ spring.servlet.multipart.max-request-size= 10MB
access.python.ip=http://18.167.251.121 access.python.ip=http://18.167.251.121
access.python.port=9992 access.python.port=9992
access.python.generate_sr_port=9994 access.python.generate_sr_port=9994
access.python.address=http://18.167.251.121:9996 access.python.address=http://18.167.251.121:9994
minio.endpoint=https://www.minio.aida.com.hk:9000 minio.endpoint=https://www.minio.aida.com.hk:9000
minio.accessKey=admin minio.accessKey=admin