0xacx / chatGPT-shell-cli

Simple shell script to use OpenAI's ChatGPT and DALL-E from the terminal. No Python or JS required.
https://gptshell.cc
MIT License
1.11k stars 157 forks source link

[bug] runtime error #84

Closed edshamis closed 1 year ago

edshamis commented 1 year ago

After commit 752d7b3 I get the following error

❯ ~/repos/bin/chatGPT-shell-cli/chatgpt.sh -p "hello" goroutine 1 [running]: runtime/debug.Stack(0x46, 0x0, 0x0) /usr/lib/go-1.16/src/runtime/debug/stack.go:24 +0x9f runtime/debug.PrintStack() /usr/lib/go-1.16/src/runtime/debug/stack.go:16 +0x25 github.com/charmbracelet/bubbletea.(Program).Start.func2(0xc00058de80) /root/go/pkg/mod/github.com/charmbracelet/bubbletea@v0.13.2/tea.go:294 +0xd3 panic(0xc3ae40, 0x11e48e0) /usr/lib/go-1.16/src/runtime/panic.go:965 +0x1b9 strings.Repeat(0xdf0bc0, 0x1, 0xffffffffffffffff, 0xc3ae40, 0xc00025b980) /usr/lib/go-1.16/src/strings/strings.go:529 +0x5e5 github.com/charmbracelet/bubbles/viewport.Model.View(0x0, 0x0, 0x0, 0x0, 0x1, 0xc0002daa80, 0xa6, 0xa6, 0x1619d80, 0x4) /root/go/pkg/mod/github.com/charmbracelet/bubbles@v0.7.6/viewport/viewport.go:361 +0x225 github.com/charmbracelet/glow/ui.pagerModel.View(0xc00030fba0, 0x0, 0x0, 0x0, 0x0, 0x1, 0xc0002daa80, 0xa6, 0xa6, 0x0, ...) /home/ed/gh/glow/ui/pager.go:337 +0x8a github.com/charmbracelet/glow/ui.model.View(0xc00030fba0, 0x1, 0x0, 0x0, 0x0, 0xc00030fba0, 0x0, 0x0, 0x1619d80, 0x4, ...) /home/ed/gh/glow/ui/ui.go:444 +0x79 github.com/charmbracelet/bubbletea.(Program).Start(0xc00058de80, 0x0, 0x0) /root/go/pkg/mod/github.com/charmbracelet/bubbletea@v0.13.2/tea.go:419 +0x72c main.runTUI(0x0, 0x0, 0x0, 0x0, 0x0) /home/ed/gh/glow/main.go:327 +0x293 main.execute(0x161d540, 0x166b630, 0x0, 0x0, 0x0, 0x0) /home/ed/gh/glow/main.go:190 +0x1d6 github.com/spf13/cobra.(Command).execute(0x161d540, 0xc000020210, 0x0, 0x0, 0x161d540, 0xc000020210) /root/go/pkg/mod/github.com/spf13/cobra@v1.1.3/command.go:852 +0x472 github.com/spf13/cobra.(Command).ExecuteC(0x161d540, 0x0, 0x15c6b08, 0xc000028118) /root/go/pkg/mod/github.com/spf13/cobra@v1.1.3/command.go:960 +0x375 github.com/spf13/cobra.(*Command).Execute(...) /root/go/pkg/mod/github.com/spf13/cobra@v1.1.3/command.go:897 main.main() /home/ed/gh/glow/main.go:337 +0x2d

Caught panic:

strings: negative Repeat count

Restoring terminal...

Thanks for using Glow!

0xacx commented 1 year ago

Thank you for reporting! 🙏 That seems to be a glow error. I have installed glow version 1.5.0 and it is working fine. All the script is doing is pipe the output to glow, no other flags are used. Could you try installing it again maybe? If you are still facing problems after a reinstall, consider opening an issue in the glow repository. As for the chatGPT-shell-cli script, you can uninstall glow and it will continue to work as usual.

edshamis commented 1 year ago

@0xacx Installed latest glow and it worked. Thanks!