mirror of
https://github.com/coaidev/coai.git
synced 2025-06-04 04:40:22 +09:00
27 lines
596 B
Go
27 lines
596 B
Go
package skylark
|
|
|
|
import (
|
|
"github.com/spf13/viper"
|
|
"github.com/volcengine/volc-sdk-golang/service/maas"
|
|
)
|
|
|
|
type ChatInstance struct {
|
|
Instance *maas.MaaS
|
|
}
|
|
|
|
func NewChatInstance(accessKey, secretKey string) *ChatInstance {
|
|
instance := maas.NewInstance("maas-api.ml-platform-cn-beijing.volces.com", "cn-beijing")
|
|
instance.SetAccessKey(accessKey)
|
|
instance.SetSecretKey(secretKey)
|
|
return &ChatInstance{
|
|
Instance: instance,
|
|
}
|
|
}
|
|
|
|
func NewChatInstanceFromConfig() *ChatInstance {
|
|
return NewChatInstance(
|
|
viper.GetString("skylark.access_key"),
|
|
viper.GetString("skylark.secret_key"),
|
|
)
|
|
}
|