From 44dbbb2a4b0e6b938fef907e40c2dc5fd88e1b7a Mon Sep 17 00:00:00 2001 From: litianxiang Date: Fri, 19 Dec 2025 15:47:07 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=8D=A2Moodboard=E5=92=8CPrintboard?= =?UTF-8?q?=E6=8F=90=E7=A4=BA=E8=AF=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../da/service/impl/GenerateServiceImpl.java | 55 +++++++++++++++---- 1 file changed, 43 insertions(+), 12 deletions(-) diff --git a/src/main/java/com/ai/da/service/impl/GenerateServiceImpl.java b/src/main/java/com/ai/da/service/impl/GenerateServiceImpl.java index f3fb058e..a3235f5c 100644 --- a/src/main/java/com/ai/da/service/impl/GenerateServiceImpl.java +++ b/src/main/java/com/ai/da/service/impl/GenerateServiceImpl.java @@ -1203,6 +1203,9 @@ public class GenerateServiceImpl extends ServiceImpl i * @param modelName advanced high normal */ private HashMap chooseModelAndPrompt(GenerateThroughImageTextDTO generateDTO, String modelName) { + if (StringUtil.isNullOrEmpty(modelName)){ + throw new BusinessException("system error"); + } HashMap modelAndPromptMap = new HashMap<>(); boolean isUseImage; if (Objects.isNull(generateDTO.getCollectionElementId()) @@ -1218,7 +1221,7 @@ public class GenerateServiceImpl extends ServiceImpl i String style = generateDTO.getText().substring(0, firstCommaIndex).trim(); String prompt = generateDTO.getText().substring(firstCommaIndex + 1).trim(); - prompt = getPrintboardPrompt(style, prompt); + prompt = getPrintboardPrompt(style, prompt,modelName); modelAndPromptMap.put(ModelConstants.PROMPT, prompt); @@ -1239,7 +1242,14 @@ public class GenerateServiceImpl extends ServiceImpl i } } else if (ModelConstants.MOODBOARD.equals(generateDTO.getLevel1Type())) { - String prompt = generateDTO.getText() + "high-resolution, ultra-detailed, realistic textures, perfect anatomy, cinematic lighting, 8k render, editorial photography style"; + String userInput = generateDTO.getText(); + String systemPrompt = "high-resolution, ultra-detailed, realistic textures, cinematic lighting, 8k render, editorial photography style"; + String prompt; + if (userInput == null || userInput.trim().isEmpty()) { + throw new BusinessException("prompt null"); + } else { + prompt = "Theme: " + userInput.trim() + "\nRequirement: " + systemPrompt; + } modelAndPromptMap.put(ModelConstants.PROMPT, prompt); if (ModelConstants.ADVANCED.equals(modelName)) { @@ -1560,19 +1570,40 @@ public class GenerateServiceImpl extends ServiceImpl i } - private String getPrintboardPrompt(String style, String prompt) { + private String getPrintboardPrompt(String style, String userInput, String modelName) { + String systemPrompt = null; + String prompt; + if ("Painting Style".equals(style)) { - prompt = "1.Requirements: Create a seamless, tiling fashion printboard pattern for apparel. The output must be stylish, contemporary, and suitable for real garment printing. Design pattern, seamless, highly detailed, elegant composition, visually balanced, professional textile print\n" + - "2.Core Theme: " + prompt + "\n" + - "3.Style: painting_style-The painting style refers to the overall approach, techniques, and artistic philosophy used in the artwork. For fashion designs that will be applied to printboards, it is important to define the unique stylistic elements that would translate well into wearable patterns."; + if (ModelConstants.ADVANCED.equals(modelName)) { + systemPrompt = "Tileable seamless pattern, elegant composition, visually balanced, Light watercolor, Giplie Studio (style) pattern with even color field background, high-quality digital print, zero perspective depth, harmonious visual balance, consistent color tone."; + } else if (ModelConstants.HIGH.equals(modelName)) { + systemPrompt = "Design pattern, seamless, highly detailed, elegant composition, visually balanced. \n" + + "Painting style: traditional painting, hand-painted, brush strokes."; + } } else if ("Illustration Style".equals(style)) { - prompt = "1.Requirements: Create a seamless, tiling fashion printboard pattern for apparel. The output must be stylish, contemporary, and suitable for real garment printing. Design pattern, seamless, highly detailed, elegant composition, visually balanced, professional textile print\n" + - "2.Core Theme: " + prompt + "\n" + - "3.Style: illustration_style-Illustration style focuses on the visual storytellingaspect, often used to depict narratives, characters, or thematic concepts. Forfashion, this style can introduce vivid and artistic interpretations, often aligned with specific themes."; + if (ModelConstants.ADVANCED.equals(modelName)) { + systemPrompt = "Tileable seamless pattern, elegant composition, visually balanced, flat graphic, clean lines pattern with even color field background, high-quality digital print, zero perspective depth, harmonious visual balance, consistent color tone. "; + } else if (ModelConstants.HIGH.equals(modelName)) { + systemPrompt = "Design pattern, seamless, highly detailed, elegant composition, visually balanced. \n" + + "Illustration Style: flat graphic, clean lines."; + } } else if ("Real Style".equals(style)) { - prompt = "1.Requirements: Create a seamless, tiling fashion printboard pattern for apparel. The output must be stylish, contemporary, and suitable for real garment printing. Design pattern, seamless, highly detailed, elegant composition, visually balanced, professional textile print\n" + - "2.Core Theme: " + prompt + "\n" + - "3.Style: real_style-Real style in fashion is all about authenticity. It featuresnatural fabrics, simple cuts that mirror real life silhouettes, and colors inspired bythe everyday world, exuding a down-to-earth and genuine charm."; + if (ModelConstants.ADVANCED.equals(modelName)) { + systemPrompt = "Tileable seamless pattern, even color field background, photorealistic style pattern, high-quality digital print, zero perspective depth, harmonious visual balance, consistent color tone. "; + } else if (ModelConstants.HIGH.equals(modelName)) { + systemPrompt = "Design pattern, seamless, highly detailed, elegant composition, visually balanced. \n" + + "Flat textile pattern printed directly on fabric surface, no three-dimensional objects, no items placed on cloth. \n" + + "Real style: fabric print, realistic woven/printed pattern, detailed surface pattern only"; + } + }else { + throw new BusinessException("style error:"+ style); + } + + if (userInput == null || userInput.trim().isEmpty()) { + throw new BusinessException("prompt null"); + } else { + prompt = "Theme: " + userInput.trim() + "\nRequirement: " + systemPrompt; } return prompt; }