|
@@ -4,7 +4,6 @@ import cn.hutool.core.convert.Convert;
|
|
import cn.hutool.json.JSONObject;
|
|
import cn.hutool.json.JSONObject;
|
|
import cn.hutool.json.JSONUtil;
|
|
import cn.hutool.json.JSONUtil;
|
|
import com.backendsys.exception.CustException;
|
|
import com.backendsys.exception.CustException;
|
|
-import com.backendsys.modules.common.utils.Result;
|
|
|
|
import com.backendsys.modules.crt.dao.CrtDramaProjectStoryboardDao;
|
|
import com.backendsys.modules.crt.dao.CrtDramaProjectStoryboardDao;
|
|
import com.backendsys.modules.crt.entity.CrtDramaProjectStoryboard;
|
|
import com.backendsys.modules.crt.entity.CrtDramaProjectStoryboard;
|
|
import com.backendsys.modules.crt.service.CrtGenerateService;
|
|
import com.backendsys.modules.crt.service.CrtGenerateService;
|
|
@@ -13,7 +12,6 @@ import com.backendsys.modules.sdk.comfyui.entity.CFQueue;
|
|
import com.backendsys.modules.sdk.comfyui.service.ComfyUIService;
|
|
import com.backendsys.modules.sdk.comfyui.service.ComfyUIService;
|
|
import com.backendsys.modules.sdk.comfyui.service.ComfyUISocketService;
|
|
import com.backendsys.modules.sdk.comfyui.service.ComfyUISocketService;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
-import org.springframework.beans.factory.annotation.Value;
|
|
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
import reactor.core.publisher.Mono;
|
|
import reactor.core.publisher.Mono;
|
|
|
|
|
|
@@ -52,8 +50,11 @@ public class CrtGenerateServiceImpl implements CrtGenerateService {
|
|
@Override
|
|
@Override
|
|
public Map<String, Object> generateImage(CrtDramaProjectStoryboard crtDramaProjectStoryboard) {
|
|
public Map<String, Object> generateImage(CrtDramaProjectStoryboard crtDramaProjectStoryboard) {
|
|
|
|
|
|
|
|
+ String text_to_image_prompt = crtDramaProjectStoryboard.getText_to_image_prompt();
|
|
Long drama_project_storyboard_id = crtDramaProjectStoryboard.getDrama_project_storyboard_id();
|
|
Long drama_project_storyboard_id = crtDramaProjectStoryboard.getDrama_project_storyboard_id();
|
|
|
|
|
|
|
|
+ System.out.println("(文生图提示词) text_to_image_prompt = " + text_to_image_prompt);
|
|
|
|
+
|
|
CrtDramaProjectStoryboard detail = crtDramaProjectStoryboardDao.selectById(drama_project_storyboard_id);
|
|
CrtDramaProjectStoryboard detail = crtDramaProjectStoryboardDao.selectById(drama_project_storyboard_id);
|
|
if (detail == null) throw new CustException("分镜不存在");
|
|
if (detail == null) throw new CustException("分镜不存在");
|
|
|
|
|
|
@@ -61,7 +62,7 @@ public class CrtGenerateServiceImpl implements CrtGenerateService {
|
|
String client_id = Convert.toStr(UUID.randomUUID());
|
|
String client_id = Convert.toStr(UUID.randomUUID());
|
|
|
|
|
|
// -- [ComfyUI] 创建 WebSocket 监听连接 --------------------------
|
|
// -- [ComfyUI] 创建 WebSocket 监听连接 --------------------------
|
|
- comfyUISocketService.connectToSse(client_id, 8001).subscribe();
|
|
|
|
|
|
+ comfyUISocketService.connectToSse(client_id, 8000).subscribe();
|
|
|
|
|
|
// -------------------------------------------------------------
|
|
// -------------------------------------------------------------
|
|
// [ComfyUI-基础生图]
|
|
// [ComfyUI-基础生图]
|
|
@@ -149,7 +150,11 @@ public class CrtGenerateServiceImpl implements CrtGenerateService {
|
|
" false,"+
|
|
" false,"+
|
|
" true"+
|
|
" true"+
|
|
" ]"+
|
|
" ]"+
|
|
- " }"+
|
|
|
|
|
|
+ " },"+
|
|
|
|
+ " \"clip\": ["+
|
|
|
|
+ " \"151\","+
|
|
|
|
+ " 1"+
|
|
|
|
+ " ]"+
|
|
" },"+
|
|
" },"+
|
|
" \"class_type\": \"CLIPTextEncode\","+
|
|
" \"class_type\": \"CLIPTextEncode\","+
|
|
" \"_meta\": {"+
|
|
" \"_meta\": {"+
|
|
@@ -171,6 +176,10 @@ public class CrtGenerateServiceImpl implements CrtGenerateService {
|
|
" },"+
|
|
" },"+
|
|
" \"15\": {"+
|
|
" \"15\": {"+
|
|
" \"inputs\": {"+
|
|
" \"inputs\": {"+
|
|
|
|
+ " \"model\": ["+
|
|
|
|
+ " \"152\","+
|
|
|
|
+ " 0"+
|
|
|
|
+ " ],"+
|
|
" \"conditioning\": ["+
|
|
" \"conditioning\": ["+
|
|
" \"13\","+
|
|
" \"13\","+
|
|
" 0"+
|
|
" 0"+
|
|
@@ -181,62 +190,15 @@ public class CrtGenerateServiceImpl implements CrtGenerateService {
|
|
" \"title\": \"基本引导器\""+
|
|
" \"title\": \"基本引导器\""+
|
|
" }"+
|
|
" }"+
|
|
" },"+
|
|
" },"+
|
|
- " \"20\": {"+
|
|
|
|
- " \"inputs\": {"+
|
|
|
|
- " \"text\": \"ng_deepnegative_v1_75t,(badhandv4:1.2),EasyNegative,(worst quality:2),\","+
|
|
|
|
- " \"speak_and_recognation\": {"+
|
|
|
|
- " \"__value__\": ["+
|
|
|
|
- " false,"+
|
|
|
|
- " true"+
|
|
|
|
- " ]"+
|
|
|
|
- " }"+
|
|
|
|
- " },"+
|
|
|
|
- " \"class_type\": \"CLIPTextEncode\","+
|
|
|
|
- " \"_meta\": {"+
|
|
|
|
- " \"title\": \"CLIP文本编码\""+
|
|
|
|
- " }"+
|
|
|
|
- " },"+
|
|
|
|
- " \"21\": {"+
|
|
|
|
- " \"inputs\": {"+
|
|
|
|
- " \"VAE\": ["+
|
|
|
|
- " \"151\","+
|
|
|
|
- " 2"+
|
|
|
|
- " ]"+
|
|
|
|
- " },"+
|
|
|
|
- " \"class_type\": \"Anything Everywhere\","+
|
|
|
|
- " \"_meta\": {"+
|
|
|
|
- " \"title\": \"Anything Everywhere\""+
|
|
|
|
- " }"+
|
|
|
|
- " },"+
|
|
|
|
- " \"29\": {"+
|
|
|
|
- " \"inputs\": {"+
|
|
|
|
- " \"LATENT\": ["+
|
|
|
|
- " \"90\","+
|
|
|
|
- " 0"+
|
|
|
|
- " ]"+
|
|
|
|
- " },"+
|
|
|
|
- " \"class_type\": \"Anything Everywhere\","+
|
|
|
|
- " \"_meta\": {"+
|
|
|
|
- " \"title\": \"Anything Everywhere\""+
|
|
|
|
- " }"+
|
|
|
|
- " },"+
|
|
|
|
- " \"30\": {"+
|
|
|
|
- " \"inputs\": {"+
|
|
|
|
- " \"NOISE\": ["+
|
|
|
|
- " \"37\","+
|
|
|
|
- " 0"+
|
|
|
|
- " ]"+
|
|
|
|
- " },"+
|
|
|
|
- " \"class_type\": \"Anything Everywhere\","+
|
|
|
|
- " \"_meta\": {"+
|
|
|
|
- " \"title\": \"Anything Everywhere\""+
|
|
|
|
- " }"+
|
|
|
|
- " },"+
|
|
|
|
" \"31\": {"+
|
|
" \"31\": {"+
|
|
" \"inputs\": {"+
|
|
" \"inputs\": {"+
|
|
" \"samples\": ["+
|
|
" \"samples\": ["+
|
|
" \"32\","+
|
|
" \"32\","+
|
|
" 0"+
|
|
" 0"+
|
|
|
|
+ " ],"+
|
|
|
|
+ " \"vae\": ["+
|
|
|
|
+ " \"151\","+
|
|
|
|
+ " 2"+
|
|
" ]"+
|
|
" ]"+
|
|
" },"+
|
|
" },"+
|
|
" \"class_type\": \"VAEDecode\","+
|
|
" \"class_type\": \"VAEDecode\","+
|
|
@@ -246,31 +208,35 @@ public class CrtGenerateServiceImpl implements CrtGenerateService {
|
|
" },"+
|
|
" },"+
|
|
" \"32\": {"+
|
|
" \"32\": {"+
|
|
" \"inputs\": {"+
|
|
" \"inputs\": {"+
|
|
|
|
+ " \"noise\": ["+
|
|
|
|
+ " \"37\","+
|
|
|
|
+ " 0"+
|
|
|
|
+ " ],"+
|
|
" \"guider\": ["+
|
|
" \"guider\": ["+
|
|
" \"15\","+
|
|
" \"15\","+
|
|
" 0"+
|
|
" 0"+
|
|
- " ]"+
|
|
|
|
- " },"+
|
|
|
|
- " \"class_type\": \"SamplerCustomAdvanced\","+
|
|
|
|
- " \"_meta\": {"+
|
|
|
|
- " \"title\": \"自定义采样器(高级)\""+
|
|
|
|
- " }"+
|
|
|
|
- " },"+
|
|
|
|
- " \"34\": {"+
|
|
|
|
- " \"inputs\": {"+
|
|
|
|
- " \"SIGMAS\": ["+
|
|
|
|
|
|
+ " ],"+
|
|
|
|
+ " \"sampler\": ["+
|
|
|
|
+ " \"84\","+
|
|
|
|
+ " 0"+
|
|
|
|
+ " ],"+
|
|
|
|
+ " \"sigmas\": ["+
|
|
" \"150\","+
|
|
" \"150\","+
|
|
" 0"+
|
|
" 0"+
|
|
|
|
+ " ],"+
|
|
|
|
+ " \"latent_image\": ["+
|
|
|
|
+ " \"90\","+
|
|
|
|
+ " 0"+
|
|
" ]"+
|
|
" ]"+
|
|
" },"+
|
|
" },"+
|
|
- " \"class_type\": \"Anything Everywhere\","+
|
|
|
|
|
|
+ " \"class_type\": \"SamplerCustomAdvanced\","+
|
|
" \"_meta\": {"+
|
|
" \"_meta\": {"+
|
|
- " \"title\": \"Anything Everywhere\""+
|
|
|
|
|
|
+ " \"title\": \"自定义采样器(高级)\""+
|
|
" }"+
|
|
" }"+
|
|
" },"+
|
|
" },"+
|
|
" \"37\": {"+
|
|
" \"37\": {"+
|
|
" \"inputs\": {"+
|
|
" \"inputs\": {"+
|
|
- " \"noise_seed\": 861118998334462"+
|
|
|
|
|
|
+ " \"noise_seed\": 229229841277714"+
|
|
" },"+
|
|
" },"+
|
|
" \"class_type\": \"RandomNoise\","+
|
|
" \"class_type\": \"RandomNoise\","+
|
|
" \"_meta\": {"+
|
|
" \"_meta\": {"+
|
|
@@ -294,7 +260,7 @@ public class CrtGenerateServiceImpl implements CrtGenerateService {
|
|
" },"+
|
|
" },"+
|
|
" \"51\": {"+
|
|
" \"51\": {"+
|
|
" \"inputs\": {"+
|
|
" \"inputs\": {"+
|
|
- " \"text\": \"分镜1\","+
|
|
|
|
|
|
+ " \"text\": \"fenjing_" + drama_project_storyboard_id + "\","+
|
|
" \"speak_and_recognation\": {"+
|
|
" \"speak_and_recognation\": {"+
|
|
" \"__value__\": ["+
|
|
" \"__value__\": ["+
|
|
" false,"+
|
|
" false,"+
|
|
@@ -307,25 +273,6 @@ public class CrtGenerateServiceImpl implements CrtGenerateService {
|
|
" \"title\": \"分镜号\""+
|
|
" \"title\": \"分镜号\""+
|
|
" }"+
|
|
" }"+
|
|
" },"+
|
|
" },"+
|
|
- " \"76\": {"+
|
|
|
|
- " \"inputs\": {},"+
|
|
|
|
- " \"class_type\": \"Anything Everywhere\","+
|
|
|
|
- " \"_meta\": {"+
|
|
|
|
- " \"title\": \"Anything Everywhere\""+
|
|
|
|
- " }"+
|
|
|
|
- " },"+
|
|
|
|
- " \"80\": {"+
|
|
|
|
- " \"inputs\": {"+
|
|
|
|
- " \"SAMPLER\": ["+
|
|
|
|
- " \"84\","+
|
|
|
|
- " 0"+
|
|
|
|
- " ]"+
|
|
|
|
- " },"+
|
|
|
|
- " \"class_type\": \"Anything Everywhere\","+
|
|
|
|
- " \"_meta\": {"+
|
|
|
|
- " \"title\": \"Anything Everywhere\""+
|
|
|
|
- " }"+
|
|
|
|
- " },"+
|
|
|
|
" \"84\": {"+
|
|
" \"84\": {"+
|
|
" \"inputs\": {"+
|
|
" \"inputs\": {"+
|
|
" \"sampler_name\": \"euler\""+
|
|
" \"sampler_name\": \"euler\""+
|
|
@@ -370,7 +317,7 @@ public class CrtGenerateServiceImpl implements CrtGenerateService {
|
|
" },"+
|
|
" },"+
|
|
" \"120\": {"+
|
|
" \"120\": {"+
|
|
" \"inputs\": {"+
|
|
" \"inputs\": {"+
|
|
- " \"text_0\": \", Just cat\","+
|
|
|
|
|
|
+ " \"text_0\": \", a pig\","+
|
|
" \"text\": ["+
|
|
" \"text\": ["+
|
|
" \"148\","+
|
|
" \"148\","+
|
|
" 0"+
|
|
" 0"+
|
|
@@ -401,7 +348,7 @@ public class CrtGenerateServiceImpl implements CrtGenerateService {
|
|
" },"+
|
|
" },"+
|
|
" \"146\": {"+
|
|
" \"146\": {"+
|
|
" \"inputs\": {"+
|
|
" \"inputs\": {"+
|
|
- " \"from_translate\": \"japanese\","+
|
|
|
|
|
|
+ " \"from_translate\": \"auto\","+
|
|
" \"to_translate\": \"english\","+
|
|
" \"to_translate\": \"english\","+
|
|
" \"add_proxies\": false,"+
|
|
" \"add_proxies\": false,"+
|
|
" \"proxies\": \"\","+
|
|
" \"proxies\": \"\","+
|
|
@@ -442,23 +389,15 @@ public class CrtGenerateServiceImpl implements CrtGenerateService {
|
|
" \"title\": \"Join Strings\""+
|
|
" \"title\": \"Join Strings\""+
|
|
" }"+
|
|
" }"+
|
|
" },"+
|
|
" },"+
|
|
- " \"149\": {"+
|
|
|
|
- " \"inputs\": {"+
|
|
|
|
- " \"CLIP\": ["+
|
|
|
|
- " \"151\","+
|
|
|
|
- " 1"+
|
|
|
|
- " ]"+
|
|
|
|
- " },"+
|
|
|
|
- " \"class_type\": \"Anything Everywhere\","+
|
|
|
|
- " \"_meta\": {"+
|
|
|
|
- " \"title\": \"Anything Everywhere\""+
|
|
|
|
- " }"+
|
|
|
|
- " },"+
|
|
|
|
" \"150\": {"+
|
|
" \"150\": {"+
|
|
" \"inputs\": {"+
|
|
" \"inputs\": {"+
|
|
" \"scheduler\": \"normal\","+
|
|
" \"scheduler\": \"normal\","+
|
|
" \"steps\": 25,"+
|
|
" \"steps\": 25,"+
|
|
- " \"denoise\": 1"+
|
|
|
|
|
|
+ " \"denoise\": 1,"+
|
|
|
|
+ " \"model\": ["+
|
|
|
|
+ " \"152\","+
|
|
|
|
+ " 0"+
|
|
|
|
+ " ]"+
|
|
" },"+
|
|
" },"+
|
|
" \"class_type\": \"BasicScheduler\","+
|
|
" \"class_type\": \"BasicScheduler\","+
|
|
" \"_meta\": {"+
|
|
" \"_meta\": {"+
|
|
@@ -490,7 +429,7 @@ public class CrtGenerateServiceImpl implements CrtGenerateService {
|
|
" },"+
|
|
" },"+
|
|
" \"153\": {"+
|
|
" \"153\": {"+
|
|
" \"inputs\": {"+
|
|
" \"inputs\": {"+
|
|
- " \"text\": \"一只猫\","+
|
|
|
|
|
|
+ " \"text\": \"" + text_to_image_prompt + "\","+
|
|
" \"speak_and_recognation\": {"+
|
|
" \"speak_and_recognation\": {"+
|
|
" \"__value__\": ["+
|
|
" \"__value__\": ["+
|
|
" false,"+
|
|
" false,"+
|