coai/adapter/midjourney/struct.go
2023-11-13 11:36:58 +08:00

33 lines
575 B
Go

package midjourney
import (
"github.com/spf13/viper"
)
type ChatInstance struct {
Endpoint string
ApiSecret string
}
func (c *ChatInstance) GetApiSecret() string {
return c.ApiSecret
}
func (c *ChatInstance) GetEndpoint() string {
return c.Endpoint
}
func NewChatInstance(endpoint string, apiSecret string) *ChatInstance {
return &ChatInstance{
Endpoint: endpoint,
ApiSecret: apiSecret,
}
}
func NewChatInstanceFromConfig() *ChatInstance {
return NewChatInstance(
viper.GetString("midjourney.endpoint"),
viper.GetString("midjourney.api_secret"),
)
}