Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

看日志好像是所有请求返回之后,event事件才开始触发 #93

Closed
CaptainRuby opened this issue Mar 31, 2023 · 5 comments
Closed

Comments

@CaptainRuby
Copy link

如果问一个比较长回复的问题,会有长时间的等待,直到http流输出回答完毕,才会有event事件的回调。这个设计感觉不符合流式响应。

@asdzheng
Copy link

@CaptainRuby 我用1.0.5版本并没有这个问题,但是用最新版本的1.0.8就有,你这个问题解决了么?

@CaptainRuby CaptainRuby reopened this Mar 31, 2023
@CaptainRuby
Copy link
Author

@asdzheng 我用WebClient解决,没有用okhttp

@Grt1228
Copy link
Owner

Grt1228 commented Apr 7, 2023

        HttpLoggingInterceptor httpLoggingInterceptor = new HttpLoggingInterceptor(new OpenAILogger());
        //!!!!千万别再生产或者测试环境打开BODY级别日志!!!!
        //!!!生产或者测试环境建议设置为这三种级别:NONE,BASIC,HEADERS,!!!
        httpLoggingInterceptor.setLevel(HttpLoggingInterceptor.Level.HEADERS);
    @CaptainRuby @asdzheng 找到问题了。看下上面的代码

@Grt1228 Grt1228 closed this as completed Apr 7, 2023
@CaptainRuby
Copy link
Author

@Grt1228 原理是啥,会阻塞线程吗

@Dkaishu
Copy link

Dkaishu commented Apr 10, 2023

OKhttp HttpLoggingInterceptor 实现机制问题吧,既然是Level.BODY,理应全部拿到后才给下一个interceptor。我理解的是,Level.BODY 和 SSE 是两个冲突的需求吧
这里有一些讨论:
square/okhttp#4298
launchdarkly/okhttp-eventsource#57

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants