mirror of
https://github.com/coaidev/coai.git
synced 2025-05-19 21:10:18 +09:00
30 lines
491 B
Go
30 lines
491 B
Go
package bing
|
|
|
|
import (
|
|
"chat/globals"
|
|
"fmt"
|
|
)
|
|
|
|
type ChatInstance struct {
|
|
Endpoint string
|
|
Secret string
|
|
}
|
|
|
|
func (c *ChatInstance) GetEndpoint() string {
|
|
return fmt.Sprintf("%s/chat", c.Endpoint)
|
|
}
|
|
|
|
func NewChatInstance(endpoint, secret string) *ChatInstance {
|
|
return &ChatInstance{
|
|
Endpoint: endpoint,
|
|
Secret: secret,
|
|
}
|
|
}
|
|
|
|
func NewChatInstanceFromConfig(conf globals.ChannelConfig) *ChatInstance {
|
|
return NewChatInstance(
|
|
conf.GetEndpoint(),
|
|
conf.GetRandomSecret(),
|
|
)
|
|
}
|