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

sgpt --show-role code errors out (see description for error message) #496

Open
startakovsky opened this issue Feb 25, 2024 · 1 comment
Open

Comments

@startakovsky
Copy link
Contributor

startakovsky commented Feb 25, 2024

this works for "Shell Command Generator" but doesn't work for "code". It works for some and fails for others.

shell command generator

$ sgpt --show-role "Shell Command Generator"
You are Shell Command Generator
Provide only zsh commands for Darwin/MacOS 14.3 without any description.
If there is a lack of details, provide most logical solution.
Ensure the output is a valid shell command.
If multiple steps required try to combine them together using &&.
Provide only plain text without Markdown formatting.
Do not provide markdown formatting such as ```.

code

$ sgpt --show-role code
╭─────────────────────────────── Traceback (most recent call last) ────────────────────────────────╮
│ /Users/steven/.local/bin/sgpt:8 in <module>                                                      │
│                                                                                                  │
│   5 from sgpt import cli                                                                         │
│   6 if __name__ == '__main__':                                                                   │
│   7 │   sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])                         │
│ ❱ 8 │   sys.exit(cli())                                                                          │
│   9                                                                                              │
│                                                                                                  │
│ ╭─────────────────────────────────────────── locals ───────────────────────────────────────────╮ │
│ │ cli = <function entry_point at 0x1059449a0>                                                  │ │
│ │  re = <module 're' from                                                                      │ │
│ │       '/opt/homebrew/Cellar/python@3.12/3.12.0/Frameworks/Python.framework/Versions/3.12/li… │ │
│ │ sys = <module 'sys' (built-in)>                                                              │ │
│ ╰──────────────────────────────────────────────────────────────────────────────────────────────╯ │
│                                                                                                  │
│ /Users/steven/.local/pipx/venvs/shell-gpt/lib/python3.12/site-packages/sgpt/app.py:263 in        │
│ entry_point                                                                                      │
│                                                                                                  │
│   260                                                                                            │
│   261                                                                                            │
│   262 def entry_point() -> None:                                                                 │
│ ❱ 263 │   typer.run(main)                                                                        │
│   264                                                                                            │
│   265                                                                                            │
│   266 if __name__ == "__main__":                                                                 │
│                                                                                                  │
│ /Users/steven/.local/pipx/venvs/shell-gpt/lib/python3.12/site-packages/typer/main.py:1056 in run │
│                                                                                                  │
│ /Users/steven/.local/pipx/venvs/shell-gpt/lib/python3.12/site-packages/typer/main.py:328 in      │
│ __call__                                                                                         │
│                                                                                                  │
│ /Users/steven/.local/pipx/venvs/shell-gpt/lib/python3.12/site-packages/typer/main.py:311 in      │
│ __call__                                                                                         │
│                                                                                                  │
│ /Users/steven/.local/pipx/venvs/shell-gpt/lib/python3.12/site-packages/click/core.py:1157 in     │
│ __call__                                                                                         │
│                                                                                                  │
│ /Users/steven/.local/pipx/venvs/shell-gpt/lib/python3.12/site-packages/typer/core.py:716 in main │
│                                                                                                  │
│ /Users/steven/.local/pipx/venvs/shell-gpt/lib/python3.12/site-packages/typer/core.py:215 in      │
│ _main                                                                                            │
│                                                                                                  │
│ /Users/steven/.local/pipx/venvs/shell-gpt/lib/python3.12/site-packages/click/core.py:943 in      │
│ make_context                                                                                     │
│                                                                                                  │
│ /Users/steven/.local/pipx/venvs/shell-gpt/lib/python3.12/site-packages/click/core.py:1408 in     │
│ parse_args                                                                                       │
│                                                                                                  │
│ /Users/steven/.local/pipx/venvs/shell-gpt/lib/python3.12/site-packages/click/core.py:2400 in     │
│ handle_parse_result                                                                              │
│                                                                                                  │
│ /Users/steven/.local/pipx/venvs/shell-gpt/lib/python3.12/site-packages/click/core.py:2362 in     │
│ process_value                                                                                    │
│                                                                                                  │
│ /Users/steven/.local/pipx/venvs/shell-gpt/lib/python3.12/site-packages/typer/main.py:994 in      │
│ wrapper                                                                                          │
│                                                                                                  │
│ /Users/steven/.local/pipx/venvs/shell-gpt/lib/python3.12/site-packages/sgpt/utils.py:60 in       │
│ wrapper                                                                                          │
│                                                                                                  │
│   57 │   def wrapper(cls: Any, value: str) -> None:                                              │
│   58 │   │   if not value:                                                                       │
│   59 │   │   │   return                                                                          │
│ ❱ 60 │   │   func(cls, value)                                                                    │
│   61 │   │   raise typer.Exit()                                                                  │
│   62 │                                                                                           │
│   63 │   return wrapper                                                                          │
│                                                                                                  │
│ ╭───────────────────── locals ──────────────────────╮                                            │
│ │   cls = <class 'sgpt.role.SystemRole'>            │                                            │
│ │  func = <function SystemRole.show at 0x1044fd580> │                                            │
│ │ value = 'code'                                    │                                            │
│ ╰───────────────────────────────────────────────────╯                                            │
│                                                                                                  │
│ /Users/steven/.local/pipx/venvs/shell-gpt/lib/python3.12/site-packages/sgpt/role.py:103 in show  │
│                                                                                                  │
│   100 │   @classmethod                                                                           │
│   101 │   @option_callback                                                                       │
│   102 │   def show(cls, name: str) -> None:                                                      │
│ ❱ 103 │   │   typer.echo(cls.get(name).role)                                                     │
│   104 │                                                                                          │
│   105 │   @classmethod                                                                           │
│   106 │   def get_role_name(cls, initial_message: str) -> Optional[str]:                         │
│                                                                                                  │
│ ╭─────────────── locals ────────────────╮                                                        │
│ │  cls = <class 'sgpt.role.SystemRole'> │                                                        │
│ │ name = 'code'                         │                                                        │
│ ╰───────────────────────────────────────╯                                                        │
│                                                                                                  │
│ /Users/steven/.local/pipx/venvs/shell-gpt/lib/python3.12/site-packages/sgpt/role.py:80 in get    │
│                                                                                                  │
│    77 │   │   file_path = cls.storage / f"{name}.json"                                           │
│    78 │   │   if not file_path.exists():                                                         │
│    79 │   │   │   raise BadArgumentUsage(f'Role "{name}" not found.')                            │
│ ❱  80 │   │   return cls(**json.loads(file_path.read_text()))                                    │
│    81 │                                                                                          │
│    82 │   @classmethod                                                                           │
│    83 │   @option_callback                                                                       │
│                                                                                                  │
│ ╭───────────────────────────────── locals ─────────────────────────────────╮                     │
│ │       cls = <class 'sgpt.role.SystemRole'>                               │                     │
│ │ file_path = PosixPath('/Users/steven/.config/shell_gpt/roles/code.json') │                     │
│ │      name = 'code'                                                       │                     │
│ ╰──────────────────────────────────────────────────────────────────────────╯                     │
╰──────────────────────────────────────────────────────────────────────────────────────────────────╯
TypeError: SystemRole.__init__() got an unexpected keyword argument 'expecting'
@Gabriele00001
Copy link

Me too but I can’t run python sgpt

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants