toshiakit / MatGPT

MATLAB app to access ChatGPT API from OpenAI
MIT License
190 stars 26 forks source link

Connect Timeout #12

Closed N1roller closed 1 year ago

N1roller commented 1 year ago

When we use it in China, it will return "The reason is "Connection timeout after 10122 ms". Perhaps the server is not responding or HTTPOptions.ConnectTimeout needs to be set to a higher value". So how can we solve it?

toshiakit commented 1 year ago

Thank you for raising this issue. It is my understanding that ChatGPT is not allowed inside China. If you see helpers/chatter.m, you see that http request is handled in lines 41 - 53 using MATLAB HTTP Interface. You can modify this code to include timeout handling using matlab.net.http.HTTPOptions class https://www.mathworks.com/help/matlab/ref/matlab.net.http.httpoptions-class.html. Since I cannot support your use case, you can fork this repo and make necessary changes to handle the timeout error. See this for your reference. https://zhuanlan.zhihu.com/p/626111080