Documentation
¶
Index ¶
- func InvokeDify(declaration *plugin_entities.PluginDeclaration, ...) error
- type BackwardsInvocation
- func (bi *BackwardsInvocation) EndResponse()
- func (bi *BackwardsInvocation) GetID() string
- func (bi *BackwardsInvocation) RequestData() map[string]any
- func (bi *BackwardsInvocation) TenantID() (string, error)
- func (bi *BackwardsInvocation) Type() BackwardsInvocationType
- func (bi *BackwardsInvocation) UserID() (string, error)
- func (bi *BackwardsInvocation) WriteError(err error)
- func (bi *BackwardsInvocation) WriteResponse(message string, data any)
- type BackwardsInvocationResponseEvent
- type BackwardsInvocationType
- type BackwardsInvocationWriter
- type RequestEvent
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func InvokeDify ¶
func InvokeDify( declaration *plugin_entities.PluginDeclaration, invoke_from access_types.PluginAccessType, session *session_manager.Session, writer BackwardsInvocationWriter, data []byte, ) error
returns error only if payload is not correct
Types ¶
type BackwardsInvocation ¶
type BackwardsInvocation struct {
// contains filtered or unexported fields
}
BackwardsInvocation is a struct that represents a backwards invocation For different plugin runtime type, stream handler is different
- Local and Remote: they are both full duplex, multiplexing could be implemented by different session different session share the same physical channel.
- AWS: it is half duplex, one request could have multiple channels, we need to combine them into one stream
That's why it has a writer, for different transaction, the writer is unique
func NewBackwardsInvocation ¶
func NewBackwardsInvocation( typ BackwardsInvocationType, id string, session *session_manager.Session, writer BackwardsInvocationWriter, detailedRequest map[string]any, ) *BackwardsInvocation
func (*BackwardsInvocation) EndResponse ¶
func (bi *BackwardsInvocation) EndResponse()
func (*BackwardsInvocation) GetID ¶
func (bi *BackwardsInvocation) GetID() string
func (*BackwardsInvocation) RequestData ¶
func (bi *BackwardsInvocation) RequestData() map[string]any
func (*BackwardsInvocation) TenantID ¶
func (bi *BackwardsInvocation) TenantID() (string, error)
func (*BackwardsInvocation) Type ¶
func (bi *BackwardsInvocation) Type() BackwardsInvocationType
func (*BackwardsInvocation) UserID ¶
func (bi *BackwardsInvocation) UserID() (string, error)
func (*BackwardsInvocation) WriteError ¶
func (bi *BackwardsInvocation) WriteError(err error)
func (*BackwardsInvocation) WriteResponse ¶
func (bi *BackwardsInvocation) WriteResponse(message string, data any)
type BackwardsInvocationResponseEvent ¶
type BackwardsInvocationResponseEvent struct { BackwardsRequestId string `json:"backwards_request_id"` Event RequestEvent `json:"event"` Message string `json:"message"` Data any `json:"data"` }
func NewEndEvent ¶
func NewEndEvent(request_id string) *BackwardsInvocationResponseEvent
func NewErrorEvent ¶
func NewErrorEvent(request_id string, message string) *BackwardsInvocationResponseEvent
func NewResponseEvent ¶
func NewResponseEvent(request_id string, message string, data any) *BackwardsInvocationResponseEvent
type BackwardsInvocationType ¶
type BackwardsInvocationType = dify_invocation.InvokeType
type BackwardsInvocationWriter ¶
type BackwardsInvocationWriter interface { Write(event session_manager.PLUGIN_IN_STREAM_EVENT, data any) error Done() }
type RequestEvent ¶
type RequestEvent string
const ( REQUEST_EVENT_RESPONSE RequestEvent = "response" REQUEST_EVENT_ERROR RequestEvent = "error" REQUEST_EVENT_END RequestEvent = "end" )
Click to show internal directories.
Click to hide internal directories.