Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
goodjava committed Nov 27, 2023
1 parent 2f0104a commit 02f86f9
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand All @@ -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();
}
Expand Down

0 comments on commit 02f86f9

Please sign in to comment.