From 9aec66d1a7890931155f304472d6104c74325e27 Mon Sep 17 00:00:00 2001 From: winter <2436197699@qq.com> Date: Thu, 21 Mar 2024 10:45:52 +0800 Subject: [PATCH] =?UTF-8?q?refactor:=20=E6=9B=B4=E6=94=B9=E6=97=A5?= =?UTF-8?q?=E5=BF=97=E4=B8=8A=E4=BC=A0=E7=9A=84api=E5=9C=B0=E5=9D=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/cn/teammodel/ai/SparkGptClient.java | 2 +- src/main/java/cn/teammodel/config/BodyReaderRequestWrapper.java | 1 + .../teammodel/config/intercepter/UploadApiLogInterceptor.java | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/main/java/cn/teammodel/ai/SparkGptClient.java b/src/main/java/cn/teammodel/ai/SparkGptClient.java index 24b0e3d..0c3d2f2 100644 --- a/src/main/java/cn/teammodel/ai/SparkGptClient.java +++ b/src/main/java/cn/teammodel/ai/SparkGptClient.java @@ -42,7 +42,7 @@ public class SparkGptClient implements InitializingBean { // 初始化缓存 HistoryCache.init(sparkGptProperties.getCache_timeout(), sparkGptProperties.getCache_context()); // 初始化 authUrl -// log.info("[SPARK CHAT] 鉴权 endpoint : {}", this.authUrl); + // log.info("[SPARK CHAT] 鉴权 endpoint : {}", this.authUrl); this.okHttpClient = new OkHttpClient.Builder() .connectTimeout(180, TimeUnit.SECONDS) .readTimeout(180, TimeUnit.SECONDS) // sse 接口的 readTimeout 不能设置小了 diff --git a/src/main/java/cn/teammodel/config/BodyReaderRequestWrapper.java b/src/main/java/cn/teammodel/config/BodyReaderRequestWrapper.java index 163cf76..1189ceb 100644 --- a/src/main/java/cn/teammodel/config/BodyReaderRequestWrapper.java +++ b/src/main/java/cn/teammodel/config/BodyReaderRequestWrapper.java @@ -14,6 +14,7 @@ public class BodyReaderRequestWrapper extends HttpServletRequestWrapper { private final byte[] buff; public BodyReaderRequestWrapper(HttpServletRequest request) throws IOException { super(request); + // 将 body 中的内容读取到 buff 中 InputStream is = request.getInputStream(); ByteArrayOutputStream baos = new ByteArrayOutputStream(); byte[] b = new byte[1024]; diff --git a/src/main/java/cn/teammodel/config/intercepter/UploadApiLogInterceptor.java b/src/main/java/cn/teammodel/config/intercepter/UploadApiLogInterceptor.java index 7b2da98..2f660a7 100644 --- a/src/main/java/cn/teammodel/config/intercepter/UploadApiLogInterceptor.java +++ b/src/main/java/cn/teammodel/config/intercepter/UploadApiLogInterceptor.java @@ -108,7 +108,7 @@ public class UploadApiLogInterceptor implements HandlerInterceptor { String requestData = root.toString(); RequestBody requestBody = RequestBody.create(MediaType.parse("application/json"), requestData); Request okRequest = new Request.Builder() - .url("https://teammodelosfunction.chinacloudsites.cn/api/http-log") + .url("http://cdhabook.teammodel.cn:8805/api/http-log") .post(requestBody) .build();