From b2d6f208cc1275ef3e9ab765546a4894718263cd Mon Sep 17 00:00:00 2001 From: Lee Penkman Date: Sun, 2 Oct 2022 19:46:26 +1300 Subject: [PATCH 1/3] Update natbot.py --- natbot.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/natbot.py b/natbot.py index 9842fbf..3181661 100755 --- a/natbot.py +++ b/natbot.py @@ -536,7 +536,11 @@ def add_to_hash_tree(hash_tree, tag, node_id, node_name, parent_id): ): _crawler = Crawler() openai.api_key = os.environ.get("OPENAI_API_KEY") - + # use text-generator.io instead of OpenAI if there is a environment var set + text_generator_api_key = os.getenv("TEXTGENERATOR_API_KEY") + if text_generator_api_key: + openai.api_key = text_generator_api_key + openai.api_base = "https://api.text-generator.io" def print_help(): print( "(g) to visit url\n(u) scroll up\n(d) scroll dow\n(c) to click\n(t) to type\n" + From d36471cb23815d1b1e6359daada2ba9d18879422 Mon Sep 17 00:00:00 2001 From: Lee Penkman Date: Sun, 2 Oct 2022 20:37:16 +1300 Subject: [PATCH 2/3] Update README.md add to docs --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index c2a02ce..bd9a08f 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # natbot -Drive a browser with GPT-3 +Drive a browser with GPT-3 or [Text-Generator.io](https://text-generator.io) Here's a demo: https://twitter.com/natfriedman/status/1575631194032549888 From bcbcffb207d4bd21eb53ee8b9d750a577a139fd9 Mon Sep 17 00:00:00 2001 From: Lee Penkman Date: Sun, 2 Oct 2022 20:56:26 +1300 Subject: [PATCH 3/3] add requirements --- README.md | 16 ++++++++++++++++ requirements.txt | 4 ++++ 2 files changed, 20 insertions(+) create mode 100644 requirements.txt diff --git a/README.md b/README.md index bd9a08f..7fc09d4 100644 --- a/README.md +++ b/README.md @@ -12,3 +12,19 @@ Lots of ideas for improvement: - Let the agent use multiple tabs and switch between them Improvements welcome! + + +### Running + +#### Setup + +``` +pip install -r requirements.txt +playwright install +``` + +#### Run + +``` +python natbot.py +``` diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..5c484d4 --- /dev/null +++ b/requirements.txt @@ -0,0 +1,4 @@ + +openai +playwright +