From 72778f5c7bf200a2ea68c6eb31147cd2cbfa45fb Mon Sep 17 00:00:00 2001 From: Dan Menzies Date: Wed, 31 May 2023 07:09:49 +0100 Subject: [PATCH 1/2] Added ability for "No Modal" mode to run without the --prompt command line argument, if needed. --- main_no_modal.py | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/main_no_modal.py b/main_no_modal.py index 478f5d384..d8c87978c 100644 --- a/main_no_modal.py +++ b/main_no_modal.py @@ -231,10 +231,27 @@ def clean_dir(directory): if __name__ == "__main__": + + # Check for arguments if len(sys.argv) < 2: - print("Please provide a prompt") - sys.exit(1) - prompt = sys.argv[1] + + # Looks like we don't have a prompt. Check if prompt.md exists + if not os.path.exists("prompt.md"): + + # Still no? Then we can't continue + print("Please provide a prompt") + sys.exit(1) + + # Still here? Assign the prompt file name to prompt + prompt = "prompt.md" + + else: + # Set prompt to the first argument + prompt = sys.argv[1] + + # Pull everything else as normal directory = sys.argv[2] if len(sys.argv) > 2 else generatedDir file = sys.argv[3] if len(sys.argv) > 3 else None + + # Run the main function main(prompt, directory, file) From 7f2f79894c1fdd71ad92f7c9b99c6129b9cf65be Mon Sep 17 00:00:00 2001 From: "swyx.io" Date: Thu, 1 Jun 2023 10:42:48 -0400 Subject: [PATCH 2/2] Update readme.md --- readme.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/readme.md b/readme.md index 05d0d0cae..8c8911893 100644 --- a/readme.md +++ b/readme.md @@ -183,6 +183,8 @@ export OPENAI_API_KEY=sk-xxxxxx # your openai api key here) python main_no_modal.py YOUR_PROMPT_HERE ``` +If no command line argument is given, **and** the file `prompt.md` exists, the main function will automatically use the `prompt.md` file. All other command line arguments are left as default. *this is handy for those using the "run" function on a `venv` setup in PyCharm for Windows, where no opportunity is given to enter command line arguments. Thanks [@danmenzies](https://github.com/smol-ai/developer/pull/55)* + ## usage: smol debugger *this is a beta feature, very very MVP, just a proof of concept really*