提示词提示
This commit is contained in:
@@ -491,12 +491,13 @@ public class TryOnEffectServiceImpl extends ServiceImpl<TryOnEffectMapper, TryOn
|
|||||||
|
|
||||||
com.alibaba.fastjson.JSONObject candidate = candidates.getJSONObject(0);
|
com.alibaba.fastjson.JSONObject candidate = candidates.getJSONObject(0);
|
||||||
String finishReason = candidate.getString("finishReason");
|
String finishReason = candidate.getString("finishReason");
|
||||||
|
|
||||||
if (!"STOP".equals(finishReason)) {
|
if (!"STOP".equals(finishReason)) {
|
||||||
String finishMessage = candidate.getString("finishMessage");
|
String finishMessage = candidate.getString("finishMessage");
|
||||||
if ("IMAGE_SAFETY".equals(finishReason)) {
|
if (finishReason != null && finishReason.equals("IMAGE_SAFETY")){
|
||||||
log.error("图片安全检查失败,请尝试修改提示词或图片");
|
if (finishMessage != null && finishMessage.contains("Try rephrasing the prompt")) {
|
||||||
throw new BusinessException("Image safety check failed", "图片安全检查失败", ResultEnum.ERROR.getCode());
|
finishMessage = "Try rephrasing the prompt.If you think this was an error, send feedback.";
|
||||||
|
throw new BusinessException(finishMessage, "请尝试重新表述提示词。若您认为这是误判,可提交反馈。", ResultEnum.ERROR.getCode());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
log.error("生成失败: {}", finishMessage);
|
log.error("生成失败: {}", finishMessage);
|
||||||
throw new BusinessException("Image generation failed", "图片生成失败", ResultEnum.ERROR.getCode());
|
throw new BusinessException("Image generation failed", "图片生成失败", ResultEnum.ERROR.getCode());
|
||||||
|
|||||||
Reference in New Issue
Block a user