ryuseisan / auto-chatgpt

Automate interaction with the browser version of ChatGPT.
MIT License
54 stars 11 forks source link

Implement detection of ChatGPT response completion (#12) #24

Closed ryuseisan closed 1 year ago

ryuseisan commented 1 year ago

This commit addresses issue #12, which aimed to improve the automation of ChatGPT by accurately detecting when a ChatGPT response is completed.

Previously, it was challenging to determine when the ChatGPT response was completed due to the streaming nature of the text to the browser. This led to inefficient techniques like time.sleep being used to retrieve the output.

In this commit, we have implemented a reliable method to detect when a ChatGPT response is completed. We achieved this by checking for changes in the div class of the response element (from "result-streaming" to "markdown") and using invisibility_of_element_located to wait for the streaming response element to become invisible.

This change allows us to obtain the output accurately and efficiently, improving the overall performance of the ChatGPT automation script.