Documentation ¶
Index ¶
- Constants
- func AppUrl() string
- func ExtractText(content interface{}) string
- func Id() string
- func TimeNow() time.Time
- func TypeOf(payload MsgPayload) string
- type Action
- type ActionMsg
- type AttachmentOption
- type AudioMsg
- type CardListMsg
- type CardMsg
- type ChartMsg
- type ChatMessage
- func (c ChatMessage) Content() (map[string]interface{}, interface{})
- func (c ChatMessage) GetEntDatas(tp string) []EntData
- func (c ChatMessage) GetFormattedText() string
- func (c ChatMessage) GetGenericAttachment() []EntData
- func (c ChatMessage) GetHashTags() []EntData
- func (c ChatMessage) GetImages() []EntData
- func (c ChatMessage) GetLinks() []EntData
- func (c ChatMessage) GetMentions() []EntData
- type Context
- type CrateMsg
- type DataFilter
- type DigitMsg
- type EntData
- type EntMessage
- type EventPayload
- type FileDef
- type FileMsg
- type FileOption
- type FlowkitData
- type FmtMessage
- type FormField
- type FormFieldType
- type FormFieldValueType
- type FormMsg
- type HtmlMsg
- type ImageMsg
- type ImageOption
- type InfoMsg
- type InstructMsg
- type KV
- func (j KV) Any(key string) (any, bool)
- func (j KV) Float64(key string) (float64, bool)
- func (j KV) Float64Value() (float64, bool)
- func (j KV) Int64(key string) (int64, bool)
- func (j KV) Int64Value() (int64, bool)
- func (j KV) List(key string) ([]any, bool)
- func (j KV) Map(key string) (map[string]interface{}, bool)
- func (j KV) Merge(kvs ...KV) KV
- func (j *KV) Scan(value interface{}) error
- func (j KV) String(key string) (string, bool)
- func (j KV) StringValue() (string, bool)
- func (j KV) Uint64(key string) (uint64, bool)
- func (j KV) Uint64Value() (uint64, bool)
- func (j KV) Value() (driver.Value, error)
- type KVMsg
- type LinkListMsg
- type LinkMsg
- type LocationMsg
- type MarkdownMsg
- type Message
- type Mount
- type MsgBuilder
- func (m *MsgBuilder) AppendAttachment(fileName string, opt AttachmentOption)
- func (m *MsgBuilder) AppendFile(fileName string, opt FileOption)
- func (m *MsgBuilder) AppendImage(imageName string, opt ImageOption)
- func (m *MsgBuilder) AppendText(text string, opt TextOption)
- func (m *MsgBuilder) AppendTextLine(text string, opt TextOption)
- func (m *MsgBuilder) BuildAttachmentMessage(fileName string, text string, opt AttachmentOption) ChatMessage
- func (m *MsgBuilder) BuildFileMessage(fileName string, text string, opt FileOption) ChatMessage
- func (m *MsgBuilder) BuildImageMessage(imageName string, text string, opt ImageOption) ChatMessage
- func (m *MsgBuilder) BuildTextMessage(text string) ChatMessage
- func (m *MsgBuilder) Content() (map[string]interface{}, interface{})
- func (m *MsgBuilder) Parse(message ServerData) (ChatMessage, error)
- type MsgPayload
- type ObjHeader
- type OkrMsg
- type QuestionMsg
- type Registry
- type RepoMsg
- type ScriptMsg
- type SendFunc
- type ServerData
- type TableMsg
- type Task
- type TaskLimits
- type TaskRetry
- type TaskState
- type TextListMsg
- type TextMsg
- type TextOption
- type TodoMsg
- type UI
- type Uid
- type VideoMsg
- type WorkflowMetadata
- type WorkflowTask
Constants ¶
const ( BotTotalStatsName = "BotTotal" BotRunInputTotalStatsName = "BotRunInputTotal" BotRunGroupTotalStatsName = "BotRunGroupTotal" BotRunAgentTotalStatsName = "BotRunAgentTotal" BotRunCommandTotalStatsName = "BotRunCommandTotal" BotRunConditionTotalStatsName = "BotRunConditionTotal" BotRunCronTotalStatsName = "BotRunCronTotal" BotRunFormTotalStatsName = "BotRunFormTotal" BotTriggerPipelineTotalStatsName = "BotTriggerPipelineTotal" )
const ( MessageSendEvent = "message:send" InstructPushEvent = "instruct:push" )
const ( MountTypeVolume string = "volume" MountTypeBind string = "bind" MountTypeTmpfs string = "tmpfs" )
Variables ¶
This section is empty.
Functions ¶
func ExtractText ¶
func ExtractText(content interface{}) string
func TypeOf ¶
func TypeOf(payload MsgPayload) string
Types ¶
type ActionMsg ¶
type AttachmentOption ¶
type AudioMsg ¶
type CardListMsg ¶
type CardListMsg struct {
Cards []CardMsg
}
func (CardListMsg) Convert ¶
func (m CardListMsg) Convert() (KV, interface{})
type ChartMsg ¶
type ChatMessage ¶
type ChatMessage struct { Text string `json:"txt,omitempty"` Fmt []FmtMessage `json:"fmt,omitempty"` Ent []EntMessage `json:"ent,omitempty"` IsPlainText bool `json:"-"` MessageType string `json:"-"` Src MsgPayload `json:"src,omitempty"` Tye string `json:"tye,omitempty"` }
func (ChatMessage) Content ¶
func (c ChatMessage) Content() (map[string]interface{}, interface{})
func (ChatMessage) GetEntDatas ¶
func (c ChatMessage) GetEntDatas(tp string) []EntData
GetEntDatas get entity from chat message by entity type
func (ChatMessage) GetFormattedText ¶
func (c ChatMessage) GetFormattedText() string
GetFormattedText Get original text message, inlude original '\n'
func (ChatMessage) GetGenericAttachment ¶
func (c ChatMessage) GetGenericAttachment() []EntData
GetGenericAttachment get generic attachment
func (ChatMessage) GetHashTags ¶
func (c ChatMessage) GetHashTags() []EntData
GetHashTags get hashtags
func (ChatMessage) GetMentions ¶
func (c ChatMessage) GetMentions() []EntData
GetMentions get mentioned users
type Context ¶
type Context struct { // Message ID denormalized Id string // chat platform Platform string // channel or group Topic string // Sender's UserId as string. AsUser Uid // OAuth token Token string // form id FormId string // form Rule id FormRuleId string // agent AgentId string // agent AgentVersion int // page rule id PageRuleId string // workflow rule id WorkflowRuleId string // llm tool rule id ToolRuleId string // contains filtered or unexported fields }
func (*Context) Cancel ¶
func (c *Context) Cancel() context.CancelFunc
func (*Context) SetTimeout ¶
type CrateMsg ¶
type CrateMsg struct { ID string `json:"id,omitempty"` Name string `json:"name,omitempty"` Description string `json:"description,omitempty"` Documentation string `json:"documentation,omitempty"` Homepage string `json:"homepage,omitempty"` Repository string `json:"repository,omitempty"` NewestVersion string `json:"newest_version,omitempty"` Downloads int `json:"downloads,omitempty"` }
type DataFilter ¶
type EntData ¶
type EntData struct { Mime string `json:"mime,omitempty"` Val interface{} `json:"val,omitempty"` Url string `json:"url,omitempty"` Ref string `json:"ref,omitempty"` Width int `json:"width,omitempty"` Height int `json:"height,omitempty"` Name string `json:"name,omitempty"` Size int `json:"size,omitempty"` Act string `json:"act,omitempty"` }
type EntMessage ¶
type EventPayload ¶
type FileDef ¶
type FileDef struct { ObjHeader `bson:",inline"` // Status of upload Status int // User who created the file User string // Type of the file. MimeType string // Size of the file in bytes. Size int64 // Internal file location, i.e. path on disk or an S3 blob address. Location string }
FileDef is a stored record of a file upload
type FileOption ¶
type FlowkitData ¶
type FmtMessage ¶
type FormField ¶
type FormField struct { Type FormFieldType `json:"type"` Key string `json:"key"` Value interface{} `json:"value"` ValueType FormFieldValueType `json:"value_type"` Label string `json:"label"` Placeholder string `json:"placeholder"` Option []string `json:"option"` Rule string `json:"rule"` }
type FormFieldType ¶
type FormFieldType string
const ( FormFieldText FormFieldType = "text" FormFieldPassword FormFieldType = "password" FormFieldNumber FormFieldType = "number" FormFieldColor FormFieldType = "color" FormFieldFile FormFieldType = "file" FormFieldMonth FormFieldType = "month" FormFieldDate FormFieldType = "date" FormFieldTime FormFieldType = "time" FormFieldEmail FormFieldType = "email" FormFieldUrl FormFieldType = "url" FormFieldRadio FormFieldType = "radio" FormFieldCheckbox FormFieldType = "checkbox" FormFieldRange FormFieldType = "range" FormFieldSelect FormFieldType = "select" FormFieldTextarea FormFieldType = "textarea" FormFieldHidden FormFieldType = "hidden" )
type FormFieldValueType ¶
type FormFieldValueType string
const ( FormFieldValueString FormFieldValueType = "string" FormFieldValueBool FormFieldValueType = "bool" FormFieldValueInt64 FormFieldValueType = "int64" FormFieldValueFloat64 FormFieldValueType = "float64" FormFieldValueStringSlice FormFieldValueType = "string_slice" FormFieldValueInt64Slice FormFieldValueType = "int64_slice" FormFieldValueFloat64Slice FormFieldValueType = "float64_slice" )
type FormMsg ¶
type ImageMsg ¶
type ImageOption ¶
type InstructMsg ¶
type InstructMsg struct { No string Object model.InstructObject Bot string Flag string Content KV Priority model.InstructPriority State model.InstructState ExpireAt time.Time }
func (InstructMsg) Convert ¶
func (t InstructMsg) Convert() (KV, interface{})
type KV ¶
type KV map[string]interface{}
func Convert ¶
func Convert(payloads []MsgPayload) ([]KV, []any)
func (KV) Float64Value ¶
func (KV) Int64Value ¶
func (KV) StringValue ¶
func (KV) Uint64Value ¶
type LinkListMsg ¶
type LinkListMsg struct {
Links []LinkMsg
}
func (LinkListMsg) Convert ¶
func (m LinkListMsg) Convert() (KV, interface{})
type LinkMsg ¶
type LocationMsg ¶
type LocationMsg struct { Longitude float64 `json:"longitude"` Latitude float64 `json:"latitude"` Address string `json:"address"` }
func (LocationMsg) Convert ¶
func (a LocationMsg) Convert() (KV, interface{})
type MarkdownMsg ¶
func (MarkdownMsg) Convert ¶
func (m MarkdownMsg) Convert() (KV, interface{})
type Message ¶
type Message struct { Platform string Topic string Payload EventPayload }
type MsgBuilder ¶
type MsgBuilder struct { Payload MsgPayload Message ChatMessage }
func (*MsgBuilder) AppendAttachment ¶
func (m *MsgBuilder) AppendAttachment(fileName string, opt AttachmentOption)
AppendAttachment append a attachment file to chat message
func (*MsgBuilder) AppendFile ¶
func (m *MsgBuilder) AppendFile(fileName string, opt FileOption)
AppendFile Append file to build message
func (*MsgBuilder) AppendImage ¶
func (m *MsgBuilder) AppendImage(imageName string, opt ImageOption)
AppendImage Append image to build message
func (*MsgBuilder) AppendText ¶
func (m *MsgBuilder) AppendText(text string, opt TextOption)
AppendText Append text message to build message
func (*MsgBuilder) AppendTextLine ¶
func (m *MsgBuilder) AppendTextLine(text string, opt TextOption)
AppendTextLine Append text message and line break to build message
func (*MsgBuilder) BuildAttachmentMessage ¶
func (m *MsgBuilder) BuildAttachmentMessage(fileName string, text string, opt AttachmentOption) ChatMessage
BuildAttachmentMessage build a attachment message
func (*MsgBuilder) BuildFileMessage ¶
func (m *MsgBuilder) BuildFileMessage(fileName string, text string, opt FileOption) ChatMessage
BuildFileMessage build a file chat message
func (*MsgBuilder) BuildImageMessage ¶
func (m *MsgBuilder) BuildImageMessage(imageName string, text string, opt ImageOption) ChatMessage
BuildImageMessage build a image chat message
func (*MsgBuilder) BuildTextMessage ¶
func (m *MsgBuilder) BuildTextMessage(text string) ChatMessage
BuildTextMessage build text chat message with formatted
func (*MsgBuilder) Content ¶
func (m *MsgBuilder) Content() (map[string]interface{}, interface{})
func (*MsgBuilder) Parse ¶
func (m *MsgBuilder) Parse(message ServerData) (ChatMessage, error)
Parse a raw ServerData to friendly ChatMessage
type MsgPayload ¶
type MsgPayload interface {
Convert() (KV, interface{})
}
func ToPayload ¶
func ToPayload(typ string, src []byte) MsgPayload
type ObjHeader ¶
type ObjHeader struct { // using string to get around rethinkdb's problems with uint64; // `bson:"_id"` tag is for mongodb to use as primary key '_id'. Id string `bson:"_id"` //id Uid CreatedAt time.Time UpdatedAt time.Time }
ObjHeader is the header shared by all stored objects.
type OkrMsg ¶
type QuestionMsg ¶
func (QuestionMsg) Convert ¶
func (m QuestionMsg) Convert() (KV, interface{})
type Registry ¶
type RepoMsg ¶
type RepoMsg struct { ID *int64 `json:"id,omitempty"` NodeID *string `json:"node_id,omitempty"` Name *string `json:"name,omitempty"` FullName *string `json:"full_name,omitempty"` Description *string `json:"description,omitempty"` Homepage *string `json:"homepage,omitempty"` CreatedAt *time.Time `json:"created_at,omitempty"` PushedAt *time.Time `json:"pushed_at,omitempty"` UpdatedAt *time.Time `json:"updated_at,omitempty"` HTMLURL *string `json:"html_url,omitempty"` Language *string `json:"language,omitempty"` Fork *bool `json:"fork,omitempty"` ForksCount *int `json:"forks_count,omitempty"` NetworkCount *int `json:"network_count,omitempty"` OpenIssuesCount *int `json:"open_issues_count,omitempty"` StargazersCount *int `json:"stargazers_count,omitempty"` SubscribersCount *int `json:"subscribers_count,omitempty"` WatchersCount *int `json:"watchers_count,omitempty"` Size *int `json:"size,omitempty"` Topics []string `json:"topics,omitempty"` Archived *bool `json:"archived,omitempty"` Disabled *bool `json:"disabled,omitempty"` }
type SendFunc ¶
type SendFunc func(topic string, uid Uid, out MsgPayload, option ...interface{})
type ServerData ¶
type TableMsg ¶
type Task ¶
type Task struct { ID string `json:"id,omitempty"` State TaskState `json:"state,omitempty"` CreatedAt *time.Time `json:"createdAt,omitempty"` StartedAt *time.Time `json:"startedAt,omitempty"` CompletedAt *time.Time `json:"completedAt,omitempty"` FailedAt *time.Time `json:"failedAt,omitempty"` CMD []string `json:"cmd,omitempty"` Entrypoint []string `json:"entrypoint,omitempty"` Run string `json:"run,omitempty"` Image string `json:"image,omitempty"` Registry *Registry `json:"registry,omitempty"` Env map[string]string `json:"env,omitempty"` Files map[string]string `json:"files,omitempty"` Error string `json:"error,omitempty"` Pre []*Task `json:"pre,omitempty"` Post []*Task `json:"post,omitempty"` Mounts []Mount `json:"mounts,omitempty"` Networks []string `json:"networks,omitempty"` Retry *TaskRetry `json:"retry,omitempty"` Limits *TaskLimits `json:"limits,omitempty"` Timeout string `json:"timeout,omitempty"` Result string `json:"result,omitempty"` GPUs string `json:"gpus,omitempty"` }
Task is the basic unit of work that a Worker can handle.
func CloneTasks ¶
type TaskLimits ¶
type TaskLimits struct { CPUs string `json:"cpus,omitempty"` Memory string `json:"memory,omitempty"` }
func (*TaskLimits) Clone ¶
func (l *TaskLimits) Clone() *TaskLimits
type TaskRetry ¶
type TaskState ¶
type TaskState string
TaskState State defines the list of states that a task can be in, at any given moment.
type TextListMsg ¶
type TextListMsg struct {
Texts []string
}
func (TextListMsg) Convert ¶
func (m TextListMsg) Convert() (KV, interface{})
type TextOption ¶
type Uid ¶
type Uid string
Uid is a database-specific record id, suitable to be used as a primary key.
const ZeroUid Uid = ""
ZeroUid is a constant representing uninitialized Uid.
type VideoMsg ¶
type WorkflowMetadata ¶
type WorkflowMetadata struct { Name string `json:"name" yaml:"name"` Describe string `json:"describe" yaml:"describe"` Triggers []struct { Type string `json:"type" yaml:"type"` Rule KV `json:"rule,omitempty" yaml:"rule"` } `json:"triggers" yaml:"triggers"` Pipeline []string `json:"pipeline" yaml:"pipeline"` Tasks []WorkflowTask `json:"tasks" yaml:"tasks"` }
type WorkflowTask ¶
type WorkflowTask struct { ID string `json:"id" yaml:"id"` Action string `json:"action" yaml:"action"` Describe string `json:"describe,omitempty" yaml:"describe"` Params KV `json:"params,omitempty" yaml:"params"` Vars []string `json:"vars,omitempty" yaml:"vars"` Conn []string `json:"conn,omitempty" yaml:"conn"` }