model

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Dec 30, 2018 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateConfig

func GenerateConfig() (string, error)

GenerateConfig generates a blank json encoded config template

Types

type Config

type Config struct {
	SlackConfig SlackConfig `json:"slack_config"`
	SnipsConfig SnipsConfig `json:"snips_config"`
	MQTTConfig  MQTTConfig  `json:"mqtt_config"`
}

Config holds relevant configuration for MQTT client and future config options

func LoadConfig

func LoadConfig(path string) (Config, error)

LoadConfig loads path and returns config instance or returns an error

func (Config) Validate

func (c Config) Validate() error

Validate validates the config entries but calling out to other config parts to fill a buffer of errors and returns error if the buf is filled otherwise nil

type EndSession

type EndSession struct {
	SessionID string `json:"sessionId"`
	Text      string `json:"text"`
}

EndSession holds outbound message when responding to user and ending session

type Entity

type Entity struct {
	Ops [][]interface{} `json:"operations"`
}

Entity contains operations/data for injecting entities via mqtt message

func BuildEntityFromSlackUsers

func BuildEntityFromSlackUsers(c SnipsConfig, users []*slack.User) *Entity

type Intent

type Intent struct {
	Name        string  `json:"intentName"`
	Probability float64 `json:"probability"`
}

Intent holds name and the probability of match made by the NLU

type MQTTConfig

type MQTTConfig struct {
	// Required host
	// Example of host tcp://localhost:1883 or just localhost:1833
	Hosts []string `json:"host"`

	// Optional username authentication
	Username string `json:"username"`
	// Optional password authentication
	Password string `json:"password"`
}

MQTTConfig contains the configuration details for the client to connect

type Payload

type Payload struct {
	SessionID string                 `json:"sessionId"`
	Values    map[string]interface{} `json:"customData"`
	Intent    Intent                 `json:"intent"`
	Slots     []Slot                 `json:"slots"`
}

Payload contains the custom payload from a mqtt.Message defined by snips

type SlackConfig

type SlackConfig struct {
	Token string `json:"token"`

	// Message config options
	Username  string   `json:"username"`
	EmojiIcon string   `json:"emoji_icon"`
	Messages  []string `json:"messages"`

	// Blacklist holds the list of user/channel IDs
	// for which should never be messaged.
	Blacklist []string `json:"blacklist"`
}

func (SlackConfig) IsBlacklisted

func (s SlackConfig) IsBlacklisted(id string) bool

type Slot

type Slot struct {
	Confidence float64        `json:"confidence"`
	Entity     string         `json:"entity"`
	Name       string         `json:"slotName"`
	Range      map[string]int `json:"range"`
	RawValue   string         `json:"raw_value"`
	Value      ValueType      `json:"value"`
}

Slot contains details about extracted slots of an intent

type SnipsConfig

type SnipsConfig struct {
	SlackIntent string `json:"slack_intent"`
	SlotName    string `json:"slot_name"`
}

SnipsConfig holds snips related configration like intent name

type ValueType

type ValueType struct {
	Kind  string `json:"kind"`
	Value string `json:"value"`
}

ValueType holds a slot value

Jump to

Keyboard shortcuts

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