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

请问有无方法,延长gpt的反应时间 #3

Open
zemise opened this issue Mar 8, 2023 · 2 comments
Open

请问有无方法,延长gpt的反应时间 #3

zemise opened this issue Mar 8, 2023 · 2 comments

Comments

@zemise
Copy link

zemise commented Mar 8, 2023

有时gpt需要反应一会儿的时候,就收不到回复了

@LiLittleCat
Copy link
Owner

LiLittleCat commented Mar 8, 2023

@abc408880155 你好,底层是用的 OkHttpClient 发起请求的,你可以在构造 ChatGPT 对象的时候自己传递一个带有超时时间参数的 OkHttpClient 进去试试,比如:

OkHttpClient client = new OkHttpClient.Builder()
                .connectTimeout(10, TimeUnit.SECONDS)
                .readTimeout(10, TimeUnit.SECONDS)
                .writeTimeout(10, TimeUnit.SECONDS)
                .build(); // 根据需要设置,默认都是 10s
ChatGPT chatGPT = new ChatGPT("YOUR_API_KEY", client);

参考:https://square.github.io/okhttp/4.x/okhttp/okhttp3/-ok-http-client/#properties

如果是因为 https://api.openai.com 访问太慢可以看看这个:noobnooc/noobnooc#9

@zemise
Copy link
Author

zemise commented Mar 8, 2023

@LiLittleCat 谢谢大佬回复,感谢~

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

2 participants