Browse Source

增加kimi日志

xueyiming 5 months ago
parent
commit
a56a6d9201

+ 4 - 1
long-article-server/src/main/java/com/tzld/piaoquan/longarticle/service/local/impl/MatchVideoServiceImpl.java

@@ -139,6 +139,7 @@ public class MatchVideoServiceImpl {
                         try {
                             // 超过 5 分钟没有数据,销毁当前线程
                             MatchVideo matchVideo = matchKimiVideoQueue.poll(5, TimeUnit.MINUTES); // 等待最多 5 分钟
+                            log.info("matchKimiVideoQueue size={}", matchKimiVideoQueue.size());
                             if (matchVideo == null) {
                                 break; // 退出当前线程
                             }
@@ -229,6 +230,7 @@ public class MatchVideoServiceImpl {
             String lockValue = UUID.randomUUID().toString();
             boolean lock = redisLock.tryLock(lockKey, lockValue, 300, TimeUnit.SECONDS);
             if (lock) {
+                log.info("processKimiMatchContent lock lockKey={}", lockKey);
                 boolean res = kimiService.updateKimiContent(matchVideo.getContentId());
                 if (res) {
                     updateStatus(matchVideo.getId(), ContentStatusEnum.KIMI_SUCCESS.getStatusCode());
@@ -236,9 +238,10 @@ public class MatchVideoServiceImpl {
                     LarkRobotUtil.sendMessage("kimiService updateKimiContent fail contentId=" + matchVideo.getContentId());
                     log.error("kimiService updateKimiContent fail contentId={}", matchVideo.getContentId());
                 }
+                log.info("processKimiMatchContent unlock lockKey={}", lockKey);
                 redisLock.unlock(lockKey, lockValue);
             }
-        } else {
+        } else if (kimiText.getKimiStatus() == 1) {
             //更新状态为kimi执行完成
             updateStatus(matchVideo.getId(), ContentStatusEnum.KIMI_SUCCESS.getStatusCode());
         }

+ 1 - 0
long-article-server/src/main/java/com/tzld/piaoquan/longarticle/utils/other/KimiAPI.java

@@ -43,6 +43,7 @@ public class KimiAPI {
                     .header("Authorization", apiKey)
                     .header("Content-Type", "application/json")
                     .body(JSONObject.toJSONString(paramMap))
+                    .timeout(60000)
                     .execute()
                     .body();
             JSONObject jsonObject = JSONObject.parseObject(body);