Browse Source

Merge branch 'picture' into pre

# Conflicts:
#	netflix-dao/src/main/java/com/cyksj/model/entity/MirrorNotice.java
#	netflix-web/src/main/resources/application-prd.yml
zwhui 2 năm trước cách đây
mục cha
commit
98e36ae55d

+ 6 - 8
netflix-service/src/main/java/com/cyksj/service/midjourney/impl/MidjourneyServiceImpl.java

@@ -65,6 +65,8 @@ public class MidjourneyServiceImpl implements MidjourneyService {
 
     @Value("${midjourney.url}")
     private String midjourneyHost;
+    @Value("${midjourney.cdn}")
+    private String midjourneyCdnHost;
 
     private final EnvCommonService envCommonService;
 
@@ -293,7 +295,8 @@ public class MidjourneyServiceImpl implements MidjourneyService {
                 throw BusinessRuntimeException.getInstance(submitResult.getDescription());
             }
             if (code == 24) {
-                throw BusinessRuntimeException.getInstance("prompt包含敏感词");
+                JSONObject jsonObject = JSONUtil.parseObj(submitResult.getResult());
+                throw BusinessRuntimeException.getInstance("prompt包含敏感词:"+jsonObject.getStr("bannedWord"));
             }
             log.error("action:" + action + " error message:" + submitResult.getDescription());
             throw BusinessRuntimeException.getInstance("队列已满,请稍后尝试");
@@ -434,19 +437,14 @@ public class MidjourneyServiceImpl implements MidjourneyService {
     }
 
 
-    private static String uploadPic(String url, String prefix) throws IOException {
+    private String uploadPic(String url, String prefix) throws IOException {
         byte[] body = HttpUtil.downloadBytes(url);
         Path tempFile = Files.createTempFile(prefix, ".png");
         File file = tempFile.toFile();
         try (FileImageOutputStream imageOutput = new FileImageOutputStream(file)) {
             imageOutput.write(body, 0, body.length);
         }
-        Map<String, Object> paramMap = new HashMap<>();
-        paramMap.put("file", file);
-        String json = HttpUtil.post("https://files.liuliangbang.vip/pic/ups", paramMap);
-        log.info("上传图片结果:url:{},json:{}",url, json);
-        FileUtil.del(file);
-        return new JSONObject(json).getJSONObject("value").getJSONArray("saved").getJSONObject(0).getJSONObject("info").getStr("cdnUrl");
+        return midjourneyCdnHost + "/picture/" + file.getName();
     }
 
     private static List<String> uploadBase64Pic(List<String> base64Array) throws IOException {

+ 2 - 2
netflix-web/src/main/java/com/cyksj/web/controller/mirror/MidjourneyController.java

@@ -184,7 +184,7 @@ public class MidjourneyController {
     @PostMapping("/submit/imagine")
     @NoSubmit
     public Result<MidjourneyUserConversation> submitImagine(@RequestBody SubmitImagineDTO submitImagineDTO) {
-        log.info("提交Imagine任务,提示:{},base64数组长度:{}",submitImagineDTO.getPrompt(),submitImagineDTO.getBase64Array());
+        log.info("提交Imagine任务,提示:{}",submitImagineDTO.getPrompt());
         MidjourneyUser user = getUser();
         Long num = checkUserLimit(user);
         if (num != null && num < 0){
@@ -253,7 +253,7 @@ public class MidjourneyController {
     @PostMapping("/submit/modal")
     @NoSubmit
     public Result<MidjourneyUserConversation> submitModal(@RequestBody SubmitModalDTO submitModalDTO) {
-        log.info("提交Modal任务,taskId:{},提示:{},base64数组长度:{}",submitModalDTO.getTaskId(),submitModalDTO.getPrompt(),submitModalDTO.getMaskBase64());
+        log.info("提交Modal任务,taskId:{},提示:{}",submitModalDTO.getTaskId(),submitModalDTO.getPrompt());
         MidjourneyUser user = getUser();
         Long num = checkUserLimit(user);
         if (num != null && num < 0){

Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 0 - 0
netflix-web/src/main/resources/application-dev.yml


Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 0 - 0
netflix-web/src/main/resources/application-prd.yml


+ 2 - 1
netflix-web/src/main/resources/application-pre.yml

@@ -197,4 +197,5 @@ smsVerify:
 
 midjourney:
   url: https://nf.video
-  drawUrl: https://nf.video/drawTest/web/
+  drawUrl: https://nf.video/drawTest/web/
+  cdn: https://nf.video

Một số tệp đã không được hiển thị bởi vì quá nhiều tập tin thay đổi trong này khác