|
@@ -34,6 +34,7 @@ import java.util.ArrayList;
|
|
|
import java.util.Arrays;
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
|
+import java.util.concurrent.CompletableFuture;
|
|
|
import java.util.concurrent.ConcurrentHashMap;
|
|
|
|
|
|
@Service
|
|
@@ -167,8 +168,12 @@ public class ComfyUISocketServiceImpl implements ComfyUISocketService {
|
|
|
for (int i = 0; i < images.size(); i++) {
|
|
|
JSONObject image = images.getJSONObject(i);
|
|
|
String filename = image.getStr("filename");
|
|
|
- String filepath = "http://" + COMFYUI_HOST + ":" + port + "/api/view?filename=" + filename;
|
|
|
- String filepath_with_token = filepath + "&token=" + COMFYUI_TOKEN;
|
|
|
+
|
|
|
+ // ComfyUI + Nginx 输出域名转发
|
|
|
+// String filepath = "http://" + COMFYUI_HOST + ":" + port + "/api/view?filename=" + filename;
|
|
|
+// String filepath_with_token = filepath + "&token=" + COMFYUI_TOKEN;
|
|
|
+
|
|
|
+ String filepath = "http://o.daogu.ai/" + port + "/" + filename;
|
|
|
|
|
|
// -- [图片转存储存桶] -------------------------------------
|
|
|
SysFileResult result = new SysFileResult();
|
|
@@ -176,25 +181,30 @@ public class ComfyUISocketServiceImpl implements ComfyUISocketService {
|
|
|
|
|
|
// target: 上传目标 (-1:本地, 1:腾讯云, 2:阿里云, 3.抖音云)
|
|
|
if (UPLOAD_TARGET == 1) {
|
|
|
- result = tencentCosService.urlToCOS(filepath_with_token);
|
|
|
+ result = tencentCosService.urlToCOS(filepath, "png");
|
|
|
}
|
|
|
if (UPLOAD_TARGET == 3) {
|
|
|
- result = douyinTosService.urlToTOS(filepath_with_token);
|
|
|
+ result = douyinTosService.urlToTOS(filepath, "png");
|
|
|
}
|
|
|
- System.out.println("filepath_with_token = " + filepath_with_token);
|
|
|
System.out.println("result = " + result);
|
|
|
|
|
|
// -- [记录到生成图片记录表] --------------------------------
|
|
|
if (params != null) {
|
|
|
- Long drama_project_storyboard_id = Convert.toLong(params.get("drama_project_storyboard_id"));
|
|
|
- String prompt_id = Convert.toStr(dataChildren.get("prompt_id"));
|
|
|
- if (drama_project_storyboard_id != null) {
|
|
|
- entity.setDrama_project_storyboard_id(drama_project_storyboard_id);
|
|
|
- entity.setPrompt_id(prompt_id);
|
|
|
- entity.setUrl_origin(filepath);
|
|
|
- System.out.println("crtGenerateImage entity = " + entity);
|
|
|
- crtGenerateImageDao.insert(entity);
|
|
|
- }
|
|
|
+
|
|
|
+ // 创建一个 CompletableFuture 来执行异步任务
|
|
|
+ CompletableFuture.runAsync(() -> {
|
|
|
+
|
|
|
+ Long drama_project_storyboard_id = Convert.toLong(params.get("drama_project_storyboard_id"));
|
|
|
+ String prompt_id = Convert.toStr(dataChildren.get("prompt_id"));
|
|
|
+ if (drama_project_storyboard_id != null) {
|
|
|
+ entity.setDrama_project_storyboard_id(drama_project_storyboard_id);
|
|
|
+ entity.setPrompt_id(prompt_id);
|
|
|
+ entity.setUrl_origin(filepath);
|
|
|
+ crtGenerateImageDao.insert(entity);
|
|
|
+ }
|
|
|
+
|
|
|
+ });
|
|
|
+
|
|
|
}
|
|
|
// ------------------------------------------------------
|
|
|
|