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

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")