🐛Fix: 返回用户友好格式

This commit is contained in:
2025-10-13 19:28:45 +08:00
parent 023f0b9590
commit 233b7f4c36
@@ -4,6 +4,7 @@ import cn.hezhaohui.webhook.constant.AIConstant;
import cn.hutool.http.HttpRequest; import cn.hutool.http.HttpRequest;
import cn.hutool.http.HttpResponse; import cn.hutool.http.HttpResponse;
import cn.hutool.http.HttpUtil; import cn.hutool.http.HttpUtil;
import cn.hutool.json.JSONObject;
import cn.hutool.json.JSONUtil; import cn.hutool.json.JSONUtil;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@@ -25,6 +26,8 @@ public class AIService {
.header("Authorization", "Bearer " + AIConstant.AI_TOKEN) .header("Authorization", "Bearer " + AIConstant.AI_TOKEN)
.body(jsonBody) .body(jsonBody)
.execute(); .execute();
return "AI response: " + response.body();
JSONObject jsonResponse = JSONUtil.parseObj(response.body());
return jsonResponse.getJSONArray("choices").getJSONObject(0).getJSONObject("message").getStr("content");
} }
} }