Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added Requirements and Adjusted Playwright configs #7

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how about just sticking to venv and may be write instructions for the same? I feel instead of presenting many options, just present one option with all the instructions, so it's easy for people who are out of py ecosystem

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fair - although I personally use Conda, so I didn't want to write up something I didn't use / test personally.

Happy to remove that line if you think it's confusing.


`pip install -r requirements.txt`

2. Launch Terminal 1: `go run main.go`

3. Launch Terminal 2: `python server.py`
2 changes: 1 addition & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,4 +107,4 @@ func main() {
<-c

client.Disconnect()
}
}
2 changes: 2 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
flask
playwright
5 changes: 3 additions & 2 deletions server.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down