From 233b7f4c36cffaa951c7870c0bd3dc8cfb6305fd Mon Sep 17 00:00:00 2001 From: Wonder Date: Mon, 13 Oct 2025 19:28:45 +0800 Subject: [PATCH] =?UTF-8?q?=20=F0=9F=90=9BFix:=20=E8=BF=94=E5=9B=9E?= =?UTF-8?q?=E7=94=A8=E6=88=B7=E5=8F=8B=E5=A5=BD=E6=A0=BC=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/cn/hezhaohui/webhook/service/AIService.java | 5 ++++- 1 file changed, 4 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 4e17484..7e72244 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 @@ -4,6 +4,7 @@ import cn.hezhaohui.webhook.constant.AIConstant; import cn.hutool.http.HttpRequest; import cn.hutool.http.HttpResponse; import cn.hutool.http.HttpUtil; +import cn.hutool.json.JSONObject; import cn.hutool.json.JSONUtil; import org.springframework.stereotype.Service; @@ -25,6 +26,8 @@ public class AIService { .header("Authorization", "Bearer " + AIConstant.AI_TOKEN) .body(jsonBody) .execute(); - return "AI response: " + response.body(); + + JSONObject jsonResponse = JSONUtil.parseObj(response.body()); + return jsonResponse.getJSONArray("choices").getJSONObject(0).getJSONObject("message").getStr("content"); } }