message

package
v0.10.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 18, 2023 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Action

type Action struct {
	Name    string      `json:"name,omitempty"`
	Type    string      `json:"type"`
	Payload interface{} `json:"payload,omitempty"`
	Next    string      `json:"next,omitempty"`
}

Action the action

type Command

type Command struct {
	ID      string `json:"id,omitempty"`
	Name    string `json:"name,omitempty"`
	Reqeust string `json:"request,omitempty"`
}

Command the command

type JSON

type JSON struct{ *Message }

JSON the JSON message

func New

func New() *JSON

New create a new JSON message

func NewOpenAI

func NewOpenAI(data []byte) *JSON

NewOpenAI create a new JSON message

func (*JSON) Action

func (json *JSON) Action(name string, t string, payload interface{}, next string) *JSON

Action set the action

func (*JSON) Append

func (json *JSON) Append(content []byte) []byte

Append the message

func (*JSON) Bind

func (json *JSON) Bind(data map[string]interface{}) *JSON

Bind replace with data

func (*JSON) Command

func (json *JSON) Command(name, id, request string) *JSON

Command set the command

func (*JSON) Confirm

func (json *JSON) Confirm() *JSON

Confirm set the confirm

func (*JSON) Done

func (json *JSON) Done() *JSON

Done set the done

func (*JSON) IsDone

func (json *JSON) IsDone() bool

IsDone check if the message is done

func (*JSON) String

func (json *JSON) String() string

func (*JSON) Text

func (json *JSON) Text(text string) *JSON

Text set the text

func (*JSON) Write

func (json *JSON) Write(w io.Writer) bool

Write the message

type Message

type Message struct {
	Text    string   `json:"text,omitempty"`
	Error   string   `json:"error,omitempty"`
	Done    bool     `json:"done,omitempty"`
	Confirm bool     `json:"confirm,omitempty"`
	Command *Command `json:"command,omitempty"`
	Actions []Action `json:"actions,omitempty"`
	Data    map[string]interface{}
}

Message the message

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL