From 02f86f93d2ea61f65108e6ac7c583285b8bbcd52 Mon Sep 17 00:00:00 2001 From: zhangzhiyong Date: Mon, 27 Nov 2023 11:48:02 +0800 Subject: [PATCH] update --- .../openai/src/main/java/run/mone/openai/OpenaiCall.java | 2 +- .../src/test/java/run/mone/openapi/OpenApiTest.java | 8 +++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/jcommon/openai/src/main/java/run/mone/openai/OpenaiCall.java b/jcommon/openai/src/main/java/run/mone/openai/OpenaiCall.java index 2c65952ee..8f4fafa1d 100644 --- a/jcommon/openai/src/main/java/run/mone/openai/OpenaiCall.java +++ b/jcommon/openai/src/main/java/run/mone/openai/OpenaiCall.java @@ -265,7 +265,7 @@ public void onClosed(EventSource eventSource) { @Override public void onFailure(EventSource eventSource, @Nullable Throwable t, @Nullable Response response) { - log.error("on failure error:" + t, t); + log.error("on failure error:" + response, t); } }); } diff --git a/jcommon/openai/src/test/java/run/mone/openapi/OpenApiTest.java b/jcommon/openai/src/test/java/run/mone/openapi/OpenApiTest.java index c37f33d55..1c25e6a22 100644 --- a/jcommon/openai/src/test/java/run/mone/openapi/OpenApiTest.java +++ b/jcommon/openai/src/test/java/run/mone/openapi/OpenApiTest.java @@ -26,6 +26,7 @@ import io.reactivex.disposables.Disposable; import lombok.Data; import lombok.SneakyThrows; +import okhttp3.Response; import okhttp3.logging.HttpLoggingInterceptor; import okhttp3.sse.EventSource; import okhttp3.sse.EventSourceListener; @@ -168,7 +169,7 @@ private OpenAiClient client() { public void testCallStream() { String key = System.getenv("open_api_key"); CountDownLatch latch = new CountDownLatch(1); - OpenaiCall.callStream(key, null, "天空为什么是蓝色的", new String[]{}, new StreamListener() { + OpenaiCall.callStream(key, "", "天空为什么是蓝色的", new String[]{}, new StreamListener() { @Override public void onEvent(String str) { System.out.println(str); @@ -178,6 +179,11 @@ public void onEvent(String str) { public void end() { latch.countDown(); } + + @Override + public void onFailure(Throwable t, Response response) { + System.out.println(t + "" + response); + } }); latch.await(); }