Merge remote-tracking branch 'origin/dev/dev' into dev/dev

This commit is contained in:
shahaibo
2024-06-27 15:33:38 +08:00
30 changed files with 789 additions and 250 deletions

View File

@@ -3175,15 +3175,15 @@ public class PythonService {
throw new BusinessException("cloth-classification.interface.exception");
}
public Boolean cancelGenerateTask(String taskId) {
public Boolean cancelGenerateTask(String taskId, String path) {
OkHttpClient client = new OkHttpClient().newBuilder()
.connectTimeout(30, TimeUnit.SECONDS)
.pingInterval(5, TimeUnit.SECONDS)//websocket轮训间隔(单位:秒)
.readTimeout(60, TimeUnit.SECONDS)//读取超时(单位:秒)
.writeTimeout(60, TimeUnit.SECONDS)//写入超时(单位:秒)
.build();
// String url = accessPythonIp + ":" + accessPythonPort + "/api/generate_cancel/" + taskId;
String url = fastApiPythonAddress + "/api/generate_cancel/" + taskId;
String url = accessPythonIp + ":" + accessPythonPort + path + taskId;
// String url = fastApiPythonAddress + "/api/generate_cancel/" + taskId;
Request request = new Request.Builder()
.url(url)
// .addHeader("Authorization", "Basic YWlkbGFiOjEyMw==")
@@ -3194,14 +3194,14 @@ public class PythonService {
log.info("cancelGenerateTask请求入参content###{}", taskId);
response = client.newCall(request).execute();
} catch (IOException ioException) {
log.error("PythonService##cancelGenerateTask异常###{}", ExceptionUtil.getThrowableList(ioException));
log.error("PythonService##cancelGenerateTask异常###{}", response);
return null;
}
int responseCode = response.code();
response.close();
if (responseCode != HttpURLConnection.HTTP_OK) {
log.info("generate-python 取消请求失败");
log.info("generate-python 取消请求失败. {}", response);
return Boolean.FALSE;
}
log.info("generate-python 取消请求成功");