types

package
v0.19.4 Latest Latest
Warning

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

Go to latest
Published: Nov 30, 2024 License: GPL-3.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MessageSendEvent  = "message:send"
	InstructPushEvent = "instruct:push"
)
View Source
const (
	MountTypeVolume string = "volume"
	MountTypeBind   string = "bind"
	MountTypeTmpfs  string = "tmpfs"
)
View Source
const ApiVersion = 1

Variables

This section is empty.

Functions

func AppUrl

func AppUrl() string

func Id

func Id() string

func TypeOf

func TypeOf(payload MsgPayload) string

Types

type Action

type Action string
const (
	Pull    Action = "pull"
	Collect Action = "collect"
	Ack     Action = "ack"
	Online  Action = "online"
	Offline Action = "offline"
)

type AgentData

type AgentData struct {
	Action  Action `json:"action"`
	Version int    `json:"version"`
	Content KV     `json:"content"`
}

type ChartMsg

type ChartMsg struct {
	Title    string    `json:"title"`
	SubTitle string    `json:"sub_title"`
	XAxis    []string  `json:"x_axis"`
	Series   []float64 `json:"series"`
}

func (ChartMsg) Convert

func (t ChartMsg) Convert() any

type CollectData

type CollectData struct {
	Id      string `json:"id"`
	Content KV     `json:"content"`
}

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
	// form id
	FormId string
	// form Rule id
	FormRuleId string
	// agent
	CollectId 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) Context

func (c *Context) Context() context.Context

func (*Context) SetTimeout

func (c *Context) SetTimeout(timeout time.Duration)

type DataFilter

type DataFilter struct {
	Prefix       *string
	CreatedStart *time.Time
	CreatedEnd   *time.Time
}

type Document

type Document struct {
	Id          string `json:"id"`
	SourceId    string `json:"source_id"`
	Source      string `json:"source"`
	Title       string `json:"title"`
	Description string `json:"description"`
	Url         string `json:"url"`
	CreatedAt   int32  `json:"created_at"`
}

type EventPayload

type EventPayload struct {
	Typ string
	Src []byte
}

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

func (*FileDef) Uid

func (i *FileDef) Uid() Uid

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 FormMsg struct {
	ID    string      `json:"id"`
	Title string      `json:"title"`
	Field []FormField `json:"field"`
}

func (FormMsg) Convert

func (a FormMsg) Convert() any

type HtmlMsg

type HtmlMsg struct {
	Raw string
}

func (HtmlMsg) Convert

func (m HtmlMsg) Convert() any

type InfoMsg

type InfoMsg struct {
	Title string      `json:"title"`
	Model interface{} `json:"model,omitempty"`
}

func (InfoMsg) Convert

func (i InfoMsg) Convert() any

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() any

type JobFilter

type JobFilter struct {
	EndedAt time.Time
}

type KV

type KV map[string]interface{}

func (KV) Any

func (j KV) Any(key string) (any, bool)

func (KV) Float64

func (j KV) Float64(key string) (float64, bool)

func (KV) Float64Value

func (j KV) Float64Value() (float64, bool)

func (KV) Int64

func (j KV) Int64(key string) (int64, bool)

func (KV) Int64Value

func (j KV) Int64Value() (int64, bool)

func (KV) List

func (j KV) List(key string) ([]any, bool)

func (KV) Map

func (j KV) Map(key string) (map[string]interface{}, bool)

func (KV) Merge

func (j KV) Merge(kvs ...KV) KV

func (*KV) Scan

func (j *KV) Scan(value interface{}) error

func (KV) String

func (j KV) String(key string) (string, bool)

func (KV) StringValue

func (j KV) StringValue() (string, bool)

func (KV) Uint64

func (j KV) Uint64(key string) (uint64, bool)

func (KV) Uint64Value

func (j KV) Uint64Value() (uint64, bool)

func (KV) Value

func (j KV) Value() (driver.Value, error)

type KVMsg

type KVMsg map[string]any

func (KVMsg) Convert

func (t KVMsg) Convert() any

type LinkMsg

type LinkMsg struct {
	Title string `json:"title"`
	Cover string `json:"cover"`
	Url   string `json:"url"`
}

func (LinkMsg) Convert

func (a LinkMsg) Convert() any

type MarkdownMsg

type MarkdownMsg struct {
	Title string `json:"title"`
	Raw   string `json:"raw"`
}

func (MarkdownMsg) Convert

func (m MarkdownMsg) Convert() any

type Message

type Message struct {
	Platform string
	Topic    string
	Payload  EventPayload
}

type Mount

type Mount struct {
	Type   string `json:"type,omitempty"`
	Source string `json:"source,omitempty"`
	Target string `json:"target,omitempty"`
}

type MsgPayload

type MsgPayload interface {
	Convert() any
}

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 Registry

type Registry struct {
	Username string `json:"username,omitempty"`
	Password string `json:"password,omitempty"`
}

func (*Registry) Clone

func (r *Registry) Clone() *Registry

type TableMsg

type TableMsg struct {
	Title  string          `json:"title"`
	Header []string        `json:"header"`
	Row    [][]interface{} `json:"row"`
}

func (TableMsg) Convert

func (t TableMsg) Convert() any

type Task

type Task struct {
	ID          string            `json:"id,omitempty"`
	State       TaskState         `json:"state,omitempty"`
	CreatedAt   *time.Time        `json:"created_at,omitempty"`
	StartedAt   *time.Time        `json:"started_at,omitempty"`
	CompletedAt *time.Time        `json:"completed_at,omitempty"`
	FailedAt    *time.Time        `json:"failed_at,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

func CloneTasks(tasks []*Task) []*Task

func (*Task) Clone

func (t *Task) Clone() *Task

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 TaskRetry struct {
	Limit    int `json:"limit,omitempty"`
	Attempts int `json:"attempts,omitempty"`
}

func (*TaskRetry) Clone

func (r *TaskRetry) Clone() *TaskRetry

type TaskState

type TaskState string

TaskState State defines the list of states that a task can be in, at any given moment.

const (
	TaskStatePending   TaskState = "PENDING"
	TaskStateRunning   TaskState = "RUNNING"
	TaskStateCancelled TaskState = "CANCELED"
	TaskStateStopped   TaskState = "STOPPED"
	TaskStateCompleted TaskState = "COMPLETED"
	TaskStateFailed    TaskState = "FAILED"
)

func (TaskState) IsActive

func (s TaskState) IsActive() bool

type TextMsg

type TextMsg struct {
	Text string `json:"text"`
}

func (TextMsg) Convert

func (t TextMsg) Convert() any

type UI

type UI struct {
	Title     string
	App       app.UI
	CSS       []app.UI
	JS        []app.HTMLScript
	Global    KV
	ExpiredAt time.Time
}

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.

func (Uid) IsZero

func (uid Uid) IsZero() bool

IsZero checks if Uid is uninitialized.

func (Uid) String

func (uid Uid) String() string

stringer implements fmt.Stringer interface.

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"`
}

Directories

Path Synopsis
ruleset

Jump to

Keyboard shortcuts

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