🐛Fix: 增加 AI 返回错误时的特判

This commit is contained in:
2025-10-13 19:44:21 +08:00
parent 2fca4f38df
commit ea42aa89d9
@@ -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");
}