theAbdoSabbagh / UnlimitedGPT

An unofficial Python wrapper for OpenAI's ChatGPT API
https://pypi.org/project/UnlimitedGPT/
GNU General Public License v3.0
364 stars 42 forks source link

catch conversation id from logs #12

Closed ezyyeah closed 1 year ago

ezyyeah commented 1 year ago

catching the new conversation id from /backend-api/conversations response

theAbdoSabbagh commented 1 year ago

What're the benefits of your PR? There was a template for a reason and you just ignored it, could you tell me what this improves in the library?

ezyyeah commented 1 year ago

What're the benefits of your PR? There was a template for a reason and you just ignored it, could you tell me what this improves in the library?

You're absolutely right, I just ignored that, my bad. This pull request is useful because it provides a solution to retrieve the conversation id generated after using the send_message(...) in a new conversation. Currently, there's no way to find that out. In my case, I need it to save the new conversation id and then continue with another prompt later.

To solve this, the changes I've made look through the network log (only when the id is unknown, so it is a new conversation) and find the backend-api/conversations response. This response provides a predetermined number of items (as defined in the query), each has details including the ID, title and some more information. In other words, it allows us to get the ID of a conversation after sending a message in a new conversation.

theAbdoSabbagh commented 1 year ago

Thanks for your informative reply. And that actually sounds really good, thanks for your PR! I'll review it soon once I get some time, I'm currently busy with IRL stuff.

theAbdoSabbagh commented 1 year ago

Thanks for the PR! Merging now :)