mirror of
https://github.com/coaidev/coai.git
synced 2025-05-19 13:00:14 +09:00
33 lines
575 B
Go
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"),
|
|
)
|
|
}
|