diff --git a/README.md b/README.md index afea151..f6e44d9 100644 --- a/README.md +++ b/README.md @@ -3,3 +3,13 @@ * You'll run a dedicated browser in another window that's controlling ChatGPT. * Two terminals: `go run main.go`, and `python server.py`. I am extremely doubtful they will work for you on the first run. * This marks the end of the readme file; it is a bit sparse; thankfully the code is too! Just tuck in if you can... and I will try to add more here later. + +## Get Started + +1. Install Requirements (suggest to do it in `virtualenv` or `conda`) + +`pip install -r requirements.txt` + +2. Launch Terminal 1: `go run main.go` + +3. Launch Terminal 2: `python server.py` \ No newline at end of file diff --git a/main.go b/main.go index 5165e10..d6234e5 100644 --- a/main.go +++ b/main.go @@ -107,4 +107,4 @@ func main() { <-c client.Disconnect() -} +} \ No newline at end of file diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..33baf03 --- /dev/null +++ b/requirements.txt @@ -0,0 +1,2 @@ +flask +playwright \ No newline at end of file diff --git a/server.py b/server.py index ac43917..cd7c3eb 100644 --- a/server.py +++ b/server.py @@ -13,12 +13,13 @@ BROWSER = PLAY.chromium.launch_persistent_context( user_data_dir="/tmp/playwright", headless=False, + channel="chrome", ) PAGE = BROWSER.new_page() def get_input_box(): - """Get the child textarea of `PromptTextarea__TextareaWrapper`""" - return PAGE.query_selector("div[class*='PromptTextarea__TextareaWrapper']").query_selector("textarea") + """Get the child textarea of `PromptTextarea__TextareaWrapper`""" + return PAGE.query_selector("div[class*='PromptTextarea__TextareaWrapper']").query_selector("textarea") def is_logged_in(): # See if we have a textarea with data-id="root"