From ea42aa89d99fa0c1469849d6d88e2fba14675365 Mon Sep 17 00:00:00 2001 From: Wonder Date: Mon, 13 Oct 2025 19:44:21 +0800 Subject: [PATCH] =?UTF-8?q?=20=F0=9F=90=9BFix:=20=E5=A2=9E=E5=8A=A0=20AI?= =?UTF-8?q?=20=E8=BF=94=E5=9B=9E=E9=94=99=E8=AF=AF=E6=97=B6=E7=9A=84?= =?UTF-8?q?=E7=89=B9=E5=88=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/cn/hezhaohui/webhook/service/AIService.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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"); }