Skip to content

Commit

Permalink
feat: coze/websdk 启动时publish参数
Browse files Browse the repository at this point in the history
  • Loading branch information
bincooo committed Jul 10, 2024
1 parent 151869d commit 39fc197
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 3 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ require (
github.com/antonfisher/nested-logrus-formatter v1.3.1
github.com/bincooo/claude-api v1.0.5-0.20240701123553-4d8ff283f8a3
github.com/bincooo/cohere-api v0.0.0-20240620172202-4b7697448b46
github.com/bincooo/coze-api v1.0.2-0.20240710150018-e6299c502839
github.com/bincooo/coze-api v1.0.2-0.20240710234419-e6beb08835cf
github.com/bincooo/edge-api v1.0.4-0.20240708092054-d92610338ccb
github.com/bincooo/emit.io v0.0.0-20240702162758-27d516d8f566
github.com/bincooo/you.com v0.0.0-20240702171358-0e86fdf0c3be
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ github.com/bincooo/claude-api v1.0.5-0.20240701123553-4d8ff283f8a3 h1:WQXGXYrbXm
github.com/bincooo/claude-api v1.0.5-0.20240701123553-4d8ff283f8a3/go.mod h1:5pE4rNVYJTfwsvPkkQhegLO1PqCjuNdG8idccxjXW3s=
github.com/bincooo/cohere-api v0.0.0-20240620172202-4b7697448b46 h1:12sHtk9r99icBCTBnsHaYep5DjH4gu6AzceFNSf216U=
github.com/bincooo/cohere-api v0.0.0-20240620172202-4b7697448b46/go.mod h1:X2PunEb/JOvEnkKkQnlm27UZnn96TR53hGH5TZ55Ak4=
github.com/bincooo/coze-api v1.0.2-0.20240710150018-e6299c502839 h1:TgSJj205rdeOL5wDjGhSlFAKzrRUWRkeKygFxptCNpg=
github.com/bincooo/coze-api v1.0.2-0.20240710150018-e6299c502839/go.mod h1:bjubsmanaC507lGXSVTYWVaIQRs+b9AJM6S1yxEk8Ts=
github.com/bincooo/coze-api v1.0.2-0.20240710234419-e6beb08835cf h1:ncIRh22lnsDhzkTmuedG217tSJSYD2fYZO948VnLk2I=
github.com/bincooo/coze-api v1.0.2-0.20240710234419-e6beb08835cf/go.mod h1:bjubsmanaC507lGXSVTYWVaIQRs+b9AJM6S1yxEk8Ts=
github.com/bincooo/edge-api v1.0.4-0.20240708092054-d92610338ccb h1:P5W+FZ9n/4AEVdpNoSJ6xnyHc8iJa7xk3V50oAsttwM=
github.com/bincooo/edge-api v1.0.4-0.20240708092054-d92610338ccb/go.mod h1:OBBrqmW8rUMTsF/sPH1GsPQT5K9QKJCZkHdYkTIR09Q=
github.com/bincooo/emit.io v0.0.0-20240702162758-27d516d8f566 h1:bJNwKep2EzxAMpRoVhcAhIl/6H7jTEKr1VthgHNofEU=
Expand Down
25 changes: 25 additions & 0 deletions internal/plugin/llm/coze/websdk.go
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,31 @@ func _tasks(opts ...map[string]interface{}) (exec bool) {
continue
}

timeout, cancel = context.WithTimeout(context.Background(), 5*time.Second)
space, err := chat.GetSpace(timeout)
cancel()
if err != nil {
logger.Errorf("custom-128k space err: %v", err)
continue
}

chat.Bot(botId, space, 1000, false)
timeout, cancel = context.WithTimeout(context.Background(), 5*time.Second)
err = chat.DraftBot(context.Background(), coze.DraftInfo{
Model: coze.ModelGpt4o_128k,
Temperature: 0.75,
TopP: 1,
FrequencyPenalty: 0,
PresencePenalty: 0,
MaxTokens: 8192,
ResponseFormat: 0,
}, "")
cancel()
if err != nil {
logger.Errorf("custom-128k drafbot err: %v", err)
continue
}

timeout, cancel = context.WithTimeout(context.Background(), 5*time.Second)
err = chat.Publish(timeout, botId)
cancel()
Expand Down

0 comments on commit 39fc197

Please sign in to comment.