coai/adapter/palm2/struct.go
2024-03-12 14:36:18 +08:00

34 lines
565 B
Go

package palm2
import (
factory "chat/adapter/common"
"chat/globals"
)
type ChatInstance struct {
Endpoint string
ApiKey string
}
func (c *ChatInstance) GetApiKey() string {
return c.ApiKey
}
func (c *ChatInstance) GetEndpoint() string {
return c.Endpoint
}
func NewChatInstance(endpoint string, apiKey string) *ChatInstance {
return &ChatInstance{
Endpoint: endpoint,
ApiKey: apiKey,
}
}
func NewChatInstanceFromConfig(conf globals.ChannelConfig) factory.Factory {
return NewChatInstance(
conf.GetEndpoint(),
conf.GetRandomSecret(),
)
}