Documentation ¶
Index ¶
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 ¶
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 { Name string ClientConfig *plugin.ClientConfig Client *plugin.Client Assistant Assistant }
func NewAssistantPlugin ¶
func NewAssistantPlugin() *AssistantPlugin
func (*AssistantPlugin) Handler ¶
func (m *AssistantPlugin) Handler() http.Handler
func (*AssistantPlugin) HandlerPrefix ¶
func (m *AssistantPlugin) HandlerPrefix() string
func (*AssistantPlugin) SendMessage ¶
func (m *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) Start ¶
func (m *AssistantPlugin) Start() error
func (*AssistantPlugin) Stop ¶
func (m *AssistantPlugin) Stop() error
func (*AssistantPlugin) Test ¶
func (m *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)