Skip to content

Commit

Permalink
fix: support custom api-path
Browse files Browse the repository at this point in the history
  • Loading branch information
whatwewant committed Feb 18, 2023
1 parent 4d90e98 commit ad2170e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
7 changes: 7 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,12 @@ func main() {
EnvVars: []string{"PORT"},
Value: 8080,
},
&cli.StringFlag{
Name: "api-path",
Usage: "custom api path, default: /",
EnvVars: []string{"PATH"},
Value: "/",
},
&cli.StringFlag{
Name: "chatgpt-api-key",
Usage: "ChatGPT API Key",
Expand Down Expand Up @@ -56,6 +62,7 @@ func main() {
app.Command(func(ctx *cli.Context) (err error) {
return ServeFeishuBot(&FeishuBotConfig{
Port: ctx.Int64("port"),
Path: ctx.String("api-path"),
ChatGPTAPIKey: ctx.String("chatgpt-api-key"),
AppID: ctx.String("app-id"),
AppSecret: ctx.String("app-secret"),
Expand Down
2 changes: 2 additions & 0 deletions server.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import (

type FeishuBotConfig struct {
Port int64
Path string
ChatGPTAPIKey string
AppID string
AppSecret string
Expand Down Expand Up @@ -53,6 +54,7 @@ func ServeFeishuBot(cfg *FeishuBotConfig) error {

feishuchatbot, err := chatbot.New(&chatbot.Config{
Port: cfg.Port,
Path: cfg.Path,
AppID: cfg.AppID,
AppSecret: cfg.AppSecret,
}, func(contentString string, request *feishuEvent.EventRequest, reply func(content string, msgType ...string) error) error {
Expand Down

0 comments on commit ad2170e

Please sign in to comment.