mirror of
https://github.com/coaidev/coai.git
synced 2025-05-20 05:20:15 +09:00
31 lines
524 B
Go
31 lines
524 B
Go
package bing
|
|
|
|
import (
|
|
factory "chat/adapter/common"
|
|
"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) factory.Factory {
|
|
return NewChatInstance(
|
|
conf.GetEndpoint(),
|
|
conf.GetRandomSecret(),
|
|
)
|
|
}
|