rawandahmad698 / PyChatGPT

⚡️ Python client for the unofficial ChatGPT API with auto token regeneration, conversation tracking, proxy support and more.
MIT License
4.22k stars 447 forks source link

[Feature Request] Add a toggle to use proxy or not in the `ask` API. #105

Closed ParadoxZW closed 1 year ago

ParadoxZW commented 1 year ago

It seems that only the procedure of 'login in and get access token' needs proxy in China, while the ask API doesn't.

Since using proxy servers may cause unstability, I'd prefer use proxy when updating access tokens, not use when calling ask.

rawandahmad698 commented 1 year ago
answer, previous_convo, convo_id = ChatHandler.ask(auth_token=access_token,
                                                           prompt=prompt,
                                                           conversation_id=self.conversation_id,
                                                           previous_convo_id=self.previous_convo_id,
                                                           proxies=self.options.proxies)

options.proxies are used, so make sure to add an option, and add proxies, it's used for all requests

ParadoxZW commented 1 year ago

So if I initial a ChatHandler with proxy set in the options, but call ask without passing the argument of proxies, will it use proxy or not, when making the post requests to talk with ChatGPT? I hope not.