From b6a068ebcdabf14678b9b166f5d371b5e4567ddf Mon Sep 17 00:00:00 2001 From: litianxiang Date: Mon, 23 Mar 2026 11:50:24 +0800 Subject: [PATCH] =?UTF-8?q?SKETCHBOARD=E4=BC=A0=E5=85=A5=E7=9A=84text?= =?UTF-8?q?=E6=94=B9=E4=B8=BA=E8=8E=B7=E5=8F=96=E7=AC=AC=E4=B8=80=E4=B8=AA?= =?UTF-8?q?,=E4=B8=BA=E5=88=86=E5=89=B2=E8=8E=B7=E5=8F=96style=E7=9A=84?= =?UTF-8?q?=E6=96=B9=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../da/service/impl/GenerateServiceImpl.java | 29 +++++++++++++++---- 1 file changed, 23 insertions(+), 6 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 4a40fa2b..30173584 100644 --- a/src/main/java/com/ai/da/service/impl/GenerateServiceImpl.java +++ b/src/main/java/com/ai/da/service/impl/GenerateServiceImpl.java @@ -1260,14 +1260,31 @@ public class GenerateServiceImpl extends ServiceImpl i modelAndPromptMap.put(ModelConstants.USE_MODEL, ModelConstants.LOCAL_MODEL); } } else if (ModelConstants.SKETCHBOARD.equals(generateDTO.getLevel1Type())) { - String[] split = generateDTO.getText().split(","); - String style = split[0].trim(); - if ("Lolita".equals( style)){ - style = "洛丽塔"; + String style = ""; + String userPrompt = ""; + // 找到第一个逗号的位置 + int firstCommaIndex = generateDTO.getText().indexOf(","); + if (firstCommaIndex != -1) { + // 截取第一个逗号前的内容作为style + style = generateDTO.getText().substring(0, firstCommaIndex).trim(); + // 截取第一个逗号后的所有内容作为userPrompt(去除首尾空格) + userPrompt = generateDTO.getText().substring(firstCommaIndex + 1).trim(); + + if ("Lolita".equals(style)) { + style = "洛丽塔"; + } + } else { + // 兼容无逗号的情况:style为空,全部内容作为userPrompt + userPrompt = generateDTO.getText().trim(); } - String userPrompt = split[1]; + String prompt = userPrompt + "rules:front view sketch only,plain white background, single garment only, orthographic, centered on white background, borderless canvas, thin monochrome black line art.\n" + - " No clothes hanger, no fake clothes hanger, no human-related lines, no color fill, no words, no text, no black background, no boundary or frame.sketch style:"+ style; + " No clothes hanger, no fake clothes hanger, no human-related lines, no color fill, no words, no text, no black background, no boundary or frame."; + + if (!style.trim().isEmpty() && !"all".equalsIgnoreCase(style)) { + prompt += ".sketch style:" + style.trim(); + } + modelAndPromptMap.put(ModelConstants.PROMPT, prompt); if (isUseImage) { if (ModelConstants.ADVANCED.equals(modelName)) {