输入prompt修饰

This commit is contained in:
2024-04-22 15:32:59 +08:00
parent 825439255b
commit 19d170c1bf

View File

@@ -232,20 +232,37 @@ public class GenerateServiceImpl extends ServiceImpl<GenerateMapper, Generate> i
if (StringUtil.isNullOrEmpty(text)) {
throw new BusinessException("please.input.the.caption");
}
generate.setText(text);
// generate.setText(text);
modifyPrompt(text, generate);
break;
case "image":
if (Objects.isNull(elementId)) {
throw new BusinessException("please.choose.an.image");
}
generate.setElementId(elementId);
modifyPrompt(text, generate);
break;
case "text-image":
if (StringUtil.isNullOrEmpty(text) || Objects.isNull(elementId)) {
throw new BusinessException("please.input.the.caption.and.choose.an.image");
}
generate.setText(text);
// generate.setText(text);
generate.setElementId(elementId);
modifyPrompt(text, generate);
default:
}
}
private void modifyPrompt(String userInput, Generate generate){
switch (generate.getLevel1Type()) {
case "Moodboard":
generate.setText(userInput + ",high quality");
break;
case "Printboard":
generate.setText(userInput + ", fabric print, high quality");
break;
case "Sketchboard":
generate.setText("a single item of " + userInput + "with clean background, hand-drawing sketch style, high quality");
default:
}
}