aibot

package
v0.1.16 Latest Latest
Warning

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

Go to latest
Published: Jul 6, 2023 License: AGPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultServiceURL = "https://ai-bot-srv.nw.r.appspot.com"

DefaultServiceURL ...

Variables

This section is empty.

Functions

This section is empty.

Types

type Bot

type Bot struct {
	ID        string             `yaml:"id,omitempty" json:"id,omitempty"`
	Name      string             `yaml:"name,omitempty" json:"name,omitempty"`
	Language  string             `yaml:"language,omitempty" json:"language,omitempty"`
	InitState string             `yaml:"init_state,omitempty" json:"init_state,omitempty"`
	Intents   map[string]*Intent `yaml:"intents,omitempty" json:"intents,omitempty"`
	States    map[string]*State  `yaml:"states,omitempty" json:"states,omitempty"`
	Entities  map[string]*Entity `yaml:"entities,omitempty" json:"entities,omitempty"`
	Synonyms  []string           `yaml:"synonyms,omitempty" json:"synonyms,omitempty"`
}

Bot ...

func (*Bot) Scan

func (b *Bot) Scan(data interface{}) error

Scan ...

func (*Bot) Validate

func (b *Bot) Validate() error

Validate ...

func (*Bot) Value

func (b *Bot) Value() (driver.Value, error)

Value ...

type Client

type Client struct {
	ServiceURL string
	SecretKey  string
}

Client ...

func (*Client) Deploy added in v0.1.2

func (c *Client) Deploy(bot *Bot) (DeployResult, error)

Deploy ...

func (*Client) GetBot added in v0.1.2

func (c *Client) GetBot(id string) (*Bot, error)

GetBot ...

func (*Client) ListBots added in v0.1.6

func (c *Client) ListBots() ([]string, error)

ListBots ...

func (*Client) RecogniseIntent added in v0.1.5

func (c *Client) RecogniseIntent(botID, text string) ([]IntentSimilarity, map[string][]string, error)

RecogniseIntent ...

func (*Client) Signin

func (c *Client) Signin(username, password string) (string, string, error)

Signin ...

func (*Client) Signup

func (c *Client) Signup(username, fullname, email, password, orgName string) error

Signup ...

func (*Client) Whoami

func (c *Client) Whoami() (*User, error)

Whoami ...

type DeployResult added in v0.1.2

type DeployResult string

DeployResult ...

type Entity added in v0.1.8

type Entity struct {
	Values []string `yaml:"values,omitempty" json:"values,omitempty"`
}

Entity ...

type Intent

type Intent struct {
	Examples []string `yaml:"examples,omitempty" json:"examples,omitempty"`
}

Intent ...

func (*Intent) Validate

func (i *Intent) Validate(iid string) error

Validate ...

type IntentSimilarity added in v0.1.5

type IntentSimilarity struct {
	IntentID   string  `json:"intent_id"`
	Similarity float64 `json:"similarity"`
}

IntentSimilarity ...

type Message

type Message struct {
	Text    string   `yaml:"text,omitempty" json:"text,omitempty"`
	Options []string `yaml:"options,omitempty" json:"options,omitempty"`
}

Message ...

func (*Message) HasOption

func (m *Message) HasOption(o string) bool

HasOption ...

type Next

type Next struct {
	State  string         `yaml:"state,omitempty" json:"state,omitempty"`
	If     string         `yaml:"if,omitempty" json:"if,omitempty"`
	IfExpr ast.Expression `yaml:"-" json:"-"`
}

Next ...

type State

type State struct {
	Message *Message `yaml:"message,omitempty" json:"message,omitempty"`
	Action  string   `yaml:"action,omitempty" json:"action,omitempty"`
	Next    []*Next  `yaml:"next,omitempty" json:"next,omitempty"`
}

State ...

func (*State) Validate

func (s *State) Validate(sid string, b *Bot) error

Validate ...

type User

type User struct {
	ID       int      `json:"id"`
	Username string   `json:"username"`
	Fullname string   `json:"fullname"`
	Email    string   `json:"email"`
	Roles    []string `json:"roles"`
	OrgID    int      `json:"org_id"`
	OrgName  string   `json:"org_name"`
}

User ...

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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