Documentation
¶
Index ¶
- Variables
- func Exit(sid string) error
- func GetCommands() ([]driver.Command, error)
- func Load(cfg config.Config) error
- func Match(sid string, query query.Param, input string) (string, error)
- func SetStore(store Store)
- type Arg
- type Command
- type Context
- func ContextWithCancel(parent Context) (Context, context.CancelFunc)
- func ContextWithTimeout(parent Context, timeout time.Duration) (Context, context.CancelFunc)
- func NewContext(sid, payload string) Context
- func NewContextWithCancel(sid, payload string) (Context, context.CancelFunc)
- func NewContextWithTimeout(sid, payload string, timeout time.Duration) (Context, context.CancelFunc)
- type Optional
- type Prepare
- type Prompt
- type Request
- type Store
Constants ¶
This section is empty.
Variables ¶
View Source
var Autopilots = []string{}
Autopilots the autopilots
View Source
var Commands = map[string]*Command{}
Commands the commands
Functions ¶
Types ¶
type Arg ¶
type Arg struct {
Name string `json:"name"`
Type string `json:"type"`
Description string `json:"description,omitempty"`
Default interface{} `json:"default,omitempty"`
Required bool `json:"required,omitempty"`
}
Arg the argument
type Command ¶
type Command struct {
ID string `json:"-" yaml:"-"`
Name string `json:"name,omitempty"`
Use string `json:"use,omitempty"`
Connector string `json:"connector"`
Process string `json:"process"`
Prepare Prepare `json:"prepare"`
Description string `json:"description,omitempty"`
Optional Optional `json:"optional,omitempty"`
Args []Arg `json:"args,omitempty"`
Actions []message.Action `json:"actions,omitempty"`
Stack string `json:"stack,omitempty"` // query stack
Path string `json:"path,omitempty"` // query path
AI aigc.AI `json:"-" yaml:"-"`
}
Command the command struct
func LoadSource ¶
LoadSource load AIGC
func (*Command) NewRequest ¶
func (cmd *Command) NewRequest(ctx Context, conversation conversation.Conversation) (*Request, error)
NewRequest create a new request
type Context ¶
type Context struct {
Sid string `json:"-" yaml:"-"`
Stack string `json:"stack,omitempty"`
Path string `json:"pathname,omitempty"`
context.Context `json:"-" yaml:"-"`
}
Context the context
func ContextWithCancel ¶
func ContextWithCancel(parent Context) (Context, context.CancelFunc)
ContextWithCancel create a new context
func ContextWithTimeout ¶
ContextWithTimeout create a new context
func NewContextWithCancel ¶
func NewContextWithCancel(sid, payload string) (Context, context.CancelFunc)
NewContextWithCancel create a new context with cancel
func NewContextWithTimeout ¶
func NewContextWithTimeout(sid, payload string, timeout time.Duration) (Context, context.CancelFunc)
NewContextWithTimeout create a new context with timeout
type Optional ¶
type Optional struct {
Autopilot bool `json:"autopilot,omitempty"`
Confirm bool `json:"confirm,omitempty"`
MaxAttempts int `json:"maxAttempts,omitempty"` // default 10
}
Optional optional
type Prepare ¶
type Prepare struct {
Before string `json:"before,omitempty"`
After string `json:"after,omitempty"`
Prompts []Prompt `json:"prompts"`
Option map[string]interface{} `json:"option"`
}
Prepare the prepare struct
type Prompt ¶
type Prompt struct {
Role string `json:"role"`
Content string `json:"content"`
Name string `json:"name,omitempty"`
}
Prompt a prompt
type Request ¶
type Request struct {
*Command
// contains filtered or unexported fields
}
Request the command request
type Store ¶
type Store interface {
Match(query query.Param, content string) (string, error)
Set(key string, cmd driver.Command) error
Get(key string) (driver.Command, bool)
Del(key string)
SetRequest(sid, id, cid string) error
GetRequest(sid string) (string, string, bool)
DelRequest(sid string)
GetCommands() ([]driver.Command, error)
}
Store the command driver
var DefaultStore Store
DefaultStore the default store driver
Click to show internal directories.
Click to hide internal directories.