Skip to content

Commit

Permalink
Upgrade go deps
Browse files Browse the repository at this point in the history
  • Loading branch information
qianlifeng committed Nov 5, 2024
1 parent 6c0b7cd commit 323910a
Show file tree
Hide file tree
Showing 12 changed files with 212 additions and 76 deletions.
4 changes: 2 additions & 2 deletions Wox/ai/conversation.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import (
type ConversationRole string

var (
ConversationRoleUser ConversationRole = "user"
ConversationRoleSystem ConversationRole = "system"
ConversationRoleUser ConversationRole = "user"
ConversationRoleAI ConversationRole = "ai"
)

type Conversation struct {
Expand Down
7 changes: 4 additions & 3 deletions Wox/ai/provider_google.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,13 @@ package ai
import (
"context"
"errors"
"io"
"wox/setting"

"github.com/google/generative-ai-go/genai"
"github.com/googleapis/gax-go/v2/apierror"
"google.golang.org/api/iterator"
"google.golang.org/api/option"
"io"
"wox/setting"
)

type GoogleProvider struct {
Expand Down Expand Up @@ -110,7 +111,7 @@ func (g *GoogleProvider) convertConversations(conversations []Conversation) (msg
if conversation.Role == ConversationRoleUser {
role = "user"
}
if conversation.Role == ConversationRoleSystem {
if conversation.Role == ConversationRoleAI {
role = "model"
}
if role == "" {
Expand Down
14 changes: 7 additions & 7 deletions Wox/ai/provider_groq.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@ import (
"context"
"errors"
"fmt"
"io"
"wox/setting"
"wox/util"

"github.com/djherbis/buffer"
"github.com/djherbis/nio/v3"
"github.com/tmc/langchaingo/llms"
"github.com/tmc/langchaingo/llms/openai"
"github.com/tmc/langchaingo/schema"
"io"
"wox/setting"
"wox/util"
)

type GroqProvider struct {
Expand Down Expand Up @@ -87,10 +87,10 @@ func (g *GroqProvider) Models(ctx context.Context) (models []Model, err error) {
func (g *GroqProvider) convertConversations(conversations []Conversation) (chatMessages []llms.MessageContent) {
for _, conversation := range conversations {
if conversation.Role == ConversationRoleUser {
chatMessages = append(chatMessages, llms.TextParts(schema.ChatMessageTypeHuman, conversation.Text))
chatMessages = append(chatMessages, llms.TextParts(llms.ChatMessageTypeHuman, conversation.Text))
}
if conversation.Role == ConversationRoleSystem {
chatMessages = append(chatMessages, llms.TextParts(schema.ChatMessageTypeSystem, conversation.Text))
if conversation.Role == ConversationRoleAI {
chatMessages = append(chatMessages, llms.TextParts(llms.ChatMessageTypeAI, conversation.Text))
}
}

Expand Down
16 changes: 8 additions & 8 deletions Wox/ai/provider_ollama.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,16 @@ import (
"context"
"errors"
"fmt"
"image/png"
"io"
"wox/setting"
"wox/util"

"github.com/djherbis/buffer"
"github.com/djherbis/nio/v3"
"github.com/tidwall/gjson"
"github.com/tmc/langchaingo/llms"
"github.com/tmc/langchaingo/llms/ollama"
"github.com/tmc/langchaingo/schema"
"image/png"
"io"
"wox/setting"
"wox/util"
)

type OllamaProvider struct {
Expand Down Expand Up @@ -79,10 +79,10 @@ func (o *OllamaProvider) convertConversations(conversations []Conversation) (cha
for _, conversation := range conversations {
var msg llms.MessageContent
if conversation.Role == ConversationRoleUser {
msg = llms.TextParts(schema.ChatMessageTypeHuman, conversation.Text)
msg = llms.TextParts(llms.ChatMessageTypeHuman, conversation.Text)
}
if conversation.Role == ConversationRoleSystem {
msg = llms.TextParts(schema.ChatMessageTypeSystem, conversation.Text)
if conversation.Role == ConversationRoleAI {
msg = llms.TextParts(llms.ChatMessageTypeAI, conversation.Text)
}

for _, image := range conversation.Images {
Expand Down
5 changes: 3 additions & 2 deletions Wox/ai/provider_openai.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@ package ai

import (
"context"
"github.com/sashabaranov/go-openai"
"io"
"wox/setting"

"github.com/sashabaranov/go-openai"
)

type OpenAIProvider struct {
Expand Down Expand Up @@ -85,7 +86,7 @@ func (o *OpenAIProvider) convertConversations(conversations []Conversation) []op
if conversation.Role == ConversationRoleUser {
role = openai.ChatMessageRoleUser
}
if conversation.Role == ConversationRoleSystem {
if conversation.Role == ConversationRoleAI {
role = openai.ChatMessageRoleSystem
}
if role == "" {
Expand Down
102 changes: 52 additions & 50 deletions Wox/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,105 +3,107 @@ module wox
go 1.23.0

require (
github.com/Masterminds/semver/v3 v3.2.1
github.com/Masterminds/semver/v3 v3.3.0
github.com/cdfmlr/ellipsis v0.0.1
github.com/disintegration/imaging v1.6.2
github.com/djherbis/buffer v1.2.0
github.com/djherbis/nio/v3 v3.0.1
github.com/forPelevin/gomoji v1.2.0
github.com/fsnotify/fsnotify v1.7.0
github.com/fsnotify/fsnotify v1.8.0
github.com/gen2brain/beeep v0.0.0-20240112042604-c7bb2cd88fea
github.com/go-ole/go-ole v1.2.6
github.com/go-resty/resty/v2 v2.12.0
github.com/google/generative-ai-go v0.10.0
github.com/go-resty/resty/v2 v2.15.3
github.com/godbus/dbus/v5 v5.1.0
github.com/google/generative-ai-go v0.18.0
github.com/google/uuid v1.6.0
github.com/googleapis/gax-go/v2 v2.12.3
github.com/gorilla/websocket v1.5.1
github.com/googleapis/gax-go/v2 v2.13.0
github.com/gorilla/websocket v1.5.3
github.com/jinzhu/copier v0.4.0
github.com/jinzhu/now v1.1.5
github.com/lxn/win v0.0.0-20210218163916-a377121e959e
github.com/mat/besticon v0.0.0-20231103204413-ee089084f347
github.com/mitchellh/go-homedir v1.1.0
github.com/mozillazg/go-pinyin v0.20.0
github.com/olahol/melody v1.2.0
github.com/olahol/melody v1.2.1
github.com/otiai10/copy v1.14.0
github.com/parsiya/golnk v0.0.0-20221103095132-740a4c27c4ff
github.com/petermattis/goid v0.0.0-20240327183114-c42a807a84ba
github.com/petermattis/goid v0.0.0-20241025130422-66cb2e6d7274
github.com/robotn/gohook v0.41.0
github.com/rs/cors v1.10.1
github.com/rs/cors v1.11.1
github.com/sahilm/fuzzy v0.1.1
github.com/samber/lo v1.39.0
github.com/samber/lo v1.47.0
github.com/saracen/fastzip v0.1.11
github.com/sashabaranov/go-openai v1.20.4
github.com/shopspring/decimal v1.3.1
github.com/sashabaranov/go-openai v1.32.5
github.com/shopspring/decimal v1.4.0
github.com/srwiley/oksvg v0.0.0-20221011165216-be6e8873101c
github.com/srwiley/rasterx v0.0.0-20220730225603-2ab79fcdd4ef
github.com/stretchr/testify v1.9.0
github.com/struCoder/pidusage v0.2.1
github.com/tidwall/gjson v1.17.1
github.com/tidwall/gjson v1.18.0
github.com/tidwall/pretty v1.2.1
github.com/tmc/langchaingo v0.1.8
github.com/tmc/langchaingo v0.1.12
github.com/wissance/stringFormatter v1.2.0
go.uber.org/zap v1.27.0
golang.design/x/hotkey v0.4.1
golang.org/x/image v0.15.0
golang.org/x/sys v0.21.0
google.golang.org/api v0.172.0
golang.org/x/image v0.21.0
golang.org/x/sys v0.26.0
google.golang.org/api v0.204.0
howett.net/plist v1.0.1
)

require (
cloud.google.com/go v0.112.0 // indirect
cloud.google.com/go/ai v0.3.0 // indirect
cloud.google.com/go/compute v1.23.4 // indirect
cloud.google.com/go/compute/metadata v0.2.3 // indirect
cloud.google.com/go/longrunning v0.5.4 // indirect
github.com/PuerkitoBio/goquery v1.8.1 // indirect
cloud.google.com/go v0.116.0 // indirect
cloud.google.com/go/ai v0.8.2 // indirect
cloud.google.com/go/auth v0.10.0 // indirect
cloud.google.com/go/auth/oauth2adapt v0.2.5 // indirect
cloud.google.com/go/compute v1.28.2 // indirect
cloud.google.com/go/compute/metadata v0.5.2 // indirect
cloud.google.com/go/longrunning v0.6.2 // indirect
github.com/PuerkitoBio/goquery v1.10.0 // indirect
github.com/andybalholm/cascadia v1.3.2 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/dlclark/regexp2 v1.10.0 // indirect
github.com/dlclark/regexp2 v1.11.4 // indirect
github.com/felixge/httpsnoop v1.0.4 // indirect
github.com/go-logr/logr v1.4.1 // indirect
github.com/go-logr/logr v1.4.2 // indirect
github.com/go-logr/stdr v1.2.2 // indirect
github.com/go-toast/toast v0.0.0-20190211030409-01e6764cf0a4 // indirect
github.com/godbus/dbus/v5 v5.1.0 // indirect
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
github.com/golang/protobuf v1.5.3 // indirect
github.com/google/s2a-go v0.1.7 // indirect
github.com/googleapis/enterprise-certificate-proxy v0.3.2 // indirect
github.com/klauspost/compress v1.17.2 // indirect
github.com/golang/protobuf v1.5.4 // indirect
github.com/google/s2a-go v0.1.8 // indirect
github.com/googleapis/enterprise-certificate-proxy v0.3.4 // indirect
github.com/klauspost/compress v1.17.11 // indirect
github.com/kylelemons/godebug v1.1.0 // indirect
github.com/mattn/go-runewidth v0.0.14 // indirect
github.com/mattn/go-runewidth v0.0.16 // indirect
github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e // indirect
github.com/nu7hatch/gouuid v0.0.0-20131221200532-179d4d0c4d8d // indirect
github.com/olekukonko/tablewriter v0.0.5 // indirect
github.com/pkoukk/tiktoken-go v0.1.6 // indirect
github.com/pkoukk/tiktoken-go v0.1.7 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/rivo/uniseg v0.4.3 // indirect
github.com/rivo/uniseg v0.4.7 // indirect
github.com/saracen/zipextra v0.0.0-20220303013732-0187cb0159ea // indirect
github.com/tadvi/systray v0.0.0-20190226123456-11a2b8fa57af // indirect
github.com/tidwall/match v1.1.1 // indirect
github.com/vcaesar/keycode v0.10.1 // indirect
go.opencensus.io v0.24.0 // indirect
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.49.0 // indirect
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.49.0 // indirect
go.opentelemetry.io/otel v1.24.0 // indirect
go.opentelemetry.io/otel/metric v1.24.0 // indirect
go.opentelemetry.io/otel/trace v1.24.0 // indirect
go.uber.org/multierr v1.10.0 // indirect
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.56.0 // indirect
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.56.0 // indirect
go.opentelemetry.io/otel v1.31.0 // indirect
go.opentelemetry.io/otel/metric v1.31.0 // indirect
go.opentelemetry.io/otel/trace v1.31.0 // indirect
go.uber.org/multierr v1.11.0 // indirect
golang.design/x/mainthread v0.3.0 // indirect
golang.org/x/crypto v0.21.0 // indirect
golang.org/x/exp v0.0.0-20230817173708-d852ddb80c63 // indirect
golang.org/x/net v0.22.0 // indirect
golang.org/x/oauth2 v0.18.0 // indirect
golang.org/x/sync v0.6.0 // indirect
golang.org/x/text v0.14.0 // indirect
golang.org/x/time v0.5.0 // indirect
golang.org/x/crypto v0.28.0 // indirect
golang.org/x/exp v0.0.0-20241009180824-f66d83c29e7c // indirect
golang.org/x/net v0.30.0 // indirect
golang.org/x/oauth2 v0.23.0 // indirect
golang.org/x/sync v0.8.0 // indirect
golang.org/x/text v0.19.0 // indirect
golang.org/x/time v0.7.0 // indirect
google.golang.org/appengine v1.6.8 // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20240311132316-a219d84964c2 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20240318140521-94a12d6c2237 // indirect
google.golang.org/grpc v1.62.1 // indirect
google.golang.org/protobuf v1.33.0 // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20241104194629-dd2ea8efbc28 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20241104194629-dd2ea8efbc28 // indirect
google.golang.org/grpc v1.67.1 // indirect
google.golang.org/protobuf v1.35.1 // indirect
gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)
Loading

0 comments on commit 323910a

Please sign in to comment.