williamfzc / chat-gpt-ppt

Use ChatGPT (or other backends) to generate PPT automatically, all in one single file.
MIT License
881 stars 88 forks source link

panic while running cgp #12

Closed mepwang closed 1 year ago

mepwang commented 1 year ago

OS: ubuntu 20.04 go: go version go1.20.2 linux/amd64 running command: ./cgp token.txt and topic.txt is ready and in current directory build command: go build ./cmd/cgp version: HEAD

panic: start preparing ... panic: Post "https://api.openai.com/v1/chat/completions": net/http: invalid header field value for "Authorization"

goroutine 1 [running]: main.panicIfErr(...) /home/mep/ppt/chat-gpt-ppt/cmd/cgp/main.go:59 main.main.func1(0xc0000be000?) /home/mep/ppt/chat-gpt-ppt/cmd/cgp/main.go:47 +0xd5 github.com/abiosoft/ishell/v2.(Shell).handleCommand(0xc0000be000, {0xc000014e80, 0x1, 0x1}) /home/mep/go/pkg/mod/github.com/abiosoft/ishell/v2@v2.0.2/ishell.go:279 +0x226 github.com/abiosoft/ishell/v2.handleInput(0xc0000be000, {0xc000014e80, 0x1, 0x1}) /home/mep/go/pkg/mod/github.com/abiosoft/ishell/v2@v2.0.2/ishell.go:233 +0x31 github.com/abiosoft/ishell/v2.(Shell).Process(...) /home/mep/go/pkg/mod/github.com/abiosoft/ishell/v2@v2.0.2/ishell.go:229 main.main() /home/mep/ppt/chat-gpt-ppt/cmd/cgp/main.go:53 +0x538

williamfzc commented 1 year ago

see https://github.com/williamfzc/chat-gpt-ppt/issues/5#issuecomment-1455111271

mepwang commented 1 year ago

i cant see white spaces or empty lines with my eyes in token.txt, but strings.TrimSpace works.

williamfzc commented 1 year ago

i cant see white spaces or empty lines with my eyes in token.txt, but strings.TrimSpace works.

Cool maybe will add it soon. PR is welcome :)

williamfzc commented 1 year ago

Fixed in v0.5.1, thanks.