|
@@ -17,8 +17,10 @@ import com.backendsys.modules.crt.enums.SamplerEnums;
|
|
|
import com.backendsys.modules.crt.service.CrtGenerateService;
|
|
|
import com.backendsys.modules.sdk.comfyui.entity.CFPromptResponse;
|
|
|
import com.backendsys.modules.sdk.comfyui.entity.CFQueue;
|
|
|
+import com.backendsys.modules.sdk.comfyui.entity.Text2Image;
|
|
|
import com.backendsys.modules.sdk.comfyui.service.ComfyUIService;
|
|
|
import com.backendsys.modules.sdk.comfyui.service.ComfyUISocketService;
|
|
|
+import com.backendsys.modules.sdk.comfyui.service.Text2ImageService;
|
|
|
import com.backendsys.modules.upload.enums.StyleEnums;
|
|
|
import com.backendsys.modules.upload.utils.UploadUtil;
|
|
|
import com.backendsys.utils.response.PageEntity;
|
|
@@ -43,6 +45,9 @@ public class CrtGenerateServiceImpl implements CrtGenerateService {
|
|
|
@Autowired
|
|
|
private ComfyUISocketService comfyUISocketService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private Text2ImageService text2ImageService;
|
|
|
+
|
|
|
@Autowired
|
|
|
private CrtModelDao crtModelDao;
|
|
|
@Autowired
|
|
@@ -78,14 +83,14 @@ public class CrtGenerateServiceImpl implements CrtGenerateService {
|
|
|
|
|
|
CrtDramaProjectStoryboard storyboardDetail = crtDramaProjectStoryboardDao.selectById(drama_project_storyboard_id);
|
|
|
if (storyboardDetail == null) throw new CustException("分镜不存在");
|
|
|
- System.out.println("分镜详情: " + JSONUtil.toJsonStr(storyboardDetail));
|
|
|
+ System.out.println("- 分镜详情: " + JSONUtil.toJsonStr(storyboardDetail));
|
|
|
|
|
|
Long drama_project_id = storyboardDetail.getDrama_project_id();
|
|
|
LambdaQueryWrapper<CrtDramaProjectSettings> wrapperSettings = new LambdaQueryWrapper<>();
|
|
|
wrapperSettings.eq(CrtDramaProjectSettings::getDrama_project_id, drama_project_id);
|
|
|
List<CrtDramaProjectSettings> settingsDetail = crtDramaProjectSettingsDao.selectList(wrapperSettings);
|
|
|
if (settingsDetail == null) throw new CustException("项目配置不存在");
|
|
|
- System.out.println("项目配置: " + JSONUtil.toJsonStr(settingsDetail));
|
|
|
+ System.out.println("- 项目配置: " + JSONUtil.toJsonStr(settingsDetail));
|
|
|
|
|
|
// 项目配置类型 (1:生图配置, 2:生视频配置)
|
|
|
CrtDramaProjectSettings settings_image = settingsDetail.stream().filter(item -> item.getDrama_project_setting_type() == 1).findFirst().orElse(null);
|
|
@@ -95,35 +100,35 @@ public class CrtGenerateServiceImpl implements CrtGenerateService {
|
|
|
|
|
|
// 用于更新的参数实体类
|
|
|
CrtDramaProjectStoryboard entity = new CrtDramaProjectStoryboard();
|
|
|
- LambdaQueryWrapper<CrtDramaProjectStoryboard> wrapper = new LambdaQueryWrapper<>();
|
|
|
- wrapper.eq(CrtDramaProjectStoryboard::getId, drama_project_storyboard_id);
|
|
|
|
|
|
|
|
|
|
|
|
// 文生图提示词
|
|
|
- String text_to_image_prompt = crtDramaProjectStoryboard.getText_to_image_prompt();
|
|
|
- // [更新] 文生图提示词
|
|
|
- entity.setText_to_image_prompt(text_to_image_prompt);
|
|
|
+ String prompt_text = crtDramaProjectStoryboard.getText_to_image_prompt();
|
|
|
+
|
|
|
|
|
|
// == 从 storboard detail 获取参数 =============================================================================
|
|
|
Integer param_batch_size = storyboardDetail.getParam_batch_size(); // 生成图片数量
|
|
|
Float param_prompt_flux_guidance = storyboardDetail.getParam_prompt_flux_guidance(); // 提示词引导系数
|
|
|
String param_sampler = SamplerEnums.getValueByKey(storyboardDetail.getParam_sampler()); // 采样器
|
|
|
- Integer param_step = storyboardDetail.getParam_step();
|
|
|
+ Integer param_step = storyboardDetail.getParam_step(); // 步数
|
|
|
|
|
|
// 随机种子 (默认值:1,范围:(1:随机, 2:自定义))
|
|
|
- Integer param_seed = storyboardDetail.getParam_seed();
|
|
|
- String param_seed_custom = storyboardDetail.getParam_seed_custom();
|
|
|
- if (param_seed == 1) {
|
|
|
- param_seed_custom = Convert.toStr(DateUtil.current()); // 生成一个随机值 (毫秒时间戳)
|
|
|
- // [更新] 种子值
|
|
|
- entity.setParam_seed_custom(param_seed_custom);
|
|
|
- }
|
|
|
+ Integer param_seed_type = storyboardDetail.getParam_seed_type();
|
|
|
+ String param_seed = (param_seed_type == 1) ?
|
|
|
+ Convert.toStr(DateUtil.current()) :
|
|
|
+ storyboardDetail.getParam_seed();
|
|
|
|
|
|
- // [db] 更新分集记录
|
|
|
- crtDramaProjectStoryboardDao.update(entity, wrapper);
|
|
|
+ entity.setParam_seed(param_seed);
|
|
|
+ entity.setText_to_image_prompt(prompt_text);
|
|
|
|
|
|
+ // [db] 更新分集记录 (种子值、提示词)
|
|
|
+ LambdaQueryWrapper<CrtDramaProjectStoryboard> wrapper = new LambdaQueryWrapper<>();
|
|
|
+ wrapper.eq(CrtDramaProjectStoryboard::getId, drama_project_storyboard_id);
|
|
|
+ crtDramaProjectStoryboardDao.update(entity, wrapper);
|
|
|
|
|
|
+ Integer width = 1280;
|
|
|
+ Integer height = 720;
|
|
|
|
|
|
// [db] 获取基础模型 (从项目配置)
|
|
|
Long model_id = settings_image.getModel_id();
|
|
@@ -135,9 +140,6 @@ public class CrtGenerateServiceImpl implements CrtGenerateService {
|
|
|
|
|
|
// ===========================================================================================================
|
|
|
|
|
|
-
|
|
|
-
|
|
|
- // -- 前端生成的UUID ---------------------------------------------
|
|
|
String client_id = Convert.toStr(UUID.randomUUID());
|
|
|
|
|
|
// -- [ComfyUI] 创建 WebSocket 监听连接 --------------------------
|
|
@@ -145,403 +147,22 @@ public class CrtGenerateServiceImpl implements CrtGenerateService {
|
|
|
params.put("drama_project_storyboard_id", drama_project_storyboard_id);
|
|
|
comfyUISocketService.connectToSse(client_id, 8000, params).subscribe();
|
|
|
|
|
|
- // -------------------------------------------------------------
|
|
|
- // [ComfyUI-基础生图]
|
|
|
-// String prompt = "{" +
|
|
|
-// "\"3\": {" +
|
|
|
-// "\"inputs\": {" +
|
|
|
-// "\"seed\": 449753344472378," +
|
|
|
-// "\"steps\": 20," +
|
|
|
-// "\"cfg\": 8," +
|
|
|
-// "\"sampler_name\": \"euler\"," +
|
|
|
-// "\"scheduler\": \"normal\"," +
|
|
|
-// "\"denoise\": 1," +
|
|
|
-// "\"model\": [\"4\", 0]," +
|
|
|
-// "\"positive\": [\"6\", 0]," +
|
|
|
-// "\"negative\": [\"7\", 0]," +
|
|
|
-// "\"latent_image\": [\"5\", 0]" +
|
|
|
-// "}," +
|
|
|
-// "\"class_type\": \"KSampler\"," +
|
|
|
-// "\"_meta\": { \"title\": \"K采样器\" }" +
|
|
|
-// "}," +
|
|
|
-// "\"4\": {" +
|
|
|
-// "\"inputs\": {" +
|
|
|
-// "\"ckpt_name\": \"v1-5-pruned-emaonly-fp16.safetensors\"" +
|
|
|
-// "}," +
|
|
|
-// "\"class_type\": \"CheckpointLoaderSimple\"," +
|
|
|
-// "\"_meta\": { \"title\": \"Checkpoint加载器(简易)\" }" +
|
|
|
-// "}," +
|
|
|
-// "\"5\": {" +
|
|
|
-// "\"inputs\": {" +
|
|
|
-// "\"width\": 512, \"height\": 512, \"batch_size\": 1" +
|
|
|
-// "}," +
|
|
|
-// "\"class_type\": \"EmptyLatentImage\"," +
|
|
|
-// "\"_meta\": { \"title\": \"空Latent图像\" }" +
|
|
|
-// "}," +
|
|
|
-// "\"6\": {" +
|
|
|
-// "\"inputs\": {" +
|
|
|
-// "\"text\": \"beautiful scenery nature glass bottle landscape, , purple galaxy bottle,\"," +
|
|
|
-// "\"speak_and_recognation\": {" +
|
|
|
-// "\"__value__\": [false, true]" +
|
|
|
-// "}," +
|
|
|
-// "\"clip\": [\"4\", 1]" +
|
|
|
-// "}," +
|
|
|
-// "\"class_type\": \"CLIPTextEncode\"," +
|
|
|
-// "\"_meta\": { \"title\": \"CLIP文本编码\" }" +
|
|
|
-// "}," +
|
|
|
-// "\"7\": {" +
|
|
|
-// "\"inputs\": {" +
|
|
|
-// "\"text\": \"text, watermark\"," +
|
|
|
-// "\"speak_and_recognation\": {" +
|
|
|
-// "\"__value__\": [false, true]" +
|
|
|
-// "}," +
|
|
|
-// "\"clip\": [\"4\", 1]" +
|
|
|
-// "}," +
|
|
|
-// "\"class_type\": \"CLIPTextEncode\"," +
|
|
|
-// "\"_meta\": { \"title\": \"CLIP文本编码\" }" +
|
|
|
-// "}," +
|
|
|
-// "\"8\": {" +
|
|
|
-// "\"inputs\": {" +
|
|
|
-// "\"samples\": [\"3\", 0]," +
|
|
|
-// "\"vae\": [\"4\", 2]," +
|
|
|
-// "}," +
|
|
|
-// "\"class_type\": \"VAEDecode\"," +
|
|
|
-// "\"_meta\": { \"title\": \"VAE解码\" }" +
|
|
|
-// "}," +
|
|
|
-// "\"9\": {" +
|
|
|
-// "\"inputs\": {" +
|
|
|
-// "\"filename_prefix\": \"ComfyUI\"," +
|
|
|
-// "\"images\": [\"8\", 0]" +
|
|
|
-// "}," +
|
|
|
-// "\"class_type\": \"SaveImage\"," +
|
|
|
-// "\"_meta\": { \"title\": \"保存图像\" }" +
|
|
|
-// "}," +
|
|
|
-// "}";
|
|
|
-
|
|
|
- // ComfyUI - 7.4生图.json
|
|
|
- String prompt = "{"+
|
|
|
- " \"3\": {"+
|
|
|
- " \"inputs\": {"+
|
|
|
- " \"text\": ["+
|
|
|
- " \"120\","+
|
|
|
- " 0"+
|
|
|
- " ],"+
|
|
|
- " \"speak_and_recognation\": {"+
|
|
|
- " \"__value__\": ["+
|
|
|
- " false,"+
|
|
|
- " true"+
|
|
|
- " ]"+
|
|
|
- " },"+
|
|
|
- " \"clip\": ["+
|
|
|
- " \"151\","+
|
|
|
- " 1"+
|
|
|
- " ]"+
|
|
|
- " },"+
|
|
|
- " \"class_type\": \"CLIPTextEncode\","+
|
|
|
- " \"_meta\": {"+
|
|
|
- " \"title\": \"CLIP文本编码\""+
|
|
|
- " }"+
|
|
|
- " },"+
|
|
|
- " \"13\": {"+
|
|
|
- " \"inputs\": {"+
|
|
|
- " \"guidance\": " + param_prompt_flux_guidance + ","+
|
|
|
- " \"conditioning\": ["+
|
|
|
- " \"3\","+
|
|
|
- " 0"+
|
|
|
- " ]"+
|
|
|
- " },"+
|
|
|
- " \"class_type\": \"FluxGuidance\","+
|
|
|
- " \"_meta\": {"+
|
|
|
- " \"title\": \"Flux引导\""+
|
|
|
- " }"+
|
|
|
- " },"+
|
|
|
- " \"15\": {"+
|
|
|
- " \"inputs\": {"+
|
|
|
- " \"model\": ["+
|
|
|
- " \"152\","+
|
|
|
- " 0"+
|
|
|
- " ],"+
|
|
|
- " \"conditioning\": ["+
|
|
|
- " \"13\","+
|
|
|
- " 0"+
|
|
|
- " ]"+
|
|
|
- " },"+
|
|
|
- " \"class_type\": \"BasicGuider\","+
|
|
|
- " \"_meta\": {"+
|
|
|
- " \"title\": \"基本引导器\""+
|
|
|
- " }"+
|
|
|
- " },"+
|
|
|
- " \"31\": {"+
|
|
|
- " \"inputs\": {"+
|
|
|
- " \"samples\": ["+
|
|
|
- " \"32\","+
|
|
|
- " 0"+
|
|
|
- " ],"+
|
|
|
- " \"vae\": ["+
|
|
|
- " \"151\","+
|
|
|
- " 2"+
|
|
|
- " ]"+
|
|
|
- " },"+
|
|
|
- " \"class_type\": \"VAEDecode\","+
|
|
|
- " \"_meta\": {"+
|
|
|
- " \"title\": \"VAE解码\""+
|
|
|
- " }"+
|
|
|
- " },"+
|
|
|
- " \"32\": {"+
|
|
|
- " \"inputs\": {"+
|
|
|
- " \"noise\": ["+
|
|
|
- " \"37\","+
|
|
|
- " 0"+
|
|
|
- " ],"+
|
|
|
- " \"guider\": ["+
|
|
|
- " \"15\","+
|
|
|
- " 0"+
|
|
|
- " ],"+
|
|
|
- " \"sampler\": ["+
|
|
|
- " \"84\","+
|
|
|
- " 0"+
|
|
|
- " ],"+
|
|
|
- " \"sigmas\": ["+
|
|
|
- " \"150\","+
|
|
|
- " 0"+
|
|
|
- " ],"+
|
|
|
- " \"latent_image\": ["+
|
|
|
- " \"90\","+
|
|
|
- " 0"+
|
|
|
- " ]"+
|
|
|
- " },"+
|
|
|
- " \"class_type\": \"SamplerCustomAdvanced\","+
|
|
|
- " \"_meta\": {"+
|
|
|
- " \"title\": \"自定义采样器(高级)\""+
|
|
|
- " }"+
|
|
|
- " },"+
|
|
|
- " \"37\": {"+
|
|
|
- " \"inputs\": {"+
|
|
|
- " \"noise_seed\": " + param_seed_custom +
|
|
|
- " },"+
|
|
|
- " \"class_type\": \"RandomNoise\","+
|
|
|
- " \"_meta\": {"+
|
|
|
- " \"title\": \"随机噪波\""+
|
|
|
- " }"+
|
|
|
- " },"+
|
|
|
- " \"38\": {"+
|
|
|
- " \"inputs\": {"+
|
|
|
- " \"text\": \"\","+
|
|
|
- " \"speak_and_recognation\": {"+
|
|
|
- " \"__value__\": ["+
|
|
|
- " false,"+
|
|
|
- " true"+
|
|
|
- " ]"+
|
|
|
- " }"+
|
|
|
- " },"+
|
|
|
- " \"class_type\": \"TextInput_\","+
|
|
|
- " \"_meta\": {"+
|
|
|
- " \"title\": \"触发词\""+
|
|
|
- " }"+
|
|
|
- " },"+
|
|
|
- " \"51\": {"+
|
|
|
- " \"inputs\": {"+
|
|
|
- " \"text\": \"fenjing_" + drama_project_storyboard_id + "\","+
|
|
|
- " \"speak_and_recognation\": {"+
|
|
|
- " \"__value__\": ["+
|
|
|
- " false,"+
|
|
|
- " true"+
|
|
|
- " ]"+
|
|
|
- " }"+
|
|
|
- " },"+
|
|
|
- " \"class_type\": \"TextInput_\","+
|
|
|
- " \"_meta\": {"+
|
|
|
- " \"title\": \"分镜号\""+
|
|
|
- " }"+
|
|
|
- " },"+
|
|
|
- " \"84\": {"+
|
|
|
- " \"inputs\": {"+
|
|
|
- " \"sampler_name\": \"" + param_sampler + "\""+
|
|
|
- " },"+
|
|
|
- " \"class_type\": \"KSamplerSelect\","+
|
|
|
- " \"_meta\": {"+
|
|
|
- " \"title\": \"K采样器选择\""+
|
|
|
- " }"+
|
|
|
- " },"+
|
|
|
- " \"90\": {"+
|
|
|
- " \"inputs\": {"+
|
|
|
- " \"width\": ["+
|
|
|
- " \"121\","+
|
|
|
- " 0"+
|
|
|
- " ],"+
|
|
|
- " \"height\": ["+
|
|
|
- " \"122\","+
|
|
|
- " 0"+
|
|
|
- " ],"+
|
|
|
- " \"batch_size\": " + param_batch_size +
|
|
|
- " },"+
|
|
|
- " \"class_type\": \"EmptySD3LatentImage\","+
|
|
|
- " \"_meta\": {"+
|
|
|
- " \"title\": \"空Latent图像(SD3)\""+
|
|
|
- " }"+
|
|
|
- " },"+
|
|
|
- " \"91\": {"+
|
|
|
- " \"inputs\": {"+
|
|
|
- " \"filename_prefix\": ["+
|
|
|
- " \"51\","+
|
|
|
- " 0"+
|
|
|
- " ],"+
|
|
|
- " \"images\": ["+
|
|
|
- " \"31\","+
|
|
|
- " 0"+
|
|
|
- " ]"+
|
|
|
- " },"+
|
|
|
- " \"class_type\": \"SaveImage\","+
|
|
|
- " \"_meta\": {"+
|
|
|
- " \"title\": \"保存图像\""+
|
|
|
- " }"+
|
|
|
- " },"+
|
|
|
- " \"120\": {"+
|
|
|
- " \"inputs\": {"+
|
|
|
- " \"text_0\": \", a pig\","+
|
|
|
- " \"text\": ["+
|
|
|
- " \"148\","+
|
|
|
- " 0"+
|
|
|
- " ]"+
|
|
|
- " },"+
|
|
|
- " \"class_type\": \"PandasShowText\","+
|
|
|
- " \"_meta\": {"+
|
|
|
- " \"title\": \"Pandas Show Text\""+
|
|
|
- " }"+
|
|
|
- " },"+
|
|
|
- " \"121\": {"+
|
|
|
- " \"inputs\": {"+
|
|
|
- " \"value\": 1280"+
|
|
|
- " },"+
|
|
|
- " \"class_type\": \"easy int\","+
|
|
|
- " \"_meta\": {"+
|
|
|
- " \"title\": \"整数\""+
|
|
|
- " }"+
|
|
|
- " },"+
|
|
|
- " \"122\": {"+
|
|
|
- " \"inputs\": {"+
|
|
|
- " \"value\": 720"+
|
|
|
- " },"+
|
|
|
- " \"class_type\": \"easy int\","+
|
|
|
- " \"_meta\": {"+
|
|
|
- " \"title\": \"整数\""+
|
|
|
- " }"+
|
|
|
- " },"+
|
|
|
- " \"146\": {"+
|
|
|
- " \"inputs\": {"+
|
|
|
- " \"from_translate\": \"auto\","+
|
|
|
- " \"to_translate\": \"english\","+
|
|
|
- " \"add_proxies\": false,"+
|
|
|
- " \"proxies\": \"\","+
|
|
|
- " \"auth_data\": \"\","+
|
|
|
- " \"service\": \"BaiduTranslator [appid and appkey]\","+
|
|
|
- " \"text\": ["+
|
|
|
- " \"153\","+
|
|
|
- " 0"+
|
|
|
- " ],"+
|
|
|
- " \"Show proxy\": \"proxy_hide\","+
|
|
|
- " \"Show authorization\": \"authorization_hide\","+
|
|
|
- " \"speak_and_recognation\": {"+
|
|
|
- " \"__value__\": ["+
|
|
|
- " false,"+
|
|
|
- " true"+
|
|
|
- " ]"+
|
|
|
- " }"+
|
|
|
- " },"+
|
|
|
- " \"class_type\": \"DeepTranslatorTextNode\","+
|
|
|
- " \"_meta\": {"+
|
|
|
- " \"title\": \"Deep Translator Text Node\""+
|
|
|
- " }"+
|
|
|
- " },"+
|
|
|
- " \"148\": {"+
|
|
|
- " \"inputs\": {"+
|
|
|
- " \"delimiter\": \", \","+
|
|
|
- " \"string1\": ["+
|
|
|
- " \"38\","+
|
|
|
- " 0"+
|
|
|
- " ],"+
|
|
|
- " \"string2\": ["+
|
|
|
- " \"146\","+
|
|
|
- " 0"+
|
|
|
- " ]"+
|
|
|
- " },"+
|
|
|
- " \"class_type\": \"JoinStrings\","+
|
|
|
- " \"_meta\": {"+
|
|
|
- " \"title\": \"Join Strings\""+
|
|
|
- " }"+
|
|
|
- " },"+
|
|
|
- " \"150\": {"+
|
|
|
- " \"inputs\": {"+
|
|
|
- " \"scheduler\": \"normal\","+
|
|
|
- " \"steps\": " + param_step + ","+
|
|
|
- " \"denoise\": 1,"+
|
|
|
- " \"model\": ["+
|
|
|
- " \"152\","+
|
|
|
- " 0"+
|
|
|
- " ]"+
|
|
|
- " },"+
|
|
|
- " \"class_type\": \"BasicScheduler\","+
|
|
|
- " \"_meta\": {"+
|
|
|
- " \"title\": \"基本调度器\""+
|
|
|
- " }"+
|
|
|
- " },"+
|
|
|
- " \"151\": {"+
|
|
|
- " \"inputs\": {"+
|
|
|
- " \"ckpt_name\": \"" + model_name + "\""+
|
|
|
- " },"+
|
|
|
- " \"class_type\": \"CheckpointLoaderSimple\","+
|
|
|
- " \"_meta\": {"+
|
|
|
- " \"title\": \"Checkpoint加载器(简易)\""+
|
|
|
- " }"+
|
|
|
- " },"+
|
|
|
- " \"152\": {"+
|
|
|
- " \"inputs\": {"+
|
|
|
- " \"lora_name\": \"【FLUX】都市高武推文 _ 异能 法术 战斗_v1.0.safetensors\","+
|
|
|
- " \"strength_model\": 0,"+
|
|
|
- " \"model\": ["+
|
|
|
- " \"151\","+
|
|
|
- " 0"+
|
|
|
- " ]"+
|
|
|
- " },"+
|
|
|
- " \"class_type\": \"LoraLoaderModelOnly\","+
|
|
|
- " \"_meta\": {"+
|
|
|
- " \"title\": \"LoRA加载器(仅模型)\""+
|
|
|
- " }"+
|
|
|
- " },"+
|
|
|
- " \"153\": {"+
|
|
|
- " \"inputs\": {"+
|
|
|
- " \"text\": \"" + text_to_image_prompt + "\","+
|
|
|
- " \"speak_and_recognation\": {"+
|
|
|
- " \"__value__\": ["+
|
|
|
- " false,"+
|
|
|
- " true"+
|
|
|
- " ]"+
|
|
|
- " }"+
|
|
|
- " },"+
|
|
|
- " \"class_type\": \"TextInput_\","+
|
|
|
- " \"_meta\": {"+
|
|
|
- " \"title\": \"Text Input ♾️Mixlab\""+
|
|
|
- " }"+
|
|
|
- " }"+
|
|
|
- "}"
|
|
|
- ;
|
|
|
-
|
|
|
- // -------------------------------------------------------------
|
|
|
-
|
|
|
- JSONObject prompt_object = JSONUtil.parseObj(prompt);
|
|
|
- System.out.println("prompt_object: " + prompt_object);
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- // 这里在点击生成的时候,就应该先创建一条占位数据,并给予 [生成状态],[任务原始JSON]
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- // [ComfyUI] 执行任务
|
|
|
- Mono<CFPromptResponse> cfPromptResponseMono = comfyUIService.prompt(client_id, prompt_object);
|
|
|
- CFPromptResponse response = cfPromptResponseMono.block();
|
|
|
- response.setClient_id(client_id);
|
|
|
+ // -- [ComfyUI] 生图参数 ----------------------------------------
|
|
|
+ Text2Image text2Image = new Text2Image();
|
|
|
+ text2Image.setBatch_size(param_batch_size);
|
|
|
+ text2Image.setPrompt_flux_guidance(param_prompt_flux_guidance);
|
|
|
+ text2Image.setSampler(param_sampler);
|
|
|
+ text2Image.setStep(param_step);
|
|
|
+// text2Image.setWidth(width);
|
|
|
+ text2Image.setWidth(400);
|
|
|
+// text2Image.setHeight(height);
|
|
|
+ text2Image.setHeight(200);
|
|
|
+ text2Image.setModel_name(model_name);
|
|
|
+ text2Image.setPrompt_text(prompt_text);
|
|
|
+ text2Image.setSeed(param_seed);
|
|
|
+
|
|
|
+ // -- [ComfyUI] 生图 --------------------------------------------
|
|
|
+ CFPromptResponse response = text2ImageService.generateText2Image(client_id, text2Image);
|
|
|
System.out.println("结果: " + response);
|
|
|
// 结果: CFPromptResponse(client_id=1a8a2d01-5500-437f-bb11-7a986130da48, prompt_id=c74501ed-6755-48f8-a440-aef3474b523c, number=47, node_errors={}, error=null)
|
|
|
|