-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
38 lines (24 loc) · 812 Bytes
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
package main
import (
"github.com/json-iterator/go/extra"
openai "github.com/sashabaranov/go-openai"
"github.com/xen0n/go-workwx"
)
func main() {
conf.init()
var wx = workwx.New(conf.WeiXin.CorpID)
wxclient = wx.WithApp(conf.WeiXin.Secret, conf.WeiXin.AgentID)
if conf.OpenAI.Engine == "" {
openaiconfig = openai.DefaultConfig(conf.OpenAI.APIKEY)
if conf.OpenAI.BaseURL != "" {
openaiconfig.BaseURL = conf.OpenAI.BaseURL
}
openaiclient = openai.NewClientWithConfig(openaiconfig)
} else {
openaiconfig = openai.DefaultAzureConfig(conf.OpenAI.APIKEY, conf.OpenAI.BaseURL, conf.OpenAI.Engine)
openaiclient = openai.NewClientWithConfig(openaiconfig)
}
wxclient.SpawnAccessTokenRefresher()
extra.RegisterFuzzyDecoders()
jsonhttp.init()
}