diff --git a/README.md b/README.md index 23f31fe..d0cf57f 100644 --- a/README.md +++ b/README.md @@ -25,6 +25,11 @@ ## 功能支持 +### 核心 +* [x] 支持文本生成 +* [x] 支持图片生成 + +### 扩展 * [x] 支持长对话,自动联系上下文 * [x] 支持私人对话 * [x] 支持群聊 diff --git a/commands/custom.go b/commands/custom.go new file mode 100644 index 0000000..b89784c --- /dev/null +++ b/commands/custom.go @@ -0,0 +1,76 @@ +package commands + +import ( + "net/http" + + "github.com/go-zoox/chatbot-feishu" + chatgpt "github.com/go-zoox/chatgpt-client" + "github.com/go-zoox/chatgpt-for-chatbot-feishu/config" + "github.com/go-zoox/core-utils/fmt" + "github.com/go-zoox/feishu" + feishuEvent "github.com/go-zoox/feishu/event" + "github.com/go-zoox/fetch" + "github.com/go-zoox/logger" +) + +func CreateCustomCommand( + feishuClient feishu.Client, + chatgptClient chatgpt.Client, + cfg *config.Config, +) *chatbot.Command { + return &chatbot.Command{ + ArgsLength: 1, + Handler: func(args []string, request *feishuEvent.EventRequest, reply chatbot.MessageReply) error { + if len(args) != 1 { + return fmt.Errorf("invalid args: %v", args) + } + + question := args[0] + logger.Debugf("[custom command: %s, service: %s] question: %s", cfg.CustomCommand, cfg.CustomCommandService, question) + + response, err := fetch.Post(cfg.CustomCommandService, &fetch.Config{ + Headers: fetch.Headers{ + "Content-Type": "application/json", + "Accept": "application/json", + "User-Agent": fmt.Sprintf("go-zoox_fetch/%s chatgpt-for-chatbot-feishu/%s", fetch.Version, cfg.Version), + }, + Body: map[string]interface{}{ + "question": args[0], + }, + }) + if err != nil { + logger.Errorf("failed to request from custom command service(%s)(1): %v", cfg.CustomCommandService, err) + if err2 := replyText(reply, fmt.Sprintf("failed to interact with command service(err: %v)", err)); err2 != nil { + return fmt.Errorf("failed to reply: %v", err) + } + + return nil + } + + if response.Status != http.StatusOK { + logger.Errorf("failed to request from custom command service(%s)(2): %d", cfg.CustomCommandService, response.Status) + if err := replyText(reply, fmt.Sprintf("failed to interact with command service (status: %d, response: %s)", response.Status, response.String())); err != nil { + return fmt.Errorf("failed to reply: %v", err) + } + + return nil + } + + answer := response.Get("answer").String() + if answer == "" { + logger.Error("failed to request from custom command service(%s): empty answer (response: %s)", cfg.CustomCommandService, response.String()) + if err := replyText(reply, fmt.Sprintf("no answer found, unexpected response from custom command service(response: %s)", response.String())); err != nil { + return fmt.Errorf("failed to reply: %v", err) + } + + return nil + } + + if err := replyText(reply, answer); err != nil { + return fmt.Errorf("failed to reply: %v", err) + } + + return nil + }, + } +} diff --git a/commands/draw.go b/commands/draw.go new file mode 100644 index 0000000..ed014e3 --- /dev/null +++ b/commands/draw.go @@ -0,0 +1,68 @@ +package commands + +import ( + "github.com/go-zoox/chatbot-feishu" + chatgpt "github.com/go-zoox/chatgpt-client" + "github.com/go-zoox/core-utils/fmt" + "github.com/go-zoox/core-utils/strings" + "github.com/go-zoox/feishu" + feishuEvent "github.com/go-zoox/feishu/event" + feishuImage "github.com/go-zoox/feishu/image" + "github.com/go-zoox/fetch" + "github.com/go-zoox/fs" + "github.com/go-zoox/logger" + openaiclient "github.com/go-zoox/openai-client" +) + +func CreateDrawCommand( + feishuClient feishu.Client, + chatgptClient chatgpt.Client, +) *chatbot.Command { + return &chatbot.Command{ + Handler: func(args []string, request *feishuEvent.EventRequest, reply chatbot.MessageReply) error { + prompt := strings.Join(args, " ") + if prompt == "" { + return replyText(reply, fmt.Sprintf("prompt is required (args: %s)", strings.Join(args, " "))) + } + + logger.Infof("[draw]: %v", prompt) + + logger.Infof("[draw]: request image generation ...") + response, err := chatgptClient.ImageGeneration(&openaiclient.ImageGenerationRequest{ + Prompt: prompt, + }) + if err != nil { + return replyText(reply, fmt.Sprintf("failed to request image generation: %v", err)) + } + + for _, image := range response.Data { + tmpFilePath := fs.TmpFilePath() + + logger.Infof("[draw] download image from chatgpt: %v", image.URL) + _, err := fetch.Download(image.URL, tmpFilePath, &fetch.Config{}) + if err != nil { + return replyText(reply, fmt.Sprintf("failed to download image: %v", err)) + } + + tmpFile, err := fs.Open(tmpFilePath) + if err != nil { + return replyText(reply, fmt.Sprintf("failed to open image: %v", err)) + } + + logger.Infof("[draw] upload image to feishu ...") + response, err := feishuClient.Image().Upload(&feishuImage.UploadRequest{ + ImageType: "message", + Image: tmpFile, + }) + if err != nil { + return replyText(reply, fmt.Sprintf("failed to upload image: %v", err)) + } + + logger.Infof("[draw] reply image to feishu: %v", response.ImageKey) + replyImage(reply, response.ImageKey) + } + + return nil + }, + } +} diff --git a/commands/message.go b/commands/message.go new file mode 100644 index 0000000..e99a43c --- /dev/null +++ b/commands/message.go @@ -0,0 +1,166 @@ +package commands + +import ( + "time" + + "github.com/go-zoox/core-utils/regexp" + + "github.com/go-zoox/chatbot-feishu" + chatgpt "github.com/go-zoox/chatgpt-client" + "github.com/go-zoox/chatgpt-for-chatbot-feishu/config" + "github.com/go-zoox/core-utils/fmt" + "github.com/go-zoox/core-utils/strings" + "github.com/go-zoox/feishu" + feishuEvent "github.com/go-zoox/feishu/event" + mc "github.com/go-zoox/feishu/message/content" + "github.com/go-zoox/logger" + "github.com/go-zoox/retry" +) + +func CreateMessageCommand( + feishuClient feishu.Client, + chatgptClient chatgpt.Client, + cfg *config.Config, +) *chatbot.Command { + return &chatbot.Command{ + Handler: func(args []string, request *feishuEvent.EventRequest, reply func(content string, msgType ...string) error) (err error) { + text := strings.Join(args, " ") + + // fmt.PrintJSON(request) + if cfg.BotInfo == nil { + logger.Infof("Trying to get bot info ...") + cfg.BotInfo, err = feishuClient.Bot().GetBotInfo() + if err != nil { + return fmt.Errorf("failed to get bot info: %v", err) + } + } + + user, err := getUser(feishuClient, request, cfg) + if err != nil { + return fmt.Errorf("failed to get user: %v", err) + } + + textMessage := strings.TrimSpace(text) + if textMessage == "" { + return nil + } + + var question string + // group chat + if request.IsGroupChat() { + // @ + if ok := regexp.Match("^@_user_1", textMessage); ok { + for _, metion := range request.Event.Message.Mentions { + if metion.Key == "@_user_1" && metion.ID.OpenID == cfg.BotInfo.OpenID { + question = textMessage[len("@_user_1"):] + question = strings.TrimSpace(question) + break + } + } + } else if ok := regexp.Match("^/chatgpt\\s+", textMessage); ok { + // command: /chatgpt + question = textMessage[len("/chatgpt "):] + } + } else if request.IsP2pChat() { + question = textMessage + } + + question = strings.TrimSpace(question) + if question == "" { + logger.Infof("ignore empty question message") + return nil + } + + // @TODO 离线服务 + if !cfg.IsInService { + return replyText(reply, cfg.OfflineMessage) + } + + go func() { + logger.Debugf("%s 问 ChatGPT:%s", user.User.Name, question) + + var err error + + conversation, err := chatgptClient.GetOrCreateConversation(request.ChatID(), &chatgpt.ConversationConfig{ + MaxMessages: 50, + Model: cfg.OpenAIModel, + }) + if err != nil { + logger.Errorf("failed to get or create conversation by ChatID %s", request.ChatID()) + return + } + + if err := conversation.IsQuestionAsked(request.Event.Message.MessageID); err != nil { + logger.Warnf("duplicated event(id: %s): %v", request.Event.Message.MessageID, err) + return + } + + var answer []byte + err = retry.Retry(func() error { + + answer, err = conversation.Ask([]byte(question), &chatgpt.ConversationAskConfig{ + ID: request.Event.Message.MessageID, + User: user.User.Name, + }) + if err != nil { + logger.Errorf("failed to request answer: %v", err) + return fmt.Errorf("failed to request answer: %v", err) + } + + return nil + }, 5, 3*time.Second) + if err != nil { + logger.Errorf("failed to get answer: %v", err) + msgType, content, err := mc. + NewContent(). + Text(&mc.ContentTypeText{ + Text: "ChatGPT 繁忙,请稍后重试", + }). + Build() + if err != nil { + logger.Errorf("failed to build content: %v", err) + return + } + if err := reply(string(content), msgType); err != nil { + return + } + return + } + + logger.Debugf("ChatGPT 答 %s:%s", user.User.Name, answer) + + responseMessage := string(answer) + // if request.IsGroupChat() { + // responseMessage = fmt.Sprintf("%s\n-------------\n%s", question, answer) + // } + + msgType, content, err := mc. + NewContent(). + Post(&mc.ContentTypePost{ + ZhCN: &mc.ContentTypePostBody{ + Content: [][]mc.ContentTypePostBodyItem{ + { + { + Tag: "text", + UnEscape: true, + Text: responseMessage, + }, + }, + }, + }, + }). + Build() + if err != nil { + logger.Errorf("failed to build content: %v", err) + return + } + if err := reply(string(content), msgType); err != nil { + logger.Errorf("failed to reply: %v", err) + return + } + }() + + return nil + }, + } +} diff --git a/commands/model.go b/commands/model.go new file mode 100644 index 0000000..9c3b325 --- /dev/null +++ b/commands/model.go @@ -0,0 +1,60 @@ +package commands + +import ( + "github.com/go-zoox/chatbot-feishu" + chatgpt "github.com/go-zoox/chatgpt-client" + "github.com/go-zoox/chatgpt-for-chatbot-feishu/config" + "github.com/go-zoox/core-utils/fmt" + "github.com/go-zoox/core-utils/strings" + "github.com/go-zoox/feishu" + feishuEvent "github.com/go-zoox/feishu/event" +) + +func CreateModelCommand( + feishuClient feishu.Client, + chatgptClient chatgpt.Client, + cfg *config.Config, +) *chatbot.Command { + return &chatbot.Command{ + ArgsLength: 1, + Handler: func(args []string, request *feishuEvent.EventRequest, reply func(content string, msgType ...string) error) error { + if err := isAllowToDo(feishuClient, cfg, request, "model"); err != nil { + return err + } + + if len(args) == 0 || args[0] == "" { + currentModel, err := chatgptClient.GetConversationModel(request.ChatID(), &chatgpt.ConversationConfig{ + MaxMessages: 50, + Model: cfg.OpenAIModel, + }) + if err != nil { + return fmt.Errorf("failed to get model by conversation(%s)", request.ChatID()) + } + + if err := replyText(reply, fmt.Sprintf("当前模型:%s", currentModel)); err != nil { + return fmt.Errorf("failed to reply: %v", err) + } + + return nil + } + + model := args[0] + if model == "" { + return fmt.Errorf("model name is required (args: %s)", strings.Join(args, " ")) + } + + if err := chatgptClient.ChangeConversationModel(request.ChatID(), model, &chatgpt.ConversationConfig{ + MaxMessages: 50, + Model: cfg.OpenAIModel, + }); err != nil { + return fmt.Errorf("failed to set model(%s) for conversation(%s)", model, request.ChatID()) + } + + if err := replyText(reply, fmt.Sprintf("succeed to set model: %s", model)); err != nil { + return fmt.Errorf("failed to reply: %v", err) + } + + return nil + }, + } +} diff --git a/commands/offline.go b/commands/offline.go new file mode 100644 index 0000000..f282fb5 --- /dev/null +++ b/commands/offline.go @@ -0,0 +1,32 @@ +package commands + +import ( + "github.com/go-zoox/chatbot-feishu" + chatgpt "github.com/go-zoox/chatgpt-client" + "github.com/go-zoox/chatgpt-for-chatbot-feishu/config" + "github.com/go-zoox/core-utils/fmt" + "github.com/go-zoox/feishu" + feishuEvent "github.com/go-zoox/feishu/event" +) + +func CreateOfflineCommand( + feishuClient feishu.Client, + chatgptClient chatgpt.Client, + cfg *config.Config, +) *chatbot.Command { + return &chatbot.Command{ + Handler: func(args []string, request *feishuEvent.EventRequest, reply func(content string, msgType ...string) error) error { + if err := isAllowToDo(feishuClient, cfg, request, "online"); err != nil { + return err + } + + cfg.IsInService = false + + if err := replyText(reply, "succeed to offline"); err != nil { + return fmt.Errorf("failed to reply: %v", err) + } + + return nil + }, + } +} diff --git a/commands/online.go b/commands/online.go new file mode 100644 index 0000000..3b4a95a --- /dev/null +++ b/commands/online.go @@ -0,0 +1,32 @@ +package commands + +import ( + "github.com/go-zoox/chatbot-feishu" + chatgpt "github.com/go-zoox/chatgpt-client" + "github.com/go-zoox/chatgpt-for-chatbot-feishu/config" + "github.com/go-zoox/core-utils/fmt" + "github.com/go-zoox/feishu" + feishuEvent "github.com/go-zoox/feishu/event" +) + +func CreateOnlineCommand( + feishuClient feishu.Client, + chatgptClient chatgpt.Client, + cfg *config.Config, +) *chatbot.Command { + return &chatbot.Command{ + Handler: func(args []string, request *feishuEvent.EventRequest, reply func(content string, msgType ...string) error) error { + if err := isAllowToDo(feishuClient, cfg, request, "online"); err != nil { + return err + } + + cfg.IsInService = true + + if err := replyText(reply, "succeed to online"); err != nil { + return fmt.Errorf("failed to reply: %v", err) + } + + return nil + }, + } +} diff --git a/commands/ping.go b/commands/ping.go new file mode 100644 index 0000000..30bd3ec --- /dev/null +++ b/commands/ping.go @@ -0,0 +1,24 @@ +package commands + +import ( + "github.com/go-zoox/chatbot-feishu" + chatgpt "github.com/go-zoox/chatgpt-client" + "github.com/go-zoox/core-utils/fmt" + "github.com/go-zoox/feishu" + feishuEvent "github.com/go-zoox/feishu/event" +) + +func CreatePingCommand( + feishuClient feishu.Client, + chatgptClient chatgpt.Client, +) *chatbot.Command { + return &chatbot.Command{ + Handler: func(args []string, request *feishuEvent.EventRequest, reply func(content string, msgType ...string) error) error { + if err := replyText(reply, "pong"); err != nil { + return fmt.Errorf("failed to reply: %v", err) + } + + return nil + }, + } +} diff --git a/commands/reset.go b/commands/reset.go new file mode 100644 index 0000000..e359f75 --- /dev/null +++ b/commands/reset.go @@ -0,0 +1,34 @@ +package commands + +import ( + "github.com/go-zoox/chatbot-feishu" + chatgpt "github.com/go-zoox/chatgpt-client" + "github.com/go-zoox/chatgpt-for-chatbot-feishu/config" + "github.com/go-zoox/core-utils/fmt" + "github.com/go-zoox/feishu" + feishuEvent "github.com/go-zoox/feishu/event" +) + +func CreateResetCommand( + feishuClient feishu.Client, + chatgptClient chatgpt.Client, + cfg *config.Config, +) *chatbot.Command { + return &chatbot.Command{ + Handler: func(args []string, request *feishuEvent.EventRequest, reply chatbot.MessageReply) error { + if err := isAllowToDo(feishuClient, cfg, request, "reset"); err != nil { + return err + } + + if err := chatgptClient.ResetConversation(request.ChatID()); err != nil { + return fmt.Errorf("failed to reset conversation(%s)", request.ChatID()) + } + + if err := replyText(reply, "succeed to reset"); err != nil { + return fmt.Errorf("failed to reply: %v", err) + } + + return nil + }, + } +} diff --git a/commands/utils.go b/commands/utils.go new file mode 100644 index 0000000..5517a73 --- /dev/null +++ b/commands/utils.go @@ -0,0 +1,99 @@ +package commands + +import ( + "github.com/go-zoox/chatgpt-for-chatbot-feishu/config" + "github.com/go-zoox/core-utils/fmt" + "github.com/go-zoox/feishu" + "github.com/go-zoox/feishu/contact/user" + feishuEvent "github.com/go-zoox/feishu/event" + mc "github.com/go-zoox/feishu/message/content" +) + +func replyText(reply func(content string, msgType ...string) error, text string) error { + msgType, content, err := mc. + NewContent(). + Post(&mc.ContentTypePost{ + ZhCN: &mc.ContentTypePostBody{ + Content: [][]mc.ContentTypePostBodyItem{ + { + { + Tag: "text", + UnEscape: true, + Text: text, + }, + }, + }, + }, + }). + Build() + if err != nil { + return fmt.Errorf("failed to build content: %v", err) + } + if err := reply(string(content), msgType); err != nil { + return fmt.Errorf("failed to reply: %v", err) + } + + return nil +} + +func replyImage(reply func(content string, msgType ...string) error, imageKey string) error { + msgType, content, err := mc. + NewContent(). + Image(&mc.ContentTypeImage{ + ImageKey: imageKey, + }). + Build() + if err != nil { + return fmt.Errorf("failed to build content: %v", err) + } + if err := reply(string(content), msgType); err != nil { + return fmt.Errorf("failed to reply: %v", err) + } + + return nil +} + +func isAllowToDo(feishuClient feishu.Client, cfg *config.Config, request *feishuEvent.EventRequest, command string) (reason error) { + if cfg.AdminEmail != "" { + eventSender, err := feishuClient.Contact().User().Retrieve(&user.RetrieveRequest{ + UserIDType: "open_id", + UserID: request.Sender().SenderID.OpenID, + }) + if err != nil { + return fmt.Errorf("failed to retrieve user with openid(%s): %v", request.Sender().SenderID.OpenID, err) + } + + if eventSender.User.EnterpriseEmail != cfg.AdminEmail && eventSender.User.Email != cfg.AdminEmail { + return fmt.Errorf("user(%s) is not allow to do action: %s", eventSender.User.Name, command) + } + + return nil + } + + return fmt.Errorf("admin email is not set, not allow to do action: %s", command) +} + +func getUser(feishuClient feishu.Client, request *feishuEvent.EventRequest, cfg *config.Config) (*user.RetrieveResponse, error) { + sender := request.Sender() + + if cfg.AdminEmail != "" { + eventSender, err := feishuClient.Contact().User().Retrieve(&user.RetrieveRequest{ + UserIDType: "open_id", + UserID: sender.SenderID.OpenID, + }) + if err != nil { + return nil, fmt.Errorf("failed to retrieve user with openid(%s): %v", sender.SenderID.OpenID, err) + } + + return eventSender, nil + } + + return &user.RetrieveResponse{ + User: user.UserEntity{ + Name: sender.SenderID.UserID, + OpenID: sender.SenderID.OpenID, + UnionID: sender.SenderID.UnionID, + UserID: sender.SenderID.UserID, + }, + }, nil +} diff --git a/config/config.go b/config/config.go new file mode 100644 index 0000000..962c6cb --- /dev/null +++ b/config/config.go @@ -0,0 +1,62 @@ +package config + +import ( + feishuBot "github.com/go-zoox/feishu/bot" +) + +type Config struct { + Port int64 + APIPath string + OpenAIAPIKey string + OpenAIAPITimeout int64 + AppID string + AppSecret string + EncryptKey string + VerificationToken string + // + ReportURL string + // + SiteURL string + // + OpenAIModel string + // + FeishuBaseURI string + // + ConversationContext string + ConversationLanguage string + // + LogsDir string + LogsLevel string + // + OfflineMessage string + // + AdminEmail string + // + BotName string + + // Proxy sets the request proxy. + // support http, https, socks5 + // example: + // http://127.0.0.1:17890 + // https://127.0.0.1:17890 + // socks5://127.0.0.1:17890 + Proxy string + + OpenAIAPIServer string + + OpenAIAPIType string + OpenAIAzureResource string + OpenAIAzureDeployment string + OpenAIAzureAPIVersion string + + // Custom Command with Service + CustomCommand string + CustomCommandService string + + // + Version string + + // @TODO State + IsInService bool + BotInfo *feishuBot.GetBotInfoResponse +} diff --git a/go.mod b/go.mod index e89be37..8db282a 100644 --- a/go.mod +++ b/go.mod @@ -4,76 +4,116 @@ go 1.20 require ( github.com/go-zoox/chalk v1.0.2 - github.com/go-zoox/chatbot-feishu v1.2.10 - github.com/go-zoox/chatgpt-client v1.5.3 - github.com/go-zoox/cli v1.2.0 - github.com/go-zoox/core-utils v1.2.11 - github.com/go-zoox/feishu v1.3.11 - github.com/go-zoox/fetch v1.7.7 - github.com/go-zoox/fs v1.3.13 - github.com/go-zoox/logger v1.4.4 - github.com/go-zoox/openai-client v1.4.3 - github.com/go-zoox/proxy v1.4.0 + github.com/go-zoox/chatbot-feishu v1.3.0 + github.com/go-zoox/chatgpt-client v1.6.0 + github.com/go-zoox/cli v1.3.6 + github.com/go-zoox/core-utils v1.3.1 + github.com/go-zoox/feishu v1.4.0 + github.com/go-zoox/fetch v1.7.16 + github.com/go-zoox/fs v1.3.14 + github.com/go-zoox/logger v1.4.6 + github.com/go-zoox/openai-client v1.5.1 github.com/go-zoox/retry v1.0.3 - github.com/go-zoox/zoox v1.10.6 + github.com/go-zoox/zoox v1.12.29 ) require ( + github.com/Azure/go-ansiterm v0.0.0-20230124172434-306776ec8161 // indirect + github.com/Microsoft/go-winio v0.6.1 // indirect github.com/cespare/xxhash/v2 v2.2.0 // indirect github.com/cpuguy83/go-md2man/v2 v2.0.2 // indirect + github.com/creack/pty v1.1.21 // indirect github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f // indirect - github.com/fsnotify/fsnotify v1.6.0 // indirect + github.com/distribution/reference v0.5.0 // indirect + github.com/docker/cli v24.0.7+incompatible // indirect + github.com/docker/distribution v2.8.3+incompatible // indirect + github.com/docker/docker v24.0.7+incompatible // indirect + github.com/docker/go-connections v0.4.0 // indirect + github.com/docker/go-units v0.5.0 // indirect + github.com/fatih/color v1.16.0 // indirect + github.com/fsnotify/fsnotify v1.7.0 // indirect + github.com/go-errors/errors v1.5.1 // indirect github.com/go-redis/redis/v8 v8.11.5 // indirect - github.com/go-zoox/cache v1.0.3 // indirect + github.com/go-zoox/cache v1.0.6 // indirect + github.com/go-zoox/command v1.2.9 // indirect + github.com/go-zoox/commands-as-a-service v1.6.5 // indirect github.com/go-zoox/compress v1.0.1 // indirect + github.com/go-zoox/concurrency v1.2.0 // indirect + github.com/go-zoox/config v1.2.10 // indirect github.com/go-zoox/cookie v1.2.0 // indirect - github.com/go-zoox/counter v1.2.0 // indirect + github.com/go-zoox/counter v1.2.1 // indirect github.com/go-zoox/cron v1.1.2 // indirect github.com/go-zoox/crypto v1.1.8 // indirect - github.com/go-zoox/datetime v1.1.1 // indirect - github.com/go-zoox/debug v1.0.1 // indirect + github.com/go-zoox/datetime v1.2.2 // indirect + github.com/go-zoox/debug v1.0.2 // indirect github.com/go-zoox/dotenv v1.2.3 // indirect github.com/go-zoox/encoding v1.2.1 // indirect github.com/go-zoox/errors v1.0.2 // indirect github.com/go-zoox/gzip v1.0.0 // indirect - github.com/go-zoox/headers v1.0.6 // indirect + github.com/go-zoox/headers v1.0.8 // indirect + github.com/go-zoox/i18n v1.0.3 // indirect + github.com/go-zoox/ini v1.0.4 // indirect github.com/go-zoox/jobqueue v1.0.0 // indirect + github.com/go-zoox/jsonrpc v1.2.2 // indirect github.com/go-zoox/jwt v1.3.0 // indirect - github.com/go-zoox/kv v1.5.1 // indirect + github.com/go-zoox/kv v1.5.9 // indirect github.com/go-zoox/lru v1.0.1 // indirect + github.com/go-zoox/mq v1.0.1 // indirect + github.com/go-zoox/proxy v1.5.6 // indirect + github.com/go-zoox/pubsub v1.2.2 // indirect github.com/go-zoox/random v1.0.4 // indirect - github.com/go-zoox/ratelimit v1.2.0 // indirect + github.com/go-zoox/ratelimit v1.2.1 // indirect github.com/go-zoox/safe v1.0.1 // indirect github.com/go-zoox/session v1.2.0 // indirect - github.com/go-zoox/tag v1.2.2 // indirect + github.com/go-zoox/tag v1.2.3 // indirect github.com/go-zoox/uuid v0.0.1 // indirect - github.com/google/uuid v1.3.0 // indirect - github.com/gorilla/websocket v1.5.0 // indirect + github.com/goccy/go-yaml v1.11.2 // indirect + github.com/gogo/protobuf v1.3.2 // indirect + github.com/google/uuid v1.4.0 // indirect + github.com/gorilla/websocket v1.5.1 // indirect github.com/joho/godotenv v1.5.1 // indirect + github.com/kardianos/osext v0.0.0-20190222173326-2bc1f35cddc0 // indirect + github.com/mattn/go-colorable v0.1.13 // indirect + github.com/mattn/go-isatty v0.0.20 // indirect + github.com/moby/term v0.5.0 // indirect + github.com/morikuni/aec v1.0.0 // indirect + github.com/opencontainers/go-digest v1.0.0 // indirect + github.com/opencontainers/image-spec v1.0.2 // indirect + github.com/pelletier/go-toml v1.9.5 // indirect github.com/pkg/errors v0.9.1 // indirect + github.com/redis/go-redis/v9 v9.3.0 // indirect github.com/robfig/cron/v3 v3.0.1 // indirect github.com/russross/blackfriday/v2 v2.1.0 // indirect + github.com/sevlyar/go-daemon v0.1.6 // indirect + github.com/sirupsen/logrus v1.9.3 // indirect github.com/spf13/cast v1.5.1 // indirect - github.com/tidwall/gjson v1.14.4 // indirect + github.com/tidwall/gjson v1.17.0 // indirect github.com/tidwall/match v1.1.1 // indirect github.com/tidwall/pretty v1.2.1 // indirect - github.com/urfave/cli/v2 v2.24.4 // indirect + github.com/urfave/cli/v2 v2.25.7 // indirect github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673 // indirect - golang.org/x/crypto v0.10.0 // indirect - golang.org/x/net v0.11.0 // indirect - golang.org/x/sys v0.9.0 // indirect - golang.org/x/text v0.10.0 // indirect + golang.org/x/crypto v0.15.0 // indirect + golang.org/x/mod v0.14.0 // indirect + golang.org/x/net v0.18.0 // indirect + golang.org/x/sys v0.14.0 // indirect + golang.org/x/text v0.14.0 // indirect + golang.org/x/tools v0.15.0 // indirect + golang.org/x/xerrors v0.0.0-20231012003039-104605ab7028 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) // replace github.com/go-zoox/chatbot-feishu => ../chatbot-feishu -// replace github.com/go-zoox/chatgpt-client => ../chatgpt-client - // replace github.com/go-zoox/feishu => ../feishu // replace github.com/go-zoox/logger => ../logger -// replace github.com/go-zoox/openai-client => ../openai-client +// replace github.com/go-zoox/chatbot-feishu => ../../go-zoox/chatbot-feishu + +// replace github.com/go-zoox/openai-client => ../../go-zoox/openai-client + +// replace github.com/go-zoox/chatgpt-client => ../../go-zoox/chatgpt-client + +// replace github.com/go-zoox/feishu => ../../go-zoox/feishu // replace github.com/go-zoox/zoox => ../zoox diff --git a/go.sum b/go.sum index 413f0e7..feaef34 100644 --- a/go.sum +++ b/go.sum @@ -1,3 +1,9 @@ +github.com/Azure/go-ansiterm v0.0.0-20230124172434-306776ec8161 h1:L/gRVlceqvL25UVaW/CKtUDjefjrs0SPonmDGUVOYP0= +github.com/Azure/go-ansiterm v0.0.0-20230124172434-306776ec8161/go.mod h1:xomTg63KZ2rFqZQzSB4Vz2SUXa1BpHTVz9L5PTmPC4E= +github.com/Microsoft/go-winio v0.6.1 h1:9/kr64B9VUZrLm5YYwbGtUJnMgqWVOdUAXu6Migciow= +github.com/Microsoft/go-winio v0.6.1/go.mod h1:LRdKpFKfdobln8UmuiYcKPot9D2v6svN5+sAH+4kjUM= +github.com/bsm/ginkgo/v2 v2.12.0 h1:Ny8MWAHyOepLGlLKYmXG4IEkioBysk6GpaRTLC8zwWs= +github.com/bsm/gomega v1.27.10 h1:yeMWxP2pV2fG3FgAODIY8EiRE3dy0aeFYt4l7wh6yKA= github.com/cespare/xxhash/v2 v2.1.2/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= github.com/cespare/xxhash/v2 v2.2.0 h1:DC2CZ1Ep5Y4k3ZQ899DldepgrayRUGE6BBZ/cd9Cj44= github.com/cespare/xxhash/v2 v2.2.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= @@ -7,62 +13,92 @@ github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMn github.com/cpuguy83/go-md2man/v2 v2.0.2 h1:p1EgwI/C7NhT0JmVkwCD2ZBK8j4aeHQX2pMHHBfMQ6w= github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= +github.com/creack/pty v1.1.21 h1:1/QdRyBaHHJP61QkWMXlOIBfsgdDeeKfK8SYVUWJKf0= +github.com/creack/pty v1.1.21/go.mod h1:MOBLtS5ELjhRRrroQr9kyvTxUAFNvYEK993ew/Vr4O4= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f h1:lO4WD4F/rVNCu3HqELle0jiPLLBs70cWOduZpkS1E78= github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f/go.mod h1:cuUVRXasLTGF7a8hSLbxyZXjz+1KgoB3wDUb6vlszIc= +github.com/distribution/reference v0.5.0 h1:/FUIFXtfc/x2gpa5/VGfiGLuOIdYa1t65IKK2OFGvA0= +github.com/distribution/reference v0.5.0/go.mod h1:BbU0aIcezP1/5jX/8MP0YiH4SdvB5Y4f/wlDRiLyi3E= +github.com/docker/cli v24.0.7+incompatible h1:wa/nIwYFW7BVTGa7SWPVyyXU9lgORqUb1xfI36MSkFg= +github.com/docker/cli v24.0.7+incompatible/go.mod h1:JLrzqnKDaYBop7H2jaqPtU4hHvMKP+vjCwu2uszcLI8= +github.com/docker/distribution v2.8.3+incompatible h1:AtKxIZ36LoNK51+Z6RpzLpddBirtxJnzDrHLEKxTAYk= +github.com/docker/distribution v2.8.3+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w= +github.com/docker/docker v24.0.7+incompatible h1:Wo6l37AuwP3JaMnZa226lzVXGA3F9Ig1seQen0cKYlM= +github.com/docker/docker v24.0.7+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= +github.com/docker/go-connections v0.4.0 h1:El9xVISelRB7BuFusrZozjnkIM5YnzCViNKohAFqRJQ= +github.com/docker/go-connections v0.4.0/go.mod h1:Gbd7IOopHjR8Iph03tsViu4nIes5XhDvyHbTtUxmeec= +github.com/docker/go-units v0.5.0 h1:69rxXcBk27SvSaaxTtLh/8llcHD8vYHT7WSdRZ/jvr4= +github.com/docker/go-units v0.5.0/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk= github.com/fatih/color v1.10.0/go.mod h1:ELkj/draVOlAH/xkhN6mQ50Qd0MPOk5AAr3maGEBuJM= github.com/fatih/color v1.13.0/go.mod h1:kLAiJbzzSOZDVNGyDpeOxJ47H46qBXwg5ILebYFFOfk= +github.com/fatih/color v1.16.0 h1:zmkK9Ngbjj+K0yRhTVONQh1p/HknKYSlNT+vZCzyokM= +github.com/fatih/color v1.16.0/go.mod h1:fL2Sau1YI5c0pdGEVCbKQbLXB6edEj1ZgiY4NijnWvE= github.com/frankban/quicktest v1.14.4 h1:g2rn0vABPOOXmZUj+vbmUp0lPoXEMuhTpIluN0XL9UY= github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ= -github.com/fsnotify/fsnotify v1.6.0 h1:n+5WquG0fcWoWp6xPWfHdbskMCQaFnG6PfBrh1Ky4HY= -github.com/fsnotify/fsnotify v1.6.0/go.mod h1:sl3t1tCWJFWoRz9R8WJCbQihKKwmorjAbSClcnxKAGw= +github.com/fsnotify/fsnotify v1.7.0 h1:8JEhPFa5W2WU7YfeZzPNqzMP6Lwt7L2715Ggo0nosvA= +github.com/fsnotify/fsnotify v1.7.0/go.mod h1:40Bi/Hjc2AVfZrqy+aj+yEI+/bRxZnMJyTJwOpGvigM= +github.com/go-errors/errors v1.5.1 h1:ZwEMSLRCapFLflTpT7NKaAc7ukJ8ZPEjzlxt8rPN8bk= +github.com/go-errors/errors v1.5.1/go.mod h1:sIVyrIiJhuEF+Pj9Ebtd6P/rEYROXFi3BopGUQ5a5Og= github.com/go-playground/assert/v2 v2.0.1/go.mod h1:VDjEfimB/XKnb+ZQfWdccd7VUvScMdVu0Titje2rxJ4= github.com/go-playground/locales v0.13.0/go.mod h1:taPMhCMXrRLJO55olJkUXHZBHCxTMfnGwq/HNwmWNS8= +github.com/go-playground/locales v0.14.0 h1:u50s323jtVGugKlcYeyzC0etD1HifMjqmJqb8WugfUU= github.com/go-playground/locales v0.14.0/go.mod h1:sawfccIbzZTqEDETgFXqTho0QybSa7l++s0DH+LDiLs= github.com/go-playground/universal-translator v0.17.0/go.mod h1:UkSxE5sNxxRwHyU+Scu5vgOQjsIJAF8j9muTVoKLVtA= +github.com/go-playground/universal-translator v0.18.0 h1:82dyy6p4OuJq4/CByFNOn/jYrnRPArHwAcmLoJZxyho= github.com/go-playground/universal-translator v0.18.0/go.mod h1:UvRDBj+xPUEGrFYl+lu/H90nyDXpg0fqeB/AQUGNTVA= github.com/go-playground/validator/v10 v10.4.1/go.mod h1:nlOn6nFhuKACm19sB/8EGNn9GlaMV7XkbRSipzJ0Ii4= github.com/go-playground/validator/v10 v10.10.0/go.mod h1:74x4gJWsvQexRdW8Pn3dXSGrTK4nAUsbPlLADvpJkos= +github.com/go-playground/validator/v10 v10.11.0 h1:0W+xRM511GY47Yy3bZUbJVitCNg2BOGlCyvTqsp/xIw= github.com/go-redis/redis/v8 v8.11.5 h1:AcZZR7igkdvfVmQTPnu9WE37LRrO/YrBH5zWyjDC0oI= github.com/go-redis/redis/v8 v8.11.5/go.mod h1:gREzHqY1hg6oD9ngVRbLStwAWKhA0FEgq8Jd4h5lpwo= github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0/go.mod h1:fyg7847qk6SyHyPtNmDHnmrv/HOrqktSC+C9fM+CJOE= github.com/go-yaml/yaml v2.1.0+incompatible/go.mod h1:w2MrLa16VYP0jy6N7M5kHaCkaLENm+P+Tv+MfurjSw0= -github.com/go-zoox/cache v1.0.3 h1:wsOcVeYallM+lQ4ap6wp46utbR2956VtOHVVuaqVeE0= -github.com/go-zoox/cache v1.0.3/go.mod h1:E+rxSaCqW0o/fM5KQSueJlEcUZQ9x3penrSMh8RBCqc= +github.com/go-zoox/cache v1.0.6 h1:Ozix1WuLvyMb4laZozL2LVEjYA5SwjmoFfqUXO3Luhg= +github.com/go-zoox/cache v1.0.6/go.mod h1:rDQPnldnf1V8tKCn5e1MrkDXI2BFTws7PniTQQa2lpc= github.com/go-zoox/chalk v1.0.1/go.mod h1:z5+qvE9nEJI5uT4px2tyoFa/xxkqf3CUo22KmXLKbNI= github.com/go-zoox/chalk v1.0.2 h1:DCWft37fogmvqF37JdbGSLg28L/tQeA8u0lMvb62KOg= github.com/go-zoox/chalk v1.0.2/go.mod h1:z5+qvE9nEJI5uT4px2tyoFa/xxkqf3CUo22KmXLKbNI= -github.com/go-zoox/chatbot-feishu v1.2.10 h1:HCbZOQr6u2u76mqjslXdKoecNCCki2ue+jkUof25Ajk= -github.com/go-zoox/chatbot-feishu v1.2.10/go.mod h1:DOYszjwta05Xg87acn2+CtmROLEqanHjwxROn4FpGzE= -github.com/go-zoox/chatgpt-client v1.5.3 h1:p5nDMFigg/3HHdv5YWr2R4Atvc+yR7xkTENtMP8/4eA= -github.com/go-zoox/chatgpt-client v1.5.3/go.mod h1:rkk5/ABpRur+Qe1lljjEusOkDaHfXv+ck7MhVEKmRYg= -github.com/go-zoox/cli v1.2.0 h1:qBDHwcv2o5xgqGpYokxSszs8MVdNzaNZJJroAhpevFM= -github.com/go-zoox/cli v1.2.0/go.mod h1:p2VJxwXFJRp3+nt29/LihKTNzwAFRkIhnFpf3hyVrmE= +github.com/go-zoox/chatbot-feishu v1.3.0 h1:FW8F0ApQRQELHpwaG5dzrSLwXBTBegRs1eGILXC/UnA= +github.com/go-zoox/chatbot-feishu v1.3.0/go.mod h1:EmJRYc27aLYWoPAupEsUBmzhn8r/5YYbzgAGXZjBlHo= +github.com/go-zoox/chatgpt-client v1.6.0 h1:ZK2vofPHHQPLbMEse+E7mCsR7oVB6nRPv+V8wMHdrxg= +github.com/go-zoox/chatgpt-client v1.6.0/go.mod h1:TESQEVmYUcjTgWyFP9KcBWHIUWD6uygwEMapwI0MPOs= +github.com/go-zoox/cli v1.3.6 h1:+A4l9aBBvqO/xXjwZ1PCcX0ue/HZ/Ft0Wp/dDq27iVE= +github.com/go-zoox/cli v1.3.6/go.mod h1:25ox3mVRJdRSyLJLvK8OHYEuXtMtfkTseWkJjlK9kM4= +github.com/go-zoox/command v1.2.9 h1:7vY0TJ3iXB7qmmhdmx+CcRWDrrPq0ITEm8NXLMLT/g4= +github.com/go-zoox/command v1.2.9/go.mod h1:U6Jt52RImxJVpSHAwYl4V5eESk5QRpRXoboXqu1oz5k= +github.com/go-zoox/commands-as-a-service v1.6.5 h1:JQJpgP9VorTySGDP1gd1jC/Ildy4gTok6zWkD3S9NEs= +github.com/go-zoox/commands-as-a-service v1.6.5/go.mod h1:oWIRqTWIzmJdgVB1UoAgiCfFoswhJ8PDfATmb+JLsHE= github.com/go-zoox/compress v1.0.1 h1:EyNxo5NscMLua5fvUdiGSF+BwhuTfMeyppu7OwKAW7Q= github.com/go-zoox/compress v1.0.1/go.mod h1:iV6CcNulf3OuEfA1h1VOsaBqYH81cVSg5wNi5HDx2h4= +github.com/go-zoox/concurrency v1.2.0 h1:iucwSWQ0Y9fFIG+eZvyHjMrIPSnaKJTGfOcGbIx91yg= +github.com/go-zoox/concurrency v1.2.0/go.mod h1:rghauUPHEDp8HJzaVlU851HWqiAqD8lUVp45K/dtNvw= +github.com/go-zoox/config v1.2.10 h1:mebuz6O0N81OXOCwtV+LKOiFuAfZ5wyaGsuzkGSSpf4= +github.com/go-zoox/config v1.2.10/go.mod h1:KnSEhz7AVMqQfznJzgpzFhQfgy8UZYeone/osbvnVUE= github.com/go-zoox/cookie v1.2.0 h1:MO33lPQ/QGJIAEzgrsAfEpJc25lcJ/XR0w+smM19sNQ= github.com/go-zoox/cookie v1.2.0/go.mod h1:+xEawxty0L+z+4EIvTF2AaHUkUM7oIecGZ9XrEaYqsI= github.com/go-zoox/core-utils v1.0.4/go.mod h1:EknM3KLL6/kagL95wZbWE7mRRcYCG/fHqiJ/EH0ihAs= github.com/go-zoox/core-utils v1.0.12/go.mod h1:EknM3KLL6/kagL95wZbWE7mRRcYCG/fHqiJ/EH0ihAs= github.com/go-zoox/core-utils v1.0.13/go.mod h1:EknM3KLL6/kagL95wZbWE7mRRcYCG/fHqiJ/EH0ihAs= -github.com/go-zoox/core-utils v1.2.11 h1:3h8P4d+P1XTEzi6M68CywUfy4p8WEZOFuWME8uIYJJ4= -github.com/go-zoox/core-utils v1.2.11/go.mod h1:Y6izFcxuELrkOen5mTQccCJxJqqPJaZV5dQtUMBdkBM= +github.com/go-zoox/core-utils v1.3.1 h1:uH8cWA3hYOox68+b87/j4sxUGkHjqf/EFsN/JIasCFE= +github.com/go-zoox/core-utils v1.3.1/go.mod h1:raOOwr2l2sJQyjR0Dg33sg0ry4U1/L2eNTuLFRpUXWs= github.com/go-zoox/counter v1.0.1/go.mod h1:PICilZTrnO4dFstDPlXpjc6sdWYBG7hm/XDmjAcHaX0= -github.com/go-zoox/counter v1.2.0 h1:a1sMgYmnOza4UgjDD/fLs+HqTPG2Kh54v2IH41uIi7Q= -github.com/go-zoox/counter v1.2.0/go.mod h1:dCAErDaaxnnqQrfPNkJYklqSQrZ9SKzH3iiciJa3BH4= +github.com/go-zoox/counter v1.2.1 h1:MPShpjJWQ/qt3pYQxuyBL/Ci6X4mtihTC3cwDr1VOI8= +github.com/go-zoox/counter v1.2.1/go.mod h1:gOA/Bk2iWt9K4vm2Std2ciEgHwQqWSzvcyUI+jFVduY= github.com/go-zoox/cron v1.1.2 h1:4iEIXIYu8MFRWBZccPaQ7wkpmvBs/N6a0FzWYiup9AU= github.com/go-zoox/cron v1.1.2/go.mod h1:7aOIpwGDyyg+NqX+041NO+9f8FhAngWiLqBPBN6kZ9k= github.com/go-zoox/crypto v1.0.3/go.mod h1:HaWRg4tHZamqNyOnNoaK+Rw5eto+su66i8bMMP8UCBU= github.com/go-zoox/crypto v1.1.8 h1:oI2KPLy+SsGeb+h5A99n9MTQVp4jBhwJWkqjStUzz9I= github.com/go-zoox/crypto v1.1.8/go.mod h1:JqgNr9HcFFGQkMCGLJ9djtfg/RWVLxtunG01HD3lUXM= github.com/go-zoox/datetime v1.0.4/go.mod h1:os6lYW/GXNpCIseFrBr8DNcOiPuwl5Ttc/kxo4JnMjw= -github.com/go-zoox/datetime v1.1.1 h1:ORZbMuSLMW3KSV9dDaGf7iKL5XqYoIn9eQuK6QMeRDY= -github.com/go-zoox/datetime v1.1.1/go.mod h1:os6lYW/GXNpCIseFrBr8DNcOiPuwl5Ttc/kxo4JnMjw= -github.com/go-zoox/debug v1.0.1 h1:lAsUnofJ1xWnfpHQQ6O5ss0xS0J+8LVAYbv+qiH0ARQ= +github.com/go-zoox/datetime v1.2.2 h1:JrI4ekdsvpsenGzrNQAOmobBTYyotaXD3YDXngvCbM4= +github.com/go-zoox/datetime v1.2.2/go.mod h1:qvaCrzjhq/g/gstx4sx06Nl4ll2pLSrkRa9ueLjrZ9A= github.com/go-zoox/debug v1.0.1/go.mod h1:7HvnBeV1dVuuGVnXSLdJ5OE6X/wIXAjIEyiaA7NqQPA= +github.com/go-zoox/debug v1.0.2 h1:nnaSGUC1F3218P3BN6ZhRR5GNKtx5DKZ1RtsvAhIjyA= +github.com/go-zoox/debug v1.0.2/go.mod h1:7HvnBeV1dVuuGVnXSLdJ5OE6X/wIXAjIEyiaA7NqQPA= github.com/go-zoox/dotenv v1.0.7/go.mod h1:N2bXxghq3Zk+lpiOxv+m+0yjnGubVqJGJDR/9jWm3N0= github.com/go-zoox/dotenv v1.1.0/go.mod h1:elKALomz436YKX4Syo+f02ozIQYq2yFaprj6jL6GnCQ= github.com/go-zoox/dotenv v1.2.3 h1:9wx4sL2u/FrRLkzoOb7ozYii6NoGsl05KoGdZm1ebIE= @@ -73,46 +109,55 @@ github.com/go-zoox/encoding v1.2.1 h1:38rQRsfL1f1YHZaqsPaGcNMkPnzatnPlYiHioUh9F4 github.com/go-zoox/encoding v1.2.1/go.mod h1:NdcM7Ln73oVW3vJgx3MH4fJknCcdQfq+NgJ0tuCo7tU= github.com/go-zoox/errors v1.0.2 h1:1NLMoEVlDU1+qrvvPj+rrJXOvQPdeZ3DekVBFrI5PFY= github.com/go-zoox/errors v1.0.2/go.mod h1:HJ5NKQb9cu3IbI0Jayw7xZiblLBEIglpaIOMxvQnWnk= -github.com/go-zoox/feishu v1.3.11 h1:5B6GSxrmy01s6UXKvY7s0TfvlYC+va4ftSN1DbU6ZoI= -github.com/go-zoox/feishu v1.3.11/go.mod h1:Wz3RsfxM9mZEMvsFR1tHbkqrjk9XvXioQo8Gnr5kvbk= +github.com/go-zoox/feishu v1.4.0 h1:zdk0Qf4RuvVBUH/S/eOqgV1ZHS4IuphZkYT4TauTtBM= +github.com/go-zoox/feishu v1.4.0/go.mod h1:Wz3RsfxM9mZEMvsFR1tHbkqrjk9XvXioQo8Gnr5kvbk= github.com/go-zoox/fetch v1.3.5/go.mod h1:AkS6v/DlotjmUs+7qJsoFGFkpROr9LVtiKYb000v3Kw= github.com/go-zoox/fetch v1.4.4/go.mod h1:WExVnds3HZ1A6jJu9KuqtICfkJpvUdR4uONUnw9TG+0= -github.com/go-zoox/fetch v1.7.7 h1:Uw4ldGYxzfZ+eXZDpxVEmLpoJsXEen1g58XLV70euTM= -github.com/go-zoox/fetch v1.7.7/go.mod h1:zaDVj8s8gPFzEeFFsD2oWc5D1z8uKKQwwnilmPdSQOk= +github.com/go-zoox/fetch v1.7.16 h1:3bRoF2bG+M5PnWoFXka64PfHRx35Y60Mu70z2F5USDM= +github.com/go-zoox/fetch v1.7.16/go.mod h1:zaDVj8s8gPFzEeFFsD2oWc5D1z8uKKQwwnilmPdSQOk= github.com/go-zoox/fs v1.2.4/go.mod h1:aywpClMqf6YO8+QnuwC3p3EvFWe88h0tWH65rpxtY00= github.com/go-zoox/fs v1.2.5/go.mod h1:aywpClMqf6YO8+QnuwC3p3EvFWe88h0tWH65rpxtY00= -github.com/go-zoox/fs v1.3.13 h1:fe0uvtXCM+9s51z/CnQ5kxB4hBYaK55tkrE9gq0385U= -github.com/go-zoox/fs v1.3.13/go.mod h1:wCM+UQkjFTxNjOOCNlGcN3k9FeXXUwn9bFnpyjOn55c= +github.com/go-zoox/fs v1.3.14 h1:u5vws9DdxCKh6U6SztIGIzVcZyydXbpSrV0S+cXzP7c= +github.com/go-zoox/fs v1.3.14/go.mod h1:GGcmvYa1Kyvspc8YzPt0peLGie+KlCoo2gkg4XbGRiY= github.com/go-zoox/gzip v1.0.0 h1:11ZTgxAPgexmZ/NJaEEuN2FDCJuvg9sips+XDR+48Yw= github.com/go-zoox/gzip v1.0.0/go.mod h1:7g9vTpKek1dft1Yi1Ryi4A6dq9snMgq94Qq8wSte8L0= -github.com/go-zoox/headers v1.0.6 h1:LJvVaqs6d+QUvV0sNU8qHFkeyQlECu0mJau1nVFsEQU= -github.com/go-zoox/headers v1.0.6/go.mod h1:WEgEbewswEw4n4qS1iG68Kn/vOQVCAKGwwuZankc6so= +github.com/go-zoox/headers v1.0.8 h1:HZJisMHhKwdySVNbV4Awc5kaMxFfAwBIHpcWOGch+iw= +github.com/go-zoox/headers v1.0.8/go.mod h1:WEgEbewswEw4n4qS1iG68Kn/vOQVCAKGwwuZankc6so= +github.com/go-zoox/i18n v1.0.3 h1:PqeOKyhI9MxbA9TyWDgm7zcCL5WRSlxhANHWou04VHk= +github.com/go-zoox/i18n v1.0.3/go.mod h1:WURpyaWOrVVN4f3mEQtl5A0kie5bK4ExQJ0PnHSOfTI= +github.com/go-zoox/ini v1.0.4 h1:N4mUbAO0juYIRrv3ysjKtpEn/+yQv57eQietsgpkAYQ= github.com/go-zoox/ini v1.0.4/go.mod h1:SisQneNLb1EBeZ5bA5GnrJd8FNg372hQrPh+gb3IzV4= github.com/go-zoox/jobqueue v1.0.0 h1:pVv/eGI0CLLHUP3rDVyn0ALzsobtaxTOnkWw/JhW9Vg= github.com/go-zoox/jobqueue v1.0.0/go.mod h1:jUCZxrQcM28orhac67eNLU7SBiVNXehxSelj7j4MM88= +github.com/go-zoox/jsonrpc v1.2.2 h1:asaoJgJkfyH5eblLQ1WzrZDe8ERL6v9GT4pKR/LJ3IE= +github.com/go-zoox/jsonrpc v1.2.2/go.mod h1:HdxJW/T0hkVHlfm+ULRnNEqvTtvZ7o4qxdQGQW76khM= github.com/go-zoox/jwt v1.0.0/go.mod h1:a6ANQHmSs+b9GJv5aad2cQLl8opFmP3hMOxZtgXRmis= github.com/go-zoox/jwt v1.3.0 h1:beyPOdiiNrNK8dqFijt5kdtaeh1dZKtM7/kaCMGbV0U= github.com/go-zoox/jwt v1.3.0/go.mod h1:Cfc+t0XhNCgDjXLR5sK6ao7qz1GSIq896gZ1usNb7t8= github.com/go-zoox/kv v1.4.1/go.mod h1:dc3whoIvGrYmQA2wi6g6ZE0oOtRg+loxaJEj6bLKlJA= github.com/go-zoox/kv v1.4.3/go.mod h1:hRCBcPBHilKmeSEsn4o67LBaXurX0+m3Tq9Ec4aIRWk= -github.com/go-zoox/kv v1.5.1 h1:tIaWHgSkXjk4idWWVoESdr0OOtc2+bOkJPtuTnktqO4= -github.com/go-zoox/kv v1.5.1/go.mod h1:u/IbVscKbZk4AyDvvnsK9DiaWshH/Nz3twlGDRyC9pA= +github.com/go-zoox/kv v1.5.9 h1:xEjIRJVcwIg2PhO0ZL+KWR5mCI/f5VshmcOjZPd4FRA= +github.com/go-zoox/kv v1.5.9/go.mod h1:sD2FmWrme1gzWaLciBAPyK0BtW3BluM02UGskOqf2MA= github.com/go-zoox/logger v1.2.0/go.mod h1:mBImRV6zpbGtiIjDz/C9vWi80wWc2OTOl9N9P0SAJgk= -github.com/go-zoox/logger v1.4.4 h1:050xlOkXfslwGuR57B0rA+toSXUo4UQqRCsyTw2n0UQ= -github.com/go-zoox/logger v1.4.4/go.mod h1:o7ddvv/gMoMa0TomPhHoIz11ZWRbQ92pF6rwYbOY3iQ= +github.com/go-zoox/logger v1.4.6 h1:zHUaB6KQ9rD/N3hM0JJ3/JCNdgtedf4mVBBNNSyWCOg= +github.com/go-zoox/logger v1.4.6/go.mod h1:o7ddvv/gMoMa0TomPhHoIz11ZWRbQ92pF6rwYbOY3iQ= github.com/go-zoox/lru v1.0.1 h1:AvRHxKEeEFSH9UXyfDQ5lj8nr66p6tJS3kVf/eTVyMg= github.com/go-zoox/lru v1.0.1/go.mod h1:xxtYsRbJ2iJKEL4OIEZ6lk0xjuGJHHZmZZhGtH5qwv0= -github.com/go-zoox/openai-client v1.4.3 h1:nnk1krN2Pvb9xzlxVN9/UVPpJ/Pt4XqFtXvCcHqmHmw= -github.com/go-zoox/openai-client v1.4.3/go.mod h1:h6vfyPajS1ScdALzDb+CwcSiMH3WKqScma0qH+SlRF8= +github.com/go-zoox/mq v1.0.1 h1:JZSgWfp4JJDVKN8FgUkWWNDb3HOhV15dIdi+ecZENwQ= +github.com/go-zoox/mq v1.0.1/go.mod h1:0Zhgww1wcFNC37NJZjtumai03MvBAZuQ4VhezcAiFJE= +github.com/go-zoox/openai-client v1.5.1 h1:cznhsCli5/v5v0cIM4xnicRnVDliVAXECSpBtsnvw7M= +github.com/go-zoox/openai-client v1.5.1/go.mod h1:h6vfyPajS1ScdALzDb+CwcSiMH3WKqScma0qH+SlRF8= github.com/go-zoox/proxy v1.2.3/go.mod h1:T+gbngAtIgvambbYibAbzrjwdu8j5pduJdA2j6RYi94= -github.com/go-zoox/proxy v1.4.0 h1:vGY3/SxONBgVCdJ2bvpIlGyINnEHP/Cq5Dt2QWYxw94= -github.com/go-zoox/proxy v1.4.0/go.mod h1:HAVpVmXgniKNMHRwgtiKNxh9YgYnduAzUFe1fpVHVjo= +github.com/go-zoox/proxy v1.5.6 h1:Ha5wsSjIi57TcYJnb4iBrW1xmJlNW2E7dWjUIwIe6iE= +github.com/go-zoox/proxy v1.5.6/go.mod h1:KLWeJqfQk1upCvEdXt3tEuM8xSu0ApbA9FNLOmyHysY= +github.com/go-zoox/pubsub v1.2.2 h1:dpcFlZRSGhX0YqT/WoOJgP5bP2VDqswPqXiiFZCki1w= +github.com/go-zoox/pubsub v1.2.2/go.mod h1:LWX0NAg80hkeGdZf7PJOEGnyN6CXooCxpIlh2MxESDo= github.com/go-zoox/random v1.0.0/go.mod h1:W+PTQiInxaCngiXpSvycucAKvu1tE/tKlZ9kaMp2/Ys= github.com/go-zoox/random v1.0.4 h1:icckpkCowQ0eGiiMkHFOJz9Qc9noOcinP+ggqWUIBH4= github.com/go-zoox/random v1.0.4/go.mod h1:W+PTQiInxaCngiXpSvycucAKvu1tE/tKlZ9kaMp2/Ys= github.com/go-zoox/ratelimit v1.0.1/go.mod h1:5MtLMrfQRbZHI+tKC4eyHZorrZX005Sy/Dldnk8qYOU= -github.com/go-zoox/ratelimit v1.2.0 h1:BWytTr0HG5xBZvelEDNIqiXT4yavFH+QwpMgSjLt3+M= -github.com/go-zoox/ratelimit v1.2.0/go.mod h1:gbnJYgl6heLTs3aRM5C8FC9ehSIO3cmEFWzbDe/m8yo= +github.com/go-zoox/ratelimit v1.2.1 h1:iFuD6Md2jDERFXF2oiAzyt+px+SIOu+ICHIoB7v2KgY= +github.com/go-zoox/ratelimit v1.2.1/go.mod h1:CyFcL4Cpm7O8jvry9O+AlxyrgJGgvl4ebo4j0D3CGHA= github.com/go-zoox/retry v1.0.3 h1:qpGq2Dqe9/mjhryDDwMEFWN+YDLHvpXL5hfwKJ1yTC4= github.com/go-zoox/retry v1.0.3/go.mod h1:4NJ0wCtxGgHwzHYIN4bG1VnQ19w3rY2kzyOpNfm7x5o= github.com/go-zoox/safe v1.0.1 h1:JwWK7xCyv7eyzBbwzQvhK/Ajm8gG2Q9Cvd/KXpdF2zI= @@ -123,15 +168,19 @@ github.com/go-zoox/tag v1.0.2/go.mod h1:TNFY+IN6FgsD0KGV6mrnuVXONUq7zpH01k53BcNs github.com/go-zoox/tag v1.0.6/go.mod h1:jrbJgC1dZAN5+vZlmrUKu1/UpbOo0xVyCC1MfLpGGqk= github.com/go-zoox/tag v1.0.9/go.mod h1:jrbJgC1dZAN5+vZlmrUKu1/UpbOo0xVyCC1MfLpGGqk= github.com/go-zoox/tag v1.1.0/go.mod h1:yMB7bMseqbOshUW9O9Dqfq0C7Mmy9OkccV/meEJHICs= -github.com/go-zoox/tag v1.2.2 h1:MLtfFEEBVwV3HVhgNHXGDl0Xv4h9hj1+6Hx9GaRHvFc= -github.com/go-zoox/tag v1.2.2/go.mod h1:z9z4iZb/XPE4HwTXJgPIdwgH90c2NysGxIMq9tW+GuU= -github.com/go-zoox/testify v1.0.0 h1:zXuj+JMcudM/dWk8HgMfCKpGYDcyHbTUBGxH35SGubU= +github.com/go-zoox/tag v1.2.3 h1:HDQpRu8rA1xSJt6c+v0O7TfzTjPq5aDtyzW/15aTh94= +github.com/go-zoox/tag v1.2.3/go.mod h1:z9z4iZb/XPE4HwTXJgPIdwgH90c2NysGxIMq9tW+GuU= +github.com/go-zoox/testify v1.0.2 h1:G5sQ3xm0uwCuytnMhgnqZ5BItCt2DN3n2wLBqlIJEWA= github.com/go-zoox/uuid v0.0.1 h1:txqmDavRTq68gzzqWfJQLorFyUp9a7M2lmq2KcwPGPA= github.com/go-zoox/uuid v0.0.1/go.mod h1:0/F4LdfLqFdyqOf7aXoiYXRkXHU324JQ5DZEytXYBPM= github.com/go-zoox/zoox v1.2.19/go.mod h1:xk3S3L58ugJIDyuZMCYrj3qIGLSxddbkARwTRkpxPVE= -github.com/go-zoox/zoox v1.10.6 h1:JHsGZ0NjahDCquHAKZwR/m9O5+EyFsBGqaPcToQkfNE= -github.com/go-zoox/zoox v1.10.6/go.mod h1:MgInM8vbyVzULOuA0HniyrO0K12uCZqeZfAxRw9PbHM= +github.com/go-zoox/zoox v1.12.29 h1:eg4ug+sXvWt2w9KEaSyrV4Fzv0QE4dcCweKApcu2ZJY= +github.com/go-zoox/zoox v1.12.29/go.mod h1:Z8VmwMC7mahiXErAvy8GXv+tM8LHT0YPNOGLSycGTYw= github.com/goccy/go-yaml v1.9.5/go.mod h1:U/jl18uSupI5rdI2jmuCswEA2htH9eXfferR3KfscvA= +github.com/goccy/go-yaml v1.11.2 h1:joq77SxuyIs9zzxEjgyLBugMQ9NEgTWxXfz2wVqwAaQ= +github.com/goccy/go-yaml v1.11.2/go.mod h1:wKnAMd44+9JAAnGQpWVEgBzGt3YuTaQ4uXoHvE4m7WU= +github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= +github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8= github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA= @@ -147,15 +196,21 @@ github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/ github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= github.com/google/pprof v0.0.0-20210407192527-94a9f03dee38/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= -github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I= github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/gorilla/websocket v1.5.0 h1:PPwGk2jz7EePpoHN/+ClbZu8SPxiqlu12wZP/3sWmnc= +github.com/google/uuid v1.4.0 h1:MtMxsa51/r9yyhkyLsVeVt0B+BGQZzpQiTQ4eHZ8bc4= +github.com/google/uuid v1.4.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/gorilla/websocket v1.5.0/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= +github.com/gorilla/websocket v1.5.1 h1:gmztn0JnHVt9JZquRuzLw3g4wouNVzKL15iLr/zn/QY= +github.com/gorilla/websocket v1.5.1/go.mod h1:x3kM2JMyaluk02fnUJpQuwD2dCS5NDG2ZHL0uE0tcaY= github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= github.com/joho/godotenv v1.4.0/go.mod h1:f4LDr5Voq0i2e/R5DDNOoa2zzDfwtkZa6DnEwAbqwq4= github.com/joho/godotenv v1.5.1 h1:7eLL/+HRGLY0ldzfGMeQkb7vMd0as4CfYvUVzLqw0N0= github.com/joho/godotenv v1.5.1/go.mod h1:f4LDr5Voq0i2e/R5DDNOoa2zzDfwtkZa6DnEwAbqwq4= +github.com/kardianos/osext v0.0.0-20190222173326-2bc1f35cddc0 h1:iQTw/8FWTuc7uiaSepXwyf3o52HaUYcV+Tu66S3F5GA= +github.com/kardianos/osext v0.0.0-20190222173326-2bc1f35cddc0/go.mod h1:1NbS8ALrpOvjt0rHPNLyCIeMtbizbir8U//inJ+zuB8= +github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= +github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= github.com/kr/pretty v0.3.0/go.mod h1:640gp4NfQd8pI5XOwp5fnNeVWj67G7CFk/SaSQn7NBk= @@ -165,15 +220,25 @@ github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= github.com/leodido/go-urn v1.2.0/go.mod h1:+8+nEpDfqqsY+g338gtMEUOtuK+4dEMhiQEgxpxOKII= +github.com/leodido/go-urn v1.2.1 h1:BqpAaACuzVSgi/VLzGZIobT2z4v53pjosyNd9Yv6n/w= github.com/leodido/go-urn v1.2.1/go.mod h1:zt4jvISO2HfUBqxjfIshjdMTYS56ZS/qv49ictyFfxY= github.com/mattn/go-colorable v0.1.8/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= github.com/mattn/go-colorable v0.1.9/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= github.com/mattn/go-colorable v0.1.12/go.mod h1:u5H1YNBxpqRaxsYJYSkiCWKzEfiAb1Gb520KVy5xxl4= +github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA= +github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg= github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU= github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94= +github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= +github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY= +github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= github.com/mattn/go-sqlite3 v1.14.12/go.mod h1:NyWgC/yNuGj7Q9rpYnZvas74GogHl5/Z4A/KQRfk6bU= github.com/mattn/go-sqlite3 v1.14.13/go.mod h1:NyWgC/yNuGj7Q9rpYnZvas74GogHl5/Z4A/KQRfk6bU= github.com/mattn/go-sqlite3 v1.14.14/go.mod h1:NyWgC/yNuGj7Q9rpYnZvas74GogHl5/Z4A/KQRfk6bU= +github.com/moby/term v0.5.0 h1:xt8Q1nalod/v7BqbG21f8mQPqH+xAaC9C3N3wfWbVP0= +github.com/moby/term v0.5.0/go.mod h1:8FzsFHVUBGZdbDsJw/ot+X+d5HLUbvklYLJ9uGfcI3Y= +github.com/morikuni/aec v1.0.0 h1:nP9CBfwrvYnBRgY6qfDQkygYDmYwOilePFkwzv4dU8A= +github.com/morikuni/aec v1.0.0/go.mod h1:BbKIizmSmc5MMPqRYbxO4ZU0S0+P200+tUnFx7PXmsc= github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A= github.com/nxadm/tail v1.4.8 h1:nPr65rt6Y5JFSKQO7qToXr7pePgD6Gwiw05lkbyAQTE= github.com/nxadm/tail v1.4.8/go.mod h1:+ncqLTQzXmGhMZNUePPaPqPvBxHAIsmXswZKocGu+AU= @@ -188,12 +253,20 @@ github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1y github.com/onsi/gomega v1.17.0/go.mod h1:HnhC7FXeEQY45zxNK3PPoIUhzk/80Xly9PcubAlGdZY= github.com/onsi/gomega v1.18.1 h1:M1GfJqGRrBrrGGsbxzV5dqM2U2ApXefZCQpkukxYRLE= github.com/onsi/gomega v1.18.1/go.mod h1:0q+aL8jAiMXy9hbwj2mr5GziHiwhAIQpFmmtT5hitRs= +github.com/opencontainers/go-digest v1.0.0 h1:apOUWs51W5PlhuyGyz9FCeeBIOUDA/6nW8Oi/yOhh5U= +github.com/opencontainers/go-digest v1.0.0/go.mod h1:0JzlMkj0TRzQZfJkVvzbP0HBR3IKzErnv2BNG4W4MAM= +github.com/opencontainers/image-spec v1.0.2 h1:9yCKha/T5XdGtO0q9Q9a6T5NUCsTn/DrBg0D7ufOcFM= +github.com/opencontainers/image-spec v1.0.2/go.mod h1:BtxoFyWECRxE4U/7sNtV5W15zMzWCbyJoFRP3s7yZA0= github.com/pelletier/go-toml v1.9.4/go.mod h1:u1nR/EPcESfeI/szUZKdtJ0xRNbUoANCkoOuaOx1Y+c= +github.com/pelletier/go-toml v1.9.5 h1:4yBQzkHv+7BHq2PQUZF3Mx0IYxG7LsP222s7Agd3ve8= +github.com/pelletier/go-toml v1.9.5/go.mod h1:u1nR/EPcESfeI/szUZKdtJ0xRNbUoANCkoOuaOx1Y+c= github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA= github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/redis/go-redis/v9 v9.3.0 h1:RiVDjmig62jIWp7Kk4XVLs0hzV6pI3PyTnnL0cnn0u0= +github.com/redis/go-redis/v9 v9.3.0/go.mod h1:hdY0cQFCN4fnSYT6TkisLufl/4W5UIXyv0b/CLO2V2M= github.com/robfig/cron/v3 v3.0.1 h1:WdRxkvbJztn8LMz/QEvLN5sBU+xKpSqwwUO1Pjr4qDs= github.com/robfig/cron/v3 v3.0.1/go.mod h1:eQICP3HwyT7UooqI/z+Ov+PtYAWygg1TEWWzGIFLtro= github.com/rogpeppe/go-internal v1.6.1/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTEfhy4qGm1nDQc= @@ -201,6 +274,10 @@ github.com/rogpeppe/go-internal v1.8.0/go.mod h1:WmiCO8CzOY8rg0OYDC4/i/2WRWAB6po github.com/rogpeppe/go-internal v1.9.0 h1:73kH8U+JUqXU8lRuOHeVHaa/SZPifC7BkcraZVejAe8= github.com/russross/blackfriday/v2 v2.1.0 h1:JIOH55/0cWyOuilr9/qlrm0BSXldqnqwMsf35Ld67mk= github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= +github.com/sevlyar/go-daemon v0.1.6 h1:EUh1MDjEM4BI109Jign0EaknA2izkOyi0LV3ro3QQGs= +github.com/sevlyar/go-daemon v0.1.6/go.mod h1:6dJpPatBT9eUwM5VCw9Bt6CdX9Tk6UWvhW3MebLDRKE= +github.com/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ= +github.com/sirupsen/logrus v1.9.3/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ= github.com/spaolacci/murmur3 v1.1.0/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= github.com/spf13/cast v1.5.1 h1:R+kOtfhWQE6TVQzY+4D7wJLBgkdVasCEFxSUBYBYIlA= github.com/spf13/cast v1.5.1/go.mod h1:b9PdjNptOpzXr7Rq1q9gJML/2cdGQAo69NKzQ10KN48= @@ -212,22 +289,23 @@ github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/ github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= -github.com/stretchr/testify v1.8.1 h1:w7B6lhMri9wdJUVmEZPGGhZzrYTPvgJArz7wNPgYKsk= +github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= github.com/tidwall/gjson v1.14.0/go.mod h1:/wbyibRr2FHMks5tjHJ5F8dMZh3AcwJEMf5vlfC0lxk= github.com/tidwall/gjson v1.14.1/go.mod h1:/wbyibRr2FHMks5tjHJ5F8dMZh3AcwJEMf5vlfC0lxk= github.com/tidwall/gjson v1.14.2/go.mod h1:/wbyibRr2FHMks5tjHJ5F8dMZh3AcwJEMf5vlfC0lxk= -github.com/tidwall/gjson v1.14.4 h1:uo0p8EbA09J7RQaflQ1aBRffTR7xedD2bcIVSYxLnkM= -github.com/tidwall/gjson v1.14.4/go.mod h1:/wbyibRr2FHMks5tjHJ5F8dMZh3AcwJEMf5vlfC0lxk= +github.com/tidwall/gjson v1.17.0 h1:/Jocvlh98kcTfpN2+JzGQWQcqrPQwDrVEMApx/M5ZwM= +github.com/tidwall/gjson v1.17.0/go.mod h1:/wbyibRr2FHMks5tjHJ5F8dMZh3AcwJEMf5vlfC0lxk= github.com/tidwall/match v1.1.1 h1:+Ho715JplO36QYgwN9PGYNhgZvoUSc9X2c80KVTi+GA= github.com/tidwall/match v1.1.1/go.mod h1:eRSPERbgtNPcGhD8UCthc6PmLEQXEWd3PRB5JTxsfmM= github.com/tidwall/pretty v1.2.0/go.mod h1:ITEVvHYasfjBbM0u2Pg8T2nJnzm8xPwvNhhsoaGGjNU= github.com/tidwall/pretty v1.2.1 h1:qjsOFOWWQl+N3RsoF5/ssm1pHmJJwhjlSbZ51I6wMl4= github.com/tidwall/pretty v1.2.1/go.mod h1:ITEVvHYasfjBbM0u2Pg8T2nJnzm8xPwvNhhsoaGGjNU= github.com/ttacon/chalk v0.0.0-20160626202418-22c06c80ed31 h1:OXcKh35JaYsGMRzpvFkLv/MEyPuL49CThT1pZ8aSml4= -github.com/urfave/cli/v2 v2.24.4 h1:0gyJJEBYtCV87zI/x2nZCPyDxD51K6xM8SkwjHFCNEU= -github.com/urfave/cli/v2 v2.24.4/go.mod h1:GHupkWPMM0M/sj1a2b4wUrWBPzazNrIjouW6fmdJLxc= +github.com/urfave/cli/v2 v2.25.7 h1:VAzn5oq403l5pHjc4OhD54+XGO9cdKVL/7lDjF+iKUs= +github.com/urfave/cli/v2 v2.25.7/go.mod h1:8qnjx1vcq5s2/wpsqoZFndg2CE5tNFyrTvS6SinrnYQ= github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673 h1:bAn7/zixMGCfxrRTfdpNzjtPYqr8smhKouy9mxVdGPU= github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673/go.mod h1:N3UwUGtsrSj3ccvlPHLoLsHnpR27oXr4ZE984MbSER8= +github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= @@ -235,12 +313,16 @@ golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPh golang.org/x/crypto v0.0.0-20210711020723-a769d52b0f97/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.0.0-20220313003712-b769efc7c000/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/crypto v0.0.0-20220722155217-630584e8d5aa/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= -golang.org/x/crypto v0.10.0 h1:LKqV2xt9+kDzSTfOhx4FrkEBcMrAgHSYgzywV9zcGmM= -golang.org/x/crypto v0.10.0/go.mod h1:o4eNf7Ede1fv+hwOwZsTHl9EsPFO6q6ZvYR8vYfY45I= +golang.org/x/crypto v0.15.0 h1:frVn1TEaCEaZcn3Tmd7Y2b5KKPaZ+I32Q2OA3kYp5TA= +golang.org/x/crypto v0.15.0/go.mod h1:4ChreQoLWfG3xLDer1WdlH5NdlQ3+mwnQq1YTKY+72g= +golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/mod v0.14.0 h1:dGoOF9QVLYng8IHTm7BAyWqCqSheQ5pYWGhzW00YJr0= +golang.org/x/mod v0.14.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200520004742-59133d7f0dd7/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= @@ -249,11 +331,13 @@ golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qx golang.org/x/net v0.0.0-20220225172249-27dd8689420f/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= golang.org/x/net v0.0.0-20220802222814-0bcc04d9c69b/go.mod h1:YDH+HFinaLZZlnHAfSS6ZXJJ9M9t4Dl22yv3iI2vPwk= golang.org/x/net v0.0.0-20220812174116-3211cb980234/go.mod h1:YDH+HFinaLZZlnHAfSS6ZXJJ9M9t4Dl22yv3iI2vPwk= -golang.org/x/net v0.11.0 h1:Gi2tvZIJyBtO9SDr1q9h5hEQCp/4L2RQ+ar0qjx2oNU= -golang.org/x/net v0.11.0/go.mod h1:2L/ixqYpgIVXmeoSA/4Lu7BzTG4KIyPIryS4IsOd1oQ= +golang.org/x/net v0.18.0 h1:mIYleuAkSbHh0tCv7RvjL3F6ZVbLjq4+R7zbOn3Kokg= +golang.org/x/net v0.18.0/go.mod h1:/czyP5RqHAH4odGYxBJ1qz0+CE5WZ+2j1YgoEo8F2jQ= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.5.0 h1:60k92dhOjHxJkrqnwsfl8KuaHbn/5dl0lUPUklKo3qE= golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -269,34 +353,44 @@ golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20210112080510-489259a85091/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20210616094352-59db8d763f22/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210806184541-e5e7981a1069/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220128215802-99c3d69c2c27/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220330033206-e17cdc41300f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220728004956-3c1f35247d10/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220908164124-27713097b956/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.9.0 h1:KS/R3tvhPqvJvwcKfnBHJwwthS11LRhmM5D59eEXa0s= -golang.org/x/sys v0.9.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.14.0 h1:Vz7Qs629MkJkGyHxUlRHizWJRG2j8fbQKjELVSNhy7Q= +golang.org/x/sys v0.14.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= +golang.org/x/term v0.14.0 h1:LGK9IlZ8T9jvdy6cTdfKUCltatMFOehAQo9SRC46UQ8= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= -golang.org/x/text v0.10.0 h1:UpjohKhiEgNc0CSauXmwYftY1+LlaC75SJwh0SgCX58= -golang.org/x/text v0.10.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= +golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ= +golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= +golang.org/x/time v0.3.0 h1:rg5rLMjNzMS1RkNLzCG38eapWhnYLFYXDXj2gOlr8j4= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= golang.org/x/tools v0.0.0-20201224043029-2b0845dc783e/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= +golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= +golang.org/x/tools v0.15.0 h1:zdAyfUGbYmuVokhzVmghFl2ZJh5QhcfebBgmVPFYA+8= +golang.org/x/tools v0.15.0/go.mod h1:hpksKq4dtpQWS1uQ61JkdqWM3LscIS6Slf+VVkm+wQk= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20220609144429-65e65417b02f/go.mod h1:K8+ghG5WaK9qNqU5K3HdILfMLy1f3aNYFI/wnl100a8= +golang.org/x/xerrors v0.0.0-20231012003039-104605ab7028 h1:+cNy6SZtPcJQH3LJVLOSmiC7MMxXNOb3PU/VUEz+EhU= +golang.org/x/xerrors v0.0.0-20231012003039-104605ab7028/go.mod h1:NDW/Ps6MPRej6fsCIbMTohpP40sJ/P/vI1MoTEGwX90= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= @@ -323,3 +417,4 @@ gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gotest.tools/v3 v3.5.1 h1:EENdUnS3pdur5nybKYIh2Vfgc8IUNBjxDPSjtiJcOzU= diff --git a/main.go b/main.go index 25c5413..c1905c0 100644 --- a/main.go +++ b/main.go @@ -1,6 +1,7 @@ package main import ( + "github.com/go-zoox/chatgpt-for-chatbot-feishu/config" "github.com/go-zoox/cli" ) @@ -24,10 +25,10 @@ func main() { Value: "/", }, &cli.StringFlag{ - Name: "openai-api-key", - Usage: "OpenAI API Key", - EnvVars: []string{"OPENAI_API_KEY"}, - Required: true, + Name: "openai-api-key", + Usage: "OpenAI API Key", + EnvVars: []string{"OPENAI_API_KEY"}, + // Required: true, }, &cli.Int64Flag{ Name: "openai-api-timeout", @@ -145,16 +146,6 @@ func main() { Usage: "Sets the request proxy", EnvVars: []string{"PROXY", "HTTPS_PROXY"}, }, - &cli.StringFlag{ - Name: "proxy-openai-api-path", - Usage: "Sets the proxy path for OpenAI API", - EnvVars: []string{"PROXY_OPENAI_API_PATH"}, - }, - &cli.StringFlag{ - Name: "proxy-openai-api-token", - Usage: "Sets the proxy tokens for OpenAI API", - EnvVars: []string{"PROXY_OPENAI_API_TOKEN"}, - }, &cli.StringFlag{ Name: "custom-command", Usage: "Custom command, such as: doc => trigger /doc", @@ -169,7 +160,7 @@ func main() { }) app.Command(func(ctx *cli.Context) (err error) { - return ServeFeishuBot(&FeishuBotConfig{ + return ServeFeishuBot(&config.Config{ LogsDir: ctx.String("logs-dir"), LogsLevel: ctx.String("logs-level"), Port: ctx.Int64("port"), @@ -195,8 +186,6 @@ func main() { OpenAIAzureResource: ctx.String("openai-azure-resource"), OpenAIAzureDeployment: ctx.String("openai-azure-deployment"), OpenAIAzureAPIVersion: ctx.String("openai-azure-api-version"), - ProxyOpenAIAPIPath: ctx.String("proxy-openai-api-path"), - ProxyOpenAIAPIToken: ctx.String("proxy-openai-api-token"), CustomCommand: ctx.String("custom-command"), CustomCommandService: ctx.String("custom-command-service"), }) diff --git a/server.go b/server.go index 3b6b28a..f03e683 100644 --- a/server.go +++ b/server.go @@ -1,90 +1,25 @@ package main import ( - "net/http" - "net/url" "time" "github.com/go-zoox/chalk" "github.com/go-zoox/chatbot-feishu" - "github.com/go-zoox/core-utils/regexp" - "github.com/go-zoox/core-utils/strings" - "github.com/go-zoox/fetch" + "github.com/go-zoox/chatgpt-for-chatbot-feishu/commands" + "github.com/go-zoox/chatgpt-for-chatbot-feishu/config" openaiclient "github.com/go-zoox/openai-client" - "github.com/go-zoox/proxy" - "github.com/go-zoox/proxy/utils/rewriter" "github.com/go-zoox/zoox" "github.com/go-zoox/zoox/defaults" - "github.com/go-zoox/zoox/middleware" "github.com/go-zoox/core-utils/fmt" "github.com/go-zoox/feishu" - "github.com/go-zoox/feishu/contact/user" - mc "github.com/go-zoox/feishu/message/content" chatgpt "github.com/go-zoox/chatgpt-client" - feishuBot "github.com/go-zoox/feishu/bot" feishuEvent "github.com/go-zoox/feishu/event" "github.com/go-zoox/logger" - "github.com/go-zoox/retry" ) -type FeishuBotConfig struct { - Port int64 - APIPath string - OpenAIAPIKey string - OpenAIAPITimeout int64 - AppID string - AppSecret string - EncryptKey string - VerificationToken string - // - ReportURL string - // - SiteURL string - // - OpenAIModel string - // - FeishuBaseURI string - // - ConversationContext string - ConversationLanguage string - // - LogsDir string - LogsLevel string - // - OfflineMessage string - // - AdminEmail string - // - BotName string - - // Proxy sets the request proxy. - // support http, https, socks5 - // example: - // http://127.0.0.1:17890 - // https://127.0.0.1:17890 - // socks5://127.0.0.1:17890 - Proxy string - - OpenAIAPIServer string - - OpenAIAPIType string - OpenAIAzureResource string - OpenAIAzureDeployment string - OpenAIAzureAPIVersion string - - // ProxyOpenAIAPIPath proxys the OpenAPI API (https://api.openai.com) - ProxyOpenAIAPIPath string - // ProxyOpenAIAPIToken limits auth with Bearer Token - ProxyOpenAIAPIToken string - - // Custom Command with Service - CustomCommand string - CustomCommandService string -} - -func ServeFeishuBot(cfg *FeishuBotConfig) (err error) { +func ServeFeishuBot(cfg *config.Config) (err error) { if cfg.OfflineMessage == "" { cfg.OfflineMessage = "robot is offline" } @@ -107,7 +42,7 @@ func ServeFeishuBot(cfg *FeishuBotConfig) (err error) { return fmt.Errorf("failed to setup logs: %v", err) } - client, err := chatgpt.New(&chatgpt.Config{ + chatgptClient, err := chatgpt.New(&chatgpt.Config{ APIKey: cfg.OpenAIAPIKey, APIServer: cfg.OpenAIAPIServer, APIType: cfg.OpenAIAPIType, @@ -124,79 +59,34 @@ func ServeFeishuBot(cfg *FeishuBotConfig) (err error) { return fmt.Errorf("failed to create chatgpt client: %v", err) } - bot := feishu.New(&feishu.Config{ + feishuClient := feishu.New(&feishu.Config{ AppID: cfg.AppID, AppSecret: cfg.AppSecret, BaseURI: cfg.FeishuBaseURI, }) - var botInfo *feishuBot.GetBotInfoResponse - isInService := true + cfg.Version = Version + cfg.IsInService = true tryToGetBotInfo := func() { for { - if botInfo != nil { + if cfg.BotInfo != nil { break } logger.Infof("Trying to get bot info ...") - botInfo, err = bot.Bot().GetBotInfo() + cfg.BotInfo, err = feishuClient.Bot().GetBotInfo() if err != nil { logger.Errorf("failed to get bot info: %v", err) return } - logger.Infof("Bot Name: %s", botInfo.AppName) + logger.Infof("Bot Name: %s", cfg.BotInfo.AppName) logger.Infof("Feishu Bot Online ...") time.Sleep(3 * time.Second) } } - isAllowToDo := func(request *feishuEvent.EventRequest, command string) (reason error) { - if cfg.AdminEmail != "" { - eventSender, err := bot.Contact().User().Retrieve(&user.RetrieveRequest{ - UserIDType: "open_id", - UserID: request.Sender().SenderID.OpenID, - }) - if err != nil { - return fmt.Errorf("failed to retrieve user with openid(%s): %v", request.Sender().SenderID.OpenID, err) - } - - if eventSender.User.EnterpriseEmail != cfg.AdminEmail && eventSender.User.Email != cfg.AdminEmail { - return fmt.Errorf("user(%s) is not allow to do action: %s", eventSender.User.Name, command) - } - - return nil - } - - return fmt.Errorf("admin email is not set, not allow to do action: %s", command) - } - - getUser := func(request *feishuEvent.EventRequest) (*user.RetrieveResponse, error) { - sender := request.Sender() - - if cfg.AdminEmail != "" { - eventSender, err := bot.Contact().User().Retrieve(&user.RetrieveRequest{ - UserIDType: "open_id", - UserID: sender.SenderID.OpenID, - }) - if err != nil { - return nil, fmt.Errorf("failed to retrieve user with openid(%s): %v", sender.SenderID.OpenID, err) - } - - return eventSender, nil - } - - return &user.RetrieveResponse{ - User: user.UserEntity{ - Name: sender.SenderID.UserID, - OpenID: sender.SenderID.OpenID, - UnionID: sender.SenderID.UnionID, - UserID: sender.SenderID.UserID, - }, - }, nil - } - go func() { tryToGetBotInfo() }() @@ -226,330 +116,30 @@ func ServeFeishuBot(cfg *FeishuBotConfig) (err error) { return fmt.Errorf("failed to create feishu chatbot: %v", err) } - replyText := func(reply func(content string, msgType ...string) error, text string) error { - msgType, content, err := mc. - NewContent(). - Post(&mc.ContentTypePost{ - ZhCN: &mc.ContentTypePostBody{ - Content: [][]mc.ContentTypePostBodyItem{ - { - { - Tag: "text", - UnEscape: true, - Text: text, - }, - }, - }, - }, - }). - Build() - if err != nil { - return fmt.Errorf("failed to build content: %v", err) - } - if err := reply(string(content), msgType); err != nil { - return fmt.Errorf("failed to reply: %v", err) - } - - return nil - } - - feishuchatbot.OnCommand("ping", &chatbot.Command{ - Handler: func(args []string, request *feishuEvent.EventRequest, reply func(content string, msgType ...string) error) error { - if err := replyText(reply, "pong"); err != nil { - return fmt.Errorf("failed to reply: %v", err) - } - - return nil - }, - }) - - feishuchatbot.OnCommand("offline", &chatbot.Command{ - Handler: func(args []string, request *feishuEvent.EventRequest, reply func(content string, msgType ...string) error) error { - if err := isAllowToDo(request, "online"); err != nil { - return err - } - - isInService = false - - if err := replyText(reply, "succeed to offline"); err != nil { - return fmt.Errorf("failed to reply: %v", err) - } - - return nil - }, - }) - - feishuchatbot.OnCommand("online", &chatbot.Command{ - Handler: func(args []string, request *feishuEvent.EventRequest, reply func(content string, msgType ...string) error) error { - if err := isAllowToDo(request, "online"); err != nil { - return err - } - - isInService = true - - if err := replyText(reply, "succeed to online"); err != nil { - return fmt.Errorf("failed to reply: %v", err) - } - - return nil - }, - }) - - feishuchatbot.OnCommand("model", &chatbot.Command{ - ArgsLength: 1, - Handler: func(args []string, request *feishuEvent.EventRequest, reply func(content string, msgType ...string) error) error { - if err := isAllowToDo(request, "model"); err != nil { - return err - } - - if len(args) == 0 || args[0] == "" { - currentModel, err := client.GetConversationModel(request.ChatID(), &chatgpt.ConversationConfig{ - MaxMessages: 50, - Model: cfg.OpenAIModel, - }) - if err != nil { - return fmt.Errorf("failed to get model by conversation(%s)", request.ChatID()) - } - - if err := replyText(reply, fmt.Sprintf("当前模型:%s", currentModel)); err != nil { - return fmt.Errorf("failed to reply: %v", err) - } - - return nil - } - - model := args[0] - if model == "" { - return fmt.Errorf("model name is required (args: %s)", strings.Join(args, " ")) - } - - if err := client.ChangeConversationModel(request.ChatID(), model, &chatgpt.ConversationConfig{ - MaxMessages: 50, - Model: cfg.OpenAIModel, - }); err != nil { - return fmt.Errorf("failed to set model(%s) for conversation(%s)", model, request.ChatID()) - } + feishuchatbot.OnCommand("ping", commands.CreatePingCommand(feishuClient, chatgptClient)) - if err := replyText(reply, fmt.Sprintf("succeed to set model: %s", model)); err != nil { - return fmt.Errorf("failed to reply: %v", err) - } + feishuchatbot.OnCommand("offline", commands.CreateOfflineCommand(feishuClient, chatgptClient, cfg)) - return nil - }, - }) + feishuchatbot.OnCommand("online", commands.CreateOnlineCommand(feishuClient, chatgptClient, cfg)) - feishuchatbot.OnCommand("reset", &chatbot.Command{ - Handler: func(args []string, request *feishuEvent.EventRequest, reply chatbot.MessageReply) error { - if err := isAllowToDo(request, "reset"); err != nil { - return err - } + feishuchatbot.OnCommand("model", commands.CreateModelCommand(feishuClient, chatgptClient, cfg)) - if err := client.ResetConversation(request.ChatID()); err != nil { - return fmt.Errorf("failed to reset conversation(%s)", request.ChatID()) - } + feishuchatbot.OnCommand("reset", commands.CreateResetCommand(feishuClient, chatgptClient, cfg)) - if err := replyText(reply, "succeed to reset"); err != nil { - return fmt.Errorf("failed to reply: %v", err) - } + feishuchatbot.OnCommand("message", commands.CreateMessageCommand(feishuClient, chatgptClient, cfg)) + feishuchatbot.OnCommand("问答", commands.CreateMessageCommand(feishuClient, chatgptClient, cfg)) - return nil - }, - }) + feishuchatbot.OnCommand("draw", commands.CreateDrawCommand(feishuClient, chatgptClient)) + feishuchatbot.OnCommand("画图", commands.CreateDrawCommand(feishuClient, chatgptClient)) if cfg.CustomCommand != "" && cfg.CustomCommandService != "" { - feishuchatbot.OnCommand(cfg.CustomCommand, &chatbot.Command{ - ArgsLength: 1, - Handler: func(args []string, request *feishuEvent.EventRequest, reply chatbot.MessageReply) error { - if len(args) != 1 { - return fmt.Errorf("invalid args: %v", args) - } - - question := args[0] - logger.Debugf("[custom command: %s, service: %s] question: %s", cfg.CustomCommand, cfg.CustomCommandService, question) - - response, err := fetch.Post(cfg.CustomCommandService, &fetch.Config{ - Headers: fetch.Headers{ - "Content-Type": "application/json", - "Accept": "application/json", - "User-Agent": fmt.Sprintf("go-zoox_fetch/%s chatgpt-for-chatbot-feishu/%s", fetch.Version, Version), - }, - Body: map[string]interface{}{ - "question": args[0], - }, - }) - if err != nil { - logger.Errorf("failed to request from custom command service(%s)(1): %v", cfg.CustomCommandService, err) - if err2 := replyText(reply, fmt.Sprintf("failed to interact with command service(err: %v)", err)); err2 != nil { - return fmt.Errorf("failed to reply: %v", err) - } - - return nil - } - - if response.Status != http.StatusOK { - logger.Errorf("failed to request from custom command service(%s)(2): %d", cfg.CustomCommandService, response.Status) - if err := replyText(reply, fmt.Sprintf("failed to interact with command service (status: %d, response: %s)", response.Status, response.String())); err != nil { - return fmt.Errorf("failed to reply: %v", err) - } - - return nil - } - - answer := response.Get("answer").String() - if answer == "" { - logger.Error("failed to request from custom command service(%s): empty answer (response: %s)", cfg.CustomCommandService, response.String()) - if err := replyText(reply, fmt.Sprintf("no answer found, unexpected response from custom command service(response: %s)", response.String())); err != nil { - return fmt.Errorf("failed to reply: %v", err) - } - - return nil - } - - if err := replyText(reply, answer); err != nil { - return fmt.Errorf("failed to reply: %v", err) - } - - return nil - }, - }) + feishuchatbot.OnCommand(cfg.CustomCommand, commands.CreateCustomCommand(feishuClient, chatgptClient, cfg)) } feishuchatbot.OnMessage(func(text string, request *feishuEvent.EventRequest, reply func(content string, msgType ...string) error) error { - // fmt.PrintJSON(request) - if botInfo == nil { - logger.Infof("Trying to get bot info ...") - botInfo, err = bot.Bot().GetBotInfo() - if err != nil { - return fmt.Errorf("failed to get bot info: %v", err) - } - } - - user, err := getUser(request) - if err != nil { - return fmt.Errorf("failed to get user: %v", err) - } - - textMessage := strings.TrimSpace(text) - if textMessage == "" { - return nil - } - - var question string - // group chat - if request.IsGroupChat() { - // @ - if ok := regexp.Match("^@_user_1", textMessage); ok { - for _, metion := range request.Event.Message.Mentions { - if metion.Key == "@_user_1" && metion.ID.OpenID == botInfo.OpenID { - question = textMessage[len("@_user_1"):] - question = strings.TrimSpace(question) - break - } - } - } else if ok := regexp.Match("^/chatgpt\\s+", textMessage); ok { - // command: /chatgpt - question = textMessage[len("/chatgpt "):] - } - } else if request.IsP2pChat() { - question = textMessage - } - - question = strings.TrimSpace(question) - if question == "" { - logger.Infof("ignore empty question message") - return nil - } - - // @TODO 离线服务 - if !isInService { - return replyText(reply, cfg.OfflineMessage) - } - - go func() { - logger.Debugf("%s 问 ChatGPT:%s", user.User.Name, question) - - var err error - - conversation, err := client.GetOrCreateConversation(request.ChatID(), &chatgpt.ConversationConfig{ - MaxMessages: 50, - Model: cfg.OpenAIModel, - }) - if err != nil { - logger.Errorf("failed to get or create conversation by ChatID %s", request.ChatID()) - return - } - - if err := conversation.IsQuestionAsked(request.Event.Message.MessageID); err != nil { - logger.Warnf("duplicated event(id: %s): %v", request.Event.Message.MessageID, err) - return - } - - var answer []byte - err = retry.Retry(func() error { - - answer, err = conversation.Ask([]byte(question), &chatgpt.ConversationAskConfig{ - ID: request.Event.Message.MessageID, - User: user.User.Name, - }) - if err != nil { - logger.Errorf("failed to request answer: %v", err) - return fmt.Errorf("failed to request answer: %v", err) - } - - return nil - }, 5, 3*time.Second) - if err != nil { - logger.Errorf("failed to get answer: %v", err) - msgType, content, err := mc. - NewContent(). - Text(&mc.ContentTypeText{ - Text: "ChatGPT 繁忙,请稍后重试", - }). - Build() - if err != nil { - logger.Errorf("failed to build content: %v", err) - return - } - if err := reply(string(content), msgType); err != nil { - return - } - return - } - - logger.Debugf("ChatGPT 答 %s:%s", user.User.Name, answer) - - responseMessage := string(answer) - // if request.IsGroupChat() { - // responseMessage = fmt.Sprintf("%s\n-------------\n%s", question, answer) - // } - - msgType, content, err := mc. - NewContent(). - Post(&mc.ContentTypePost{ - ZhCN: &mc.ContentTypePostBody{ - Content: [][]mc.ContentTypePostBodyItem{ - { - { - Tag: "text", - UnEscape: true, - Text: responseMessage, - }, - }, - }, - }, - }). - Build() - if err != nil { - logger.Errorf("failed to build content: %v", err) - return - } - if err := reply(string(content), msgType); err != nil { - logger.Errorf("failed to reply: %v", err) - return - } - }() - - return nil + return commands. + CreateMessageCommand(feishuClient, chatgptClient, cfg). + Handler([]string{text}, request, reply) }) // return feishuchatbot.Run() @@ -564,8 +154,6 @@ func ServeFeishuBot(cfg *FeishuBotConfig) (err error) { cfg.OpenAIAzureResource, cfg.OpenAIAzureDeployment, cfg.OpenAIAzureAPIVersion, - cfg.ProxyOpenAIAPIPath, - cfg.ProxyOpenAIAPIToken, ) } @@ -578,9 +166,7 @@ func run( OpenAIAPIType, OpenAIAzureResource, OpenAIAzureDeployment, - OpenAIAzureAPIVersion, - ProxyOpenAIAPIPath, - ProxyOpenAIAPIToken string, + OpenAIAzureAPIVersion string, ) error { if OpenAIAPIServer == "" { OpenAIAPIServer = openaiclient.DefaultAPIServer @@ -594,53 +180,5 @@ func run( ctx.String(200, "OK") }) - if ProxyOpenAIAPIPath != "" { - if ProxyOpenAIAPIToken == "" { - return fmt.Errorf("env ProxyOpenAIAPIToken is required when ProxyOpenAIAPIPath sets") - } - - app.Group(ProxyOpenAIAPIPath, func(group *zoox.RouterGroup) { - group.Use(middleware.BearerToken(strings.Split(ProxyOpenAIAPIToken, ","))) - - switch OpenAIAPIType { - case "azure": - target := fmt.Sprintf("https://%s.openai.azure.com", OpenAIAzureResource) - - group.Proxy("/*", target, func(cfg *proxy.SingleTargetConfig) { - cfg.RequestHeaders = http.Header{ - "User-Agent": []string{fmt.Sprintf("GoZoox/ChatGPT-for-ChatBot-Feishu@%s", Version)}, - "api-key": []string{OpenAIAPIKey}, - } - - cfg.Rewrites = rewriter.Rewriters{ - { - From: fmt.Sprintf("^%s/(.*)$", ProxyOpenAIAPIPath), - To: fmt.Sprintf("/openai/deployments/%s/$1", OpenAIAzureDeployment), - }, - } - - cfg.Query = url.Values{ - "api-version": []string{OpenAIAzureAPIVersion}, - } - }) - default: - group.Proxy("/", OpenAIAPIServer, func(cfg *proxy.SingleTargetConfig) { - cfg.RequestHeaders = http.Header{ - "User-Agent": []string{fmt.Sprintf("GoZoox/ChatGPT-for-ChatBot-Feishu@%s", Version)}, - "Authorization": []string{fmt.Sprintf("Bearer %s", OpenAIAPIKey)}, - } - - cfg.Rewrites = rewriter.Rewriters{ - { - From: fmt.Sprintf("^%s/(.*)$", ProxyOpenAIAPIPath), - To: "/v1/$1", - }, - } - }) - } - - }) - } - return app.Run(fmt.Sprintf(":%d", port)) }