🐛Fix: 返回用户友好格式
This commit is contained in:
@@ -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");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user