当style为洛丽塔时无sketch和谷歌风控问题FIX

This commit is contained in:
litianxiang
2026-03-12 18:36:21 +08:00
parent fc72d2c430
commit 61b7f3072f
2 changed files with 65 additions and 49 deletions

View File

@@ -39,6 +39,7 @@ import org.springframework.util.StringUtils;
import org.springframework.web.multipart.MultipartFile;
import jakarta.annotation.Resource;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
@@ -406,6 +407,7 @@ public class PythonService {
// if (CollectionUtil.isEmpty(pinData)) {
// return 0;
// }
/// / long topNum = sketchBoardElements.stream()
/// / .filter(skecth -> skecth.getHasPin() == 1
/// / && DesignPythonItem.OUTWEAR_DRESS_BLOUSE.contains(skecth.getLevel2Type())).count();
@@ -681,7 +683,9 @@ public class PythonService {
// 其他所有情况,都回退到使用系统推荐
String categoryParam = elementVO.getModelSex().toLowerCase() + "_" + styleCategory.toLowerCase();
List<String> recommentdUrlList = getSystemSketchByCategory(categoryParam, elementVO.getBrandId(), elementVO.getBrandScale(), elementVO.getStyle());
if (recommentdUrlList.size() == 0) {
recommentdUrlList = getSystemSketchByCategory(categoryParam, elementVO.getBrandId(), elementVO.getBrandScale(), null);
}
if (CollectionUtils.isEmpty(recommentdUrlList)) {
throw new BusinessException("failed.to.obtain.system.sketch.recommendation");
}
@@ -3442,7 +3446,10 @@ public class PythonService {
return imageUrlList;
}*/
/** 废弃状态 */
/**
* 废弃状态
*/
public String composeLayers(List<OutfitDetailPythonItem> layersDetail) {
HashMap<String, List<OutfitDetailPythonItem>> layers = new HashMap<>();
HashMap<String, HashMap<String, List<OutfitDetailPythonItem>>> content = new HashMap<>();
@@ -4114,6 +4121,7 @@ public class PythonService {
//生成失败
throw new BusinessException("segProduct.interface.exception");
}
/**
* 转发 seg_anything 请求到 python 服务
* 请求 body 由调用方组装(包含 user_id, image_path, type, points, labels, box 等)
@@ -4185,6 +4193,7 @@ public class PythonService {
log.error("PythonService##segAnything异常response###{}", response);
throw new BusinessException("segAnything.interface.exception");
}
public Boolean poseTransformation(JSONObject content, String apiUri) {
OkHttpClient client = new OkHttpClient().newBuilder()
.connectTimeout(30, TimeUnit.SECONDS)
@@ -4391,7 +4400,8 @@ public class PythonService {
log.info("imageSegmentation 结果 {}", jsonObject.get("data").toString());
List<ImageSegmentation.ImageDate> seg = JSONObject.parseObject(
jsonObject.get("data").toString(),
new TypeReference<List<ImageSegmentation.ImageDate>>() {}
new TypeReference<List<ImageSegmentation.ImageDate>>() {
}
);
return seg;
} else {

View File

@@ -1260,8 +1260,14 @@ public class GenerateServiceImpl extends ServiceImpl<GenerateMapper, Generate> i
modelAndPromptMap.put(ModelConstants.USE_MODEL, ModelConstants.LOCAL_MODEL);
}
} else if (ModelConstants.SKETCHBOARD.equals(generateDTO.getLevel1Type())) {
String prompt = generateDTO.getText() + "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.";
String[] split = generateDTO.getText().split(",");
String style = split[0].trim();
if ("Lolita".equals( style)){
style = "洛丽塔";
}
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;
modelAndPromptMap.put(ModelConstants.PROMPT, prompt);
if (isUseImage) {
if (ModelConstants.ADVANCED.equals(modelName)) {