mirror of
https://github.com/coaidev/coai.git
synced 2025-05-31 02:40:32 +09:00
37 lines
620 B
Go
37 lines
620 B
Go
package midjourney
|
|
|
|
import (
|
|
"chat/globals"
|
|
)
|
|
|
|
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, apiSecret, whiteList string) *ChatInstance {
|
|
SaveWhiteList(whiteList)
|
|
|
|
return &ChatInstance{
|
|
Endpoint: endpoint,
|
|
ApiSecret: apiSecret,
|
|
}
|
|
}
|
|
|
|
func NewChatInstanceFromConfig(conf globals.ChannelConfig) *ChatInstance {
|
|
params := conf.SplitRandomSecret(2)
|
|
|
|
return NewChatInstance(
|
|
conf.GetEndpoint(),
|
|
params[0], params[1],
|
|
)
|
|
}
|