ryuseisan / auto-chatgpt

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

Detect ChatGPT Response Completion #12

Closed ryuseisan closed 1 year ago

ryuseisan commented 1 year ago

To improve the ChatGPT automation using Selenium and undetected-chromedriver, we need to add a feature that can detect when a ChatGPT response is completed, allowing us to retrieve the output accurately.

Background

Currently, it's challenging to determine when the ChatGPT response is completed, as the text is streamed to the browser. We need a reliable method to detect when the response is finished, so we can obtain the output without resorting to inefficient techniques like time.sleep.

Proposed Solution

There are several methods that could be implemented to detect the response completion:

  1. Use JavaScript's MutationObserver to observe changes in the response element, and trigger a callback when the response is completed.
  2. Check for changes in the div class of the response element (e.g., from "result-streaming" to "markdown").
  3. Use invisibility_of_element_located to wait for the streaming response element to become invisible.

Acceptance Criteria

Tasks

ryuseisan commented 1 year ago