gorilla-llm / gorilla-cli

LLMs for your CLI
https://gorilla.cs.berkeley.edu/
Apache License 2.0
1.3k stars 76 forks source link

First invocation breaks if user.email git config not set. #3

Closed rtimmons closed 1 year ago

rtimmons commented 1 year ago

The CLI setup / ~/.gorilla-cli-useridcreation logic tries to call git config --global user.email:

https://github.com/gorilla-llm/gorilla-cli/blob/ec4153a7df028134213998fd16ee0ae339e103f1/go_cli.py#L81

This can fail if the user hasn't configured this git-config value (or if the user doesn't have git installed).

This results in an exception, but we continue to write the cli-userid file anyway (it's empty at this point):

https://github.com/gorilla-llm/gorilla-cli/blob/ec4153a7df028134213998fd16ee0ae339e103f1/go_cli.py#L81

Then on subsequent invocations, the (empty) cli-userid file is read, and this assertion block prevents progress without meaningful recourse:

https://github.com/gorilla-llm/gorilla-cli/blob/ec4153a7df028134213998fd16ee0ae339e103f1/go_cli.py#L76

Suggested fixes / ideas:

  1. Allow the git config invocation to fail https://github.com/gorilla-llm/gorilla-cli/blob/ec4153a7df028134213998fd16ee0ae339e103f1/go_cli.py#L81 and do the uuid-based id generation logic there.
  2. Rather than asserting the id to be non-empty https://github.com/gorilla-llm/gorilla-cli/blob/ec4153a7df028134213998fd16ee0ae339e103f1/go_cli.py#L76, either delete the file or prompt the user to do so.

Thanks for making this project and making it available open-source. I hope this bug report is helpful.

rtimmons commented 1 year ago

@aki-k beat me to it in #2 - please resolve this if easier for management.

ShishirPatil commented 1 year ago

Thank you @rtimmons and @aki-k If either of you are interested in a simple fix, even a try catch - please do raise a PR and I'd love to welcome you as a contributor!! 🎉

dxxvi commented 1 year ago

I know almost nothing about python. I got bit at this:

⮞ git config --global user.email
ava.lagoon@yahoo.com
⮞ my-python-venv/bin/gorilla "how to list all files in a directory"
Traceback (most recent call last):
  File "/home/ubuntu/my-python-venv/bin/gorilla", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/home/ubuntu/my-python-venv/lib/python3.11/site-packages/go_cli.py", line 128, in main
    user_id = get_user_id()
              ^^^^^^^^^^^^^
  File "/home/ubuntu/my-python-venv/lib/python3.11/site-packages/go_cli.py", line 76, in get_user_id
    assert user_id != ""
           ^^^^^^^^^^^^^
AssertionError

What should I do here?

AshTreeSystems commented 1 year ago

@dxxvi If you ran the command before setting the email try rm .gorilla-cli-userid and re-running the command.

ShishirPatil commented 1 year ago

+1 @AshTreeSystems is spot on. Just delete the file and run the command again to reinitialize it.