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 ability for "No Modal" mode to run without --prompt #55

Merged
merged 2 commits into from
Jun 1, 2023
Merged
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
23 changes: 20 additions & 3 deletions main_no_modal.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
2 changes: 2 additions & 0 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -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*
Expand Down