diff --git a/gitea-webhook/src/main/java/cn/hezhaohui/webhook/service/AIService.java b/gitea-webhook/src/main/java/cn/hezhaohui/webhook/service/AIService.java index 7e72244..3f5938f 100644 --- a/gitea-webhook/src/main/java/cn/hezhaohui/webhook/service/AIService.java +++ b/gitea-webhook/src/main/java/cn/hezhaohui/webhook/service/AIService.java @@ -26,7 +26,9 @@ public class AIService { .header("Authorization", "Bearer " + AIConstant.AI_TOKEN) .body(jsonBody) .execute(); - + if (response.getStatus() != 200) { + return AIConstant.DEFAULT_ERROR_RESPONSE; + } JSONObject jsonResponse = JSONUtil.parseObj(response.body()); return jsonResponse.getJSONArray("choices").getJSONObject(0).getJSONObject("message").getStr("content"); }