+gpt-engineer

This commit is contained in:
Max Howell 2023-06-20 11:48:16 -04:00
parent 5b2c33b880
commit 0ddfd5b18f
3 changed files with 115 additions and 0 deletions

View file

@ -0,0 +1,58 @@
#!/bin/bash
#---
# dependencies:
# charm.sh/gum: '*'
#---
set -eo pipefail
if [ -z "$OPENAI_API_KEY"]; then
gum format <<EoMD
# OpenAI API key required
You need an OpenAI API key to use this package.
> https://platform.openai.com/account/api-keys
GPT4 is recommended.
Though this requires signing up for the [waitlist](https://openai.com/waitlist/gpt-4-api)
GPT 3 is ok.
Set this key in your `~/.shellrc` file.
EoMD
exit 1
fi
gum format <<EoMD
# what do you want to build?
the example prompt \`gpt-engineer\` provide is:
> we are writing snake in python. MVC components split in separate files. keyboard control.
type your prompt below (⌃D when done)
EoMD
echo #spacer
prompt="$(gum write --placeholder 'main prompt…')"
gum format <<EoMD
# we store the results in your documents folder, whats the title?
EoMD
title="$(gum input --placeholder 'title?')"
docs="${XDG_DOCUMENTS_DIR:-$HOME/Documents}/GPT Engineer"
mkdir -p "$docs/$title"
echo "$prompt" > "$docs/$title/main_prompt"
gum format <<EoMD
> output will be written to \`$docs/$title\`
# running \`gpt-engineer\`
EoMD
exec gpt-engineer "$docs/$title"

View file

@ -0,0 +1,24 @@
diff --git a/gpt_engineer/main.py b/gpt_engineer/main.py
index 9df1f07..3bb31c7 100644
--- a/gpt_engineer/main.py
+++ b/gpt_engineer/main.py
@@ -46,12 +46,18 @@ def main(
temperature=temperature,
)
+ script_dir = Path(os.path.dirname(os.path.abspath(__file__)))
+ up_dir = script_dir
+ for _ in range(5):
+ up_dir = up_dir.parent
+ identity_file_path = up_dir / "identity"
+
dbs = DBs(
memory=DB(memory_path),
logs=DB(memory_path / "logs"),
input=DB(input_path),
workspace=DB(workspace_path),
- identity=DB(Path(os.path.curdir) / "identity"),
+ identity=DB(identity_file_path),
)
for step in STEPS[steps_config]:

View file

@ -0,0 +1,33 @@
distributable:
url: https://github.com/AntonOsika/gpt-engineer/archive/refs/tags/v0.0.3.tar.gz
strip-components: 1
versions:
github: AntonOsika/gpt-engineer
dependencies:
python.org: ^3
tea.xyz: ^0
entrypoint: tea {{prefix}}/entrypoint.sh
build:
dependencies:
gnu.org/patch: '*'
script:
# https://github.com/AntonOsika/gpt-engineer/issues/204
- patch -p1 < props/main.py.patch
- python-venv.sh {{prefix}}/bin/gpt-engineer
# https://github.com/AntonOsika/gpt-engineer/issues/204
- cp -a identity {{prefix}}
- cp props/entrypoint.sh {{prefix}}
provides:
- bin/gpt-engineer
test:
qa-required: true
script: gpt-engineer --help