From f22b6b431d06a8f3eec792fa3c9e3f0d3798956b Mon Sep 17 00:00:00 2001 From: Shmulik Cohen Date: Fri, 14 Jul 2023 00:46:13 +0300 Subject: [PATCH 1/2] installation fixes --- pyproject.toml | 4 ++-- readme.md | 10 ++++++---- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index b22a23dc1..16541e4b3 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ version = "0.0.3" description = "python module of smol developer" authors = ["swyx "] license = "MIT" -readme = "README.md" +readme = "readme.md" packages = [{ include = "smol_dev" }] [tool.poetry.dependencies] @@ -22,4 +22,4 @@ src = "src.__main__:main" [project.urls] "Homepage" = "https://github.com/smol-ai/developer" -"Bug Tracker" = "https://github.com/smol-ai/developer/issues" \ No newline at end of file +"Bug Tracker" = "https://github.com/smol-ai/developer/issues" diff --git a/readme.md b/readme.md index ff2916c53..c808323cb 100644 --- a/readme.md +++ b/readme.md @@ -31,12 +31,14 @@ cd developer poetry install # install dependencies. pip install poetry if you need # run -python main.py "a HTML/JS/CSS Tic Tac Toe Game" # defaults to gpt-4-0613 -# python main.py "a HTML/JS/CSS Tic Tac Toe Game" --model=gpt-3.5-turbo-0613 +poetry run python main.py --prompt "a HTML/JS/CSS Tic Tac Toe Game" # other cli flags -python main.py --prompt prompt.md # for longer prompts, move them into a markdown file -python main.py --prompt prompt.md --debug True # for debugging +poetry run python main.py --prompt prompt.md # for longer prompts, move them into a markdown file +poetry run python main.py --prompt prompt.md --debug True # for debugging +poetry run python main.py --prompt prompt.md --model gpt-3.5-turbo-0613 # change model, default is gpt-4-0613 +# Change the target folder, default is generate/. Note that main will delete what is currently in the folder. +poetry run python main.py --prompt prompt.md --generate_folder_path /path/to/folder/ ```
From b2492ce17bbed477e2fe660987911ed226d89d1f Mon Sep 17 00:00:00 2001 From: Shmulik Cohen Date: Fri, 14 Jul 2023 00:46:20 +0300 Subject: [PATCH 2/2] fix bug in main, insert prompt only with --prompt --- main.py | 45 +++++++++++---------------------------------- 1 file changed, 11 insertions(+), 34 deletions(-) diff --git a/main.py b/main.py index 07cf8a8b4..4f2dfc422 100644 --- a/main.py +++ b/main.py @@ -6,41 +6,18 @@ import argparse - - -# for local testing -# python main.py --prompt "a simple JavaScript/HTML/CSS/Canvas app that is a one player game of PONG..." --generate_folder_path "generated" --debug True - if __name__ == "__main__": - prompt = """ - a simple JavaScript/HTML/CSS/Canvas app that is a one player game of PONG. - The left paddle is controlled by the player, following where the mouse goes. - The right paddle is controlled by a simple AI algorithm, which slowly moves the paddle toward the ball at every frame, with some probability of error. - Make the canvas a 400 x 400 black square and center it in the app. - Make the paddles 100px long, yellow and the ball small and red. - Make sure to render the paddles and name them so they can controlled in javascript. - Implement the collision detection and scoring as well. - Every time the ball bouncess off a paddle, the ball should move faster. - It is meant to run in Chrome browser, so dont use anything that is not supported by Chrome, and don't use the import and export keywords. - """ - if len(sys.argv) == 2: - prompt = sys.argv[1] - else: - - parser = argparse.ArgumentParser() - parser.add_argument("--prompt", type=str, help="Prompt for the app to be created.") - parser.add_argument("--model", type=str, default="gpt-4-0613", help="model to use. can also use gpt-3.5-turbo-0613") - parser.add_argument("--generate_folder_path", type=str, default="generated", help="Path of the folder for generated code.") - parser.add_argument("--debug", type=bool, default=False, help="Enable or disable debug mode.") - args = parser.parse_args() - if args.prompt: - prompt = args.prompt + parser = argparse.ArgumentParser() + parser.add_argument("--prompt", required=True, type=str, help="Prompt for the app to be created.") + parser.add_argument("--model", type=str, default="gpt-4-0613", help="model to use. can also use gpt-3.5-turbo-0613") + parser.add_argument("--generate_folder_path", type=str, default="generated", help="Path of the folder for generated code.") + parser.add_argument("--debug", type=bool, default=False, help="Enable or disable debug mode.") + args = parser.parse_args() # read file from prompt if it ends in a .md filetype - if len(prompt) < 100 and prompt.endswith(".md"): - with open(prompt, "r") as promptfile: - prompt = promptfile.read() + if len(args.prompt) < 100 and args.prompt.endswith(".md"): + with open(args.prompt, "r") as promptfile: + args.prompt = promptfile.read() - print(prompt) - - main(prompt=prompt, generate_folder_path=args.generate_folder_path, debug=args.debug, model=args.model) + print(args.prompt) + main(prompt=args.prompt, generate_folder_path=args.generate_folder_path, debug=args.debug, model=args.model)