diff --git a/go.mod b/go.mod index c6a2231..3f972cc 100644 --- a/go.mod +++ b/go.mod @@ -10,15 +10,15 @@ require ( github.com/fsnotify/fsnotify v1.8.0 github.com/go-chi/chi/v5 v5.2.0 github.com/go-pkgz/lgr v0.11.1 - github.com/go-pkgz/rest v1.20.1 + github.com/go-pkgz/rest v1.20.2 github.com/hashicorp/go-multierror v1.1.1 github.com/jessevdk/go-flags v1.6.1 github.com/jmoiron/sqlx v1.4.0 github.com/sandwich-go/gpt3-encoder v0.0.0-20230203030618-cd99729dd0dd - github.com/sashabaranov/go-openai v1.36.0 + github.com/sashabaranov/go-openai v1.36.1 github.com/stretchr/testify v1.10.0 gopkg.in/natefinch/lumberjack.v2 v2.2.1 - modernc.org/sqlite v1.34.2 + modernc.org/sqlite v1.34.4 ) require ( diff --git a/go.sum b/go.sum index 015a195..622d7c3 100644 --- a/go.sum +++ b/go.sum @@ -25,8 +25,8 @@ github.com/go-pkgz/expirable-cache/v3 v3.0.0 h1:u3/gcu3sabLYiTCevoRKv+WzjIn5oo7P github.com/go-pkgz/expirable-cache/v3 v3.0.0/go.mod h1:2OQiDyEGQalYecLWmXprm3maPXeVb5/6/X7yRPYTzec= github.com/go-pkgz/lgr v0.11.1 h1:hXFhZcznehI6imLhEa379oMOKFz7TQUmisAqb3oLOSM= github.com/go-pkgz/lgr v0.11.1/go.mod h1:tgDF4RXQnBfIgJqjgkv0yOeTQ3F1yewWIZkpUhHnAkU= -github.com/go-pkgz/rest v1.20.1 h1:ZS1HtcguZI90On+/BwMmfISVem7J/5fWEbuNRfswAdo= -github.com/go-pkgz/rest v1.20.1/go.mod h1:kGjA9Zhdv93weeDjBPVMpUKgfzTsBKHjJc8SoQPGbks= +github.com/go-pkgz/rest v1.20.2 h1:6wYWo85H7xFU09FadVKKc5LKIfIpCStBXJj9F/P4COc= +github.com/go-pkgz/rest v1.20.2/go.mod h1:NC2xNN/y1rIs0PY13FowKoH8rk9RhJNJ0tTbkBg8Yks= github.com/go-sql-driver/mysql v1.8.1 h1:LedoTUt/eveggdHS9qUFC1EFSa8bU2+1pZjSRpvNJ1Y= github.com/go-sql-driver/mysql v1.8.1/go.mod h1:wEBSXgmK//2ZFJyE+qWnIsVGmvmEKlqwuVSjsCm7DZg= github.com/google/pprof v0.0.0-20240409012703-83162a5b38cd h1:gbpYu9NMq8jhDVbvlGkMFWCjLFlqqEZjEmObmhUy6Vo= @@ -63,8 +63,8 @@ github.com/samber/lo v1.47.0 h1:z7RynLwP5nbyRscyvcD043DWYoOcYRv3mV8lBeqOCLc= github.com/samber/lo v1.47.0/go.mod h1:RmDH9Ct32Qy3gduHQuKJ3gW1fMHAnE/fAzQuf6He5cU= github.com/sandwich-go/gpt3-encoder v0.0.0-20230203030618-cd99729dd0dd h1:QN5WJmVBDTdmPsqYwLnhC/RocNkVVnNcUFTyC/8+0l0= github.com/sandwich-go/gpt3-encoder v0.0.0-20230203030618-cd99729dd0dd/go.mod h1:waSIdwfZRYYHHxYLTl7WA8U1ezDNFc7G/nlyH1sjxv4= -github.com/sashabaranov/go-openai v1.36.0 h1:fcSrn8uGuorzPWCBp8L0aCR95Zjb/Dd+ZSML0YZy9EI= -github.com/sashabaranov/go-openai v1.36.0/go.mod h1:lj5b/K+zjTSFxVLijLSTDZuP7adOgerWeFyZLUhAKRg= +github.com/sashabaranov/go-openai v1.36.1 h1:EVfRXwIlW2rUzpx6vR+aeIKCK/xylSrVYAx1TMTSX3g= +github.com/sashabaranov/go-openai v1.36.1/go.mod h1:lj5b/K+zjTSFxVLijLSTDZuP7adOgerWeFyZLUhAKRg= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA= @@ -112,8 +112,8 @@ modernc.org/opt v0.1.3 h1:3XOZf2yznlhC+ibLltsDGzABUGVx8J6pnFMS3E4dcq4= modernc.org/opt v0.1.3/go.mod h1:WdSiB5evDcignE70guQKxYUl14mgWtbClRi5wmkkTX0= modernc.org/sortutil v1.2.0 h1:jQiD3PfS2REGJNzNCMMaLSp/wdMNieTbKX920Cqdgqc= modernc.org/sortutil v1.2.0/go.mod h1:TKU2s7kJMf1AE84OoiGppNHJwvB753OYfNl2WRb++Ss= -modernc.org/sqlite v1.34.2 h1:J9n76TPsfYYkFkZ9Uy1QphILYifiVEwwOT7yP5b++2Y= -modernc.org/sqlite v1.34.2/go.mod h1:dnR723UrTtjKpoHCAMN0Q/gZ9MT4r+iRvIBb9umWFkU= +modernc.org/sqlite v1.34.4 h1:sjdARozcL5KJBvYQvLlZEmctRgW9xqIZc2ncN7PU0P8= +modernc.org/sqlite v1.34.4/go.mod h1:3QQFCG2SEMtc2nv+Wq4cQCH7Hjcg+p/RMlS1XK+zwbk= modernc.org/strutil v1.2.0 h1:agBi9dp1I+eOnxXeiZawM8F4LawKv4NzGWSaLfyeNZA= modernc.org/strutil v1.2.0/go.mod h1:/mdcBmfOibveCTBxUl5B5l6W+TTH1FXPLHZE6bTosX0= modernc.org/token v1.1.0 h1:Xl7Ap9dKaEs5kLoOQeQmPWevfnk/DM5qcLcYlA8ys6Y= diff --git a/vendor/github.com/OvyFlash/telegram-bot-api/CODEOWNERS b/vendor/github.com/OvyFlash/telegram-bot-api/CODEOWNERS index 511f002..eda9b16 100644 --- a/vendor/github.com/OvyFlash/telegram-bot-api/CODEOWNERS +++ b/vendor/github.com/OvyFlash/telegram-bot-api/CODEOWNERS @@ -1 +1 @@ -* @iamwavecut @zhuk-kk +* @iamwavecut @zhuk-kk diff --git a/vendor/github.com/OvyFlash/telegram-bot-api/helper_structs.go b/vendor/github.com/OvyFlash/telegram-bot-api/helper_structs.go index 41852fa..10ddc84 100644 --- a/vendor/github.com/OvyFlash/telegram-bot-api/helper_structs.go +++ b/vendor/github.com/OvyFlash/telegram-bot-api/helper_structs.go @@ -1,141 +1,141 @@ -package tgbotapi - -// ChatConfig is a base type for all chat identifiers -type ChatConfig struct { - ChatID int64 - ChannelUsername string - SuperGroupUsername string -} - -func (base ChatConfig) params() (Params, error) { - return base.paramsWithKey("chat_id") -} - -func (base ChatConfig) paramsWithKey(key string) (Params, error) { - params := make(Params) - return params, params.AddFirstValid(key, base.ChatID, base.ChannelUsername, base.SuperGroupUsername) -} - -// BaseChat is base type for all chat config types. -type BaseChat struct { - ChatConfig - BusinessConnectionID BusinessConnectionID - MessageThreadID int - ProtectContent bool - ReplyMarkup interface{} - DisableNotification bool - MessageEffectID string // for private chats only - ReplyParameters ReplyParameters -} - -func (chat *BaseChat) params() (Params, error) { - params, err := chat.ChatConfig.params() - if err != nil { - return params, err - } - p1, err := chat.BusinessConnectionID.params() - if err != nil { - return params, err - } - params.Merge(p1) - - params.AddNonZero("message_thread_id", chat.MessageThreadID) - params.AddBool("disable_notification", chat.DisableNotification) - params.AddBool("protect_content", chat.ProtectContent) - params.AddNonEmpty("message_effect_id", chat.MessageEffectID) - - err = params.AddInterface("reply_markup", chat.ReplyMarkup) - if err != nil { - return params, err - } - err = params.AddInterface("reply_parameters", chat.ReplyParameters) - return params, err -} - -// BaseFile is a base type for all file config types. -type BaseFile struct { - BaseChat - File RequestFileData -} - -func (file BaseFile) params() (Params, error) { - return file.BaseChat.params() -} - -// BaseEdit is base type of all chat edits. -type BaseEdit struct { - BaseChatMessage - InlineMessageID string - ReplyMarkup *InlineKeyboardMarkup -} - -func (edit BaseEdit) params() (Params, error) { - params := make(Params) - - if edit.InlineMessageID != "" { - params["inline_message_id"] = edit.InlineMessageID - } else { - p1, err := edit.BaseChatMessage.params() - if err != nil { - return params, err - } - params.Merge(p1) - } - - err := params.AddInterface("reply_markup", edit.ReplyMarkup) - - return params, err -} - -// BaseSpoiler is base type of structures with spoilers. -type BaseSpoiler struct { - HasSpoiler bool -} - -func (spoiler BaseSpoiler) params() (Params, error) { - params := make(Params) - - if spoiler.HasSpoiler { - params.AddBool("has_spoiler", true) - } - - return params, nil -} - -// BaseChatMessage is a base type for all messages in chats. -type BaseChatMessage struct { - ChatConfig - MessageID int - BusinessConnectionID BusinessConnectionID -} - -func (base BaseChatMessage) params() (Params, error) { - params, err := base.ChatConfig.params() - if err != nil { - return params, err - } - p1, err := base.BusinessConnectionID.params() - if err != nil { - return params, err - } - params.Merge(p1) - params.AddNonZero("message_id", base.MessageID) - - return params, err -} - -// BaseChatMessages is a base type for all messages in chats. -type BaseChatMessages struct { - ChatConfig - MessageIDs []int -} - -func (base BaseChatMessages) params() (Params, error) { - params, err := base.ChatConfig.params() - if err != nil { - return params, err - } - err = params.AddInterface("message_ids", base.MessageIDs) - - return params, err -} +package tgbotapi + +// ChatConfig is a base type for all chat identifiers +type ChatConfig struct { + ChatID int64 + ChannelUsername string + SuperGroupUsername string +} + +func (base ChatConfig) params() (Params, error) { + return base.paramsWithKey("chat_id") +} + +func (base ChatConfig) paramsWithKey(key string) (Params, error) { + params := make(Params) + return params, params.AddFirstValid(key, base.ChatID, base.ChannelUsername, base.SuperGroupUsername) +} + +// BaseChat is base type for all chat config types. +type BaseChat struct { + ChatConfig + BusinessConnectionID BusinessConnectionID + MessageThreadID int + ProtectContent bool + ReplyMarkup interface{} + DisableNotification bool + MessageEffectID string // for private chats only + ReplyParameters ReplyParameters +} + +func (chat *BaseChat) params() (Params, error) { + params, err := chat.ChatConfig.params() + if err != nil { + return params, err + } + p1, err := chat.BusinessConnectionID.params() + if err != nil { + return params, err + } + params.Merge(p1) + + params.AddNonZero("message_thread_id", chat.MessageThreadID) + params.AddBool("disable_notification", chat.DisableNotification) + params.AddBool("protect_content", chat.ProtectContent) + params.AddNonEmpty("message_effect_id", chat.MessageEffectID) + + err = params.AddInterface("reply_markup", chat.ReplyMarkup) + if err != nil { + return params, err + } + err = params.AddInterface("reply_parameters", chat.ReplyParameters) + return params, err +} + +// BaseFile is a base type for all file config types. +type BaseFile struct { + BaseChat + File RequestFileData +} + +func (file BaseFile) params() (Params, error) { + return file.BaseChat.params() +} + +// BaseEdit is base type of all chat edits. +type BaseEdit struct { + BaseChatMessage + InlineMessageID string + ReplyMarkup *InlineKeyboardMarkup +} + +func (edit BaseEdit) params() (Params, error) { + params := make(Params) + + if edit.InlineMessageID != "" { + params["inline_message_id"] = edit.InlineMessageID + } else { + p1, err := edit.BaseChatMessage.params() + if err != nil { + return params, err + } + params.Merge(p1) + } + + err := params.AddInterface("reply_markup", edit.ReplyMarkup) + + return params, err +} + +// BaseSpoiler is base type of structures with spoilers. +type BaseSpoiler struct { + HasSpoiler bool +} + +func (spoiler BaseSpoiler) params() (Params, error) { + params := make(Params) + + if spoiler.HasSpoiler { + params.AddBool("has_spoiler", true) + } + + return params, nil +} + +// BaseChatMessage is a base type for all messages in chats. +type BaseChatMessage struct { + ChatConfig + MessageID int + BusinessConnectionID BusinessConnectionID +} + +func (base BaseChatMessage) params() (Params, error) { + params, err := base.ChatConfig.params() + if err != nil { + return params, err + } + p1, err := base.BusinessConnectionID.params() + if err != nil { + return params, err + } + params.Merge(p1) + params.AddNonZero("message_id", base.MessageID) + + return params, err +} + +// BaseChatMessages is a base type for all messages in chats. +type BaseChatMessages struct { + ChatConfig + MessageIDs []int +} + +func (base BaseChatMessages) params() (Params, error) { + params, err := base.ChatConfig.params() + if err != nil { + return params, err + } + err = params.AddInterface("message_ids", base.MessageIDs) + + return params, err +} diff --git a/vendor/github.com/sashabaranov/go-openai/.gitignore b/vendor/github.com/sashabaranov/go-openai/.gitignore index 99b40bf..b0ac160 100644 --- a/vendor/github.com/sashabaranov/go-openai/.gitignore +++ b/vendor/github.com/sashabaranov/go-openai/.gitignore @@ -16,4 +16,7 @@ # Auth token for tests .openai-token -.idea \ No newline at end of file +.idea + +# Generated by tests +test.mp3 \ No newline at end of file diff --git a/vendor/github.com/sashabaranov/go-openai/chat.go b/vendor/github.com/sashabaranov/go-openai/chat.go index 2b13f8d..fcaf79c 100644 --- a/vendor/github.com/sashabaranov/go-openai/chat.go +++ b/vendor/github.com/sashabaranov/go-openai/chat.go @@ -179,7 +179,7 @@ func (m *ChatCompletionMessage) UnmarshalJSON(bs []byte) error { type ToolCall struct { // Index is not nil only in chat completion chunk object Index *int `json:"index,omitempty"` - ID string `json:"id"` + ID string `json:"id,omitempty"` Type ToolType `json:"type"` Function FunctionCall `json:"function"` } diff --git a/vendor/github.com/sashabaranov/go-openai/run.go b/vendor/github.com/sashabaranov/go-openai/run.go index d3e755f..9c51aaf 100644 --- a/vendor/github.com/sashabaranov/go-openai/run.go +++ b/vendor/github.com/sashabaranov/go-openai/run.go @@ -83,12 +83,13 @@ const ( ) type RunRequest struct { - AssistantID string `json:"assistant_id"` - Model string `json:"model,omitempty"` - Instructions string `json:"instructions,omitempty"` - AdditionalInstructions string `json:"additional_instructions,omitempty"` - Tools []Tool `json:"tools,omitempty"` - Metadata map[string]any `json:"metadata,omitempty"` + AssistantID string `json:"assistant_id"` + Model string `json:"model,omitempty"` + Instructions string `json:"instructions,omitempty"` + AdditionalInstructions string `json:"additional_instructions,omitempty"` + AdditionalMessages []ThreadMessage `json:"additional_messages,omitempty"` + Tools []Tool `json:"tools,omitempty"` + Metadata map[string]any `json:"metadata,omitempty"` // Sampling temperature between 0 and 2. Higher values like 0.8 are more random. // lower values are more focused and deterministic. diff --git a/vendor/modernc.org/sqlite/Makefile b/vendor/modernc.org/sqlite/Makefile index 8b7472d..9fcedc1 100644 --- a/vendor/modernc.org/sqlite/Makefile +++ b/vendor/modernc.org/sqlite/Makefile @@ -37,8 +37,8 @@ build_all_targets: GOOS=linux GOARCH=riscv64 go build -v ./... GOOS=linux GOARCH=s390x go test -c -o /dev/null GOOS=linux GOARCH=s390x go build -v ./... - GOOS=netbsd GOARCH=amd64 go test -c -o /dev/null - GOOS=netbsd GOARCH=amd64 go build -v ./... + # GOOS=netbsd GOARCH=amd64 go test -c -o /dev/null + # GOOS=netbsd GOARCH=amd64 go build -v ./... GOOS=openbsd GOARCH=amd64 go test -c -o /dev/null GOOS=openbsd GOARCH=amd64 go build -v ./... GOOS=openbsd GOARCH=arm64 go test -c -o /dev/null diff --git a/vendor/modernc.org/sqlite/lib/hooks.go b/vendor/modernc.org/sqlite/lib/hooks.go index 9bedb87..4bd919b 100644 --- a/vendor/modernc.org/sqlite/lib/hooks.go +++ b/vendor/modernc.org/sqlite/lib/hooks.go @@ -2,6 +2,8 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build !(linux && arm64) + package sqlite3 import ( @@ -12,3 +14,7 @@ import ( func X__ccgo_sqlite3_log(t *libc.TLS, iErrCode int32, zFormat uintptr, va uintptr) { /* sqlite3.c:29405:17: */ libc.X__ccgo_sqlite3_log(t, iErrCode, zFormat, va) } + +func PatchIssue199() { + // nop +} diff --git a/vendor/modernc.org/sqlite/lib/hooks_linux_arm64.go b/vendor/modernc.org/sqlite/lib/hooks_linux_arm64.go new file mode 100644 index 0000000..be3873b --- /dev/null +++ b/vendor/modernc.org/sqlite/lib/hooks_linux_arm64.go @@ -0,0 +1,30 @@ +// Copyright 2019 The Sqlite Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package sqlite3 + +import ( + "syscall" + "unsafe" + + "modernc.org/libc" +) + +// Format and write a message to the log if logging is enabled. +func X__ccgo_sqlite3_log(t *libc.TLS, iErrCode int32, zFormat uintptr, va uintptr) { /* sqlite3.c:29405:17: */ + libc.X__ccgo_sqlite3_log(t, iErrCode, zFormat, va) +} + +// https://gitlab.com/cznic/sqlite/-/issues/199 +// +// We are currently stuck on libc@v1.55.3. Until that is resolved - fix the +// problem at runtime. +func PatchIssue199() { + p := unsafe.Pointer(&_aSyscall) + *(*uintptr)(unsafe.Add(p, 608)) = __ccgo_fp(_unixGetpagesizeIssue199) +} + +func _unixGetpagesizeIssue199(tls *libc.TLS) (r int32) { + return int32(syscall.Getpagesize()) +} diff --git a/vendor/modernc.org/sqlite/sqlite.go b/vendor/modernc.org/sqlite/sqlite.go index a587b9a..c60ca4c 100644 --- a/vendor/modernc.org/sqlite/sqlite.go +++ b/vendor/modernc.org/sqlite/sqlite.go @@ -56,6 +56,11 @@ const ( sqliteLockedSharedcache = sqlite3.SQLITE_LOCKED | (1 << 8) ) +// https://gitlab.com/cznic/sqlite/-/issues/199 +func init() { + sqlite3.PatchIssue199() +} + // Error represents sqlite library error code. type Error struct { msg string diff --git a/vendor/modules.txt b/vendor/modules.txt index 1f6c34b..ab43cee 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -38,8 +38,8 @@ github.com/go-pkgz/expirable-cache/v3 # github.com/go-pkgz/lgr v0.11.1 ## explicit; go 1.20 github.com/go-pkgz/lgr -# github.com/go-pkgz/rest v1.20.1 -## explicit; go 1.23 +# github.com/go-pkgz/rest v1.20.2 +## explicit; go 1.21 github.com/go-pkgz/rest github.com/go-pkgz/rest/logger github.com/go-pkgz/rest/realip @@ -87,7 +87,7 @@ github.com/samber/lo/internal/rand # github.com/sandwich-go/gpt3-encoder v0.0.0-20230203030618-cd99729dd0dd ## explicit; go 1.18 github.com/sandwich-go/gpt3-encoder -# github.com/sashabaranov/go-openai v1.36.0 +# github.com/sashabaranov/go-openai v1.36.1 ## explicit; go 1.18 github.com/sashabaranov/go-openai github.com/sashabaranov/go-openai/internal @@ -163,7 +163,7 @@ modernc.org/mathutil # modernc.org/memory v1.8.0 ## explicit; go 1.18 modernc.org/memory -# modernc.org/sqlite v1.34.2 +# modernc.org/sqlite v1.34.4 ## explicit; go 1.21 modernc.org/sqlite modernc.org/sqlite/lib