Skip to content

Commit

Permalink
fix(#12): safe token
Browse files Browse the repository at this point in the history
  • Loading branch information
williamfzc committed Mar 27, 2023
1 parent 6e134da commit 7161c27
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion api.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package chat_gpt_ppt
import (
"fmt"
"log"
"strings"

"github.com/abiosoft/ishell/v2"
)
Expand All @@ -25,7 +26,11 @@ func GenAndRenderString(shellContext *ishell.Context, config ApiConfig) (string,
if c == nil {
return "", fmt.Errorf("no client named: %v", config.ClientType)
}
c.SetToken(config.Token)

// https://github.com/williamfzc/chat-gpt-ppt/issues/12
safeToken := strings.TrimSpace(config.Token)
c.SetToken(safeToken)

// init renderer
renderer := GetRenderer(config.RendererType)
if renderer == nil {
Expand Down

0 comments on commit 7161c27

Please sign in to comment.