소스 검색

修改空指针问题

xueyiming 8 달 전
부모
커밋
8fa9920d9b
1개의 변경된 파일3개의 추가작업 그리고 0개의 파일을 삭제
  1. 3 0
      long-article-server/src/main/java/com/tzld/piaoquan/longarticle/utils/other/OpenAIUtils.java

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

@@ -127,6 +127,9 @@ public class OpenAIUtils {
 //        responseFormat.put("type", "json_object");
 //        String content = DeepSeekAPI.chat(textPrompt + text, responseFormat);
         String content = KimiAPI.jsonChat(textPrompt + text);
+        if (StringUtils.isEmpty(content)) {
+            return null;
+        }
         return JSONObject.parseObject(content);
     }