Documentation ¶
Index ¶
- Variables
- func PersistInteractionTrace(receiveTs time.Time, askedTs time.Time, message *Message, nlpTokens *[]string, ...) error
- func Register(plugin *AssistantPlugin) func()
- type Assistant
- type AssistantGRPCPlugin
- type AssistantPlugin
- func (p *AssistantPlugin) Handler() http.Handler
- func (p *AssistantPlugin) HandlerPrefix() string
- func (p *AssistantPlugin) SendMessage(w http.ResponseWriter, r *http.Request)
- func (p *AssistantPlugin) ServicePort() int
- func (p *AssistantPlugin) Start() error
- func (p *AssistantPlugin) Stop() error
- func (p *AssistantPlugin) Test()
- type AssistantResponse
- type GRPCClient
- type GRPCServer
- type Message
Constants ¶
This section is empty.
Variables ¶
var Handshake = plugin.HandshakeConfig{
ProtocolVersion: 1,
MagicCookieKey: "BASIC_PLUGIN",
MagicCookieValue: "hello",
}
Handshake is a common handshake that is shared by plugin and host.
Functions ¶
func PersistInteractionTrace ¶
func PersistInteractionTrace(receiveTs time.Time, askedTs time.Time, message *Message, nlpTokens *[]string, fact *engine.Fact, result *reader.Item, pipelineErr error) error
PersistInteractionTrace store a trace of the assistant interaction in postgresql
func Register ¶ added in v5.1.0
func Register(plugin *AssistantPlugin) func()
Types ¶
type AssistantGRPCPlugin ¶
type AssistantGRPCPlugin struct { // GRPCPlugin must still implement the Plugin interface plugin.Plugin // Concrete implementation, written in Go. This is only used for plugins that are written in Go. Impl Assistant }
func (*AssistantGRPCPlugin) GRPCClient ¶
func (p *AssistantGRPCPlugin) GRPCClient(ctx context.Context, broker *plugin.GRPCBroker, c *grpc.ClientConn) (interface{}, error)
func (*AssistantGRPCPlugin) GRPCServer ¶
func (p *AssistantGRPCPlugin) GRPCServer(broker *plugin.GRPCBroker, s *grpc.Server) error
type AssistantPlugin ¶
type AssistantPlugin struct { Config pluginutils.PluginConfig ClientConfig *plugin.ClientConfig Client *plugin.Client Assistant Assistant }
func NewAssistantPlugin ¶
func NewAssistantPlugin(config pluginutils.PluginConfig) *AssistantPlugin
func P ¶ added in v5.1.0
func P() (*AssistantPlugin, error)
P is used to access the global plugin singleton
func (*AssistantPlugin) Handler ¶
func (p *AssistantPlugin) Handler() http.Handler
func (*AssistantPlugin) HandlerPrefix ¶
func (p *AssistantPlugin) HandlerPrefix() string
func (*AssistantPlugin) SendMessage ¶
func (p *AssistantPlugin) SendMessage(w http.ResponseWriter, r *http.Request)
SendMessage godoc @Summary Sends a message to the myrtea Assistant. @Description Sends a message to the myrtea Assistant. @Tags Assistant @Accept json @Produce json @Param time query string true "Timestamp" @Param sentence body interface{} true "User sentence and context Tokens" @Param debug query string false "Enable log debugging" @Security Bearer @Success 200 "Status OK" @Failure 400 "Status Bad Request" @Failure 500 "Status Internal Server Error" @Router /assistant/message [post]
func (*AssistantPlugin) ServicePort ¶ added in v5.1.0
func (p *AssistantPlugin) ServicePort() int
func (*AssistantPlugin) Start ¶
func (p *AssistantPlugin) Start() error
func (*AssistantPlugin) Stop ¶
func (p *AssistantPlugin) Stop() error
func (*AssistantPlugin) Test ¶
func (p *AssistantPlugin) Test()
type AssistantResponse ¶
type AssistantResponse struct { Result *reader.WidgetData `json:"result"` Tokens []string `json:"tokens"` }
AssistantResponse reflcts the response format of the assistant
type GRPCClient ¶
type GRPCClient struct {
// contains filtered or unexported fields
}
GRPCClient is an implementation of Assistant that talks over RPC.
func (*GRPCClient) SentenceProcess ¶
type GRPCServer ¶
type GRPCServer struct { // This is the real implementation Impl Assistant }
func (*GRPCServer) SentenceProcess ¶
func (m *GRPCServer) SentenceProcess(ctx context.Context, req *proto.NLPSentenceRequest) (*proto.NLPSentenceResponse, error)