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"); } }