coai/adapter/skylark/struct.go
2025-02-13 18:33:48 +08:00

29 lines
620 B
Go

package skylark
import (
factory "chat/adapter/common"
"chat/globals"
"github.com/volcengine/volcengine-go-sdk/service/arkruntime"
)
type ChatInstance struct {
Instance *arkruntime.Client
}
func NewChatInstance(endpoint, apiKey string) *ChatInstance {
//https://ark.cn-beijing.volces.com/api/v3
instance := arkruntime.NewClientWithApiKey(apiKey, arkruntime.WithBaseUrl(endpoint))
return &ChatInstance{
Instance: instance,
}
}
func NewChatInstanceFromConfig(conf globals.ChannelConfig) factory.Factory {
params := conf.SplitRandomSecret(1)
return NewChatInstance(
conf.GetEndpoint(),
params[0],
)
}