workflow

package
v0.10.0 Latest Latest
Warning

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

Go to latest
Published: Jun 16, 2025 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Edge

type Edge struct {
	ID          string `json:"id"` // 线段id
	Name        string `json:"name,omitempty"`
	Source      string `json:"source"`
	Target      string `json:"target"`
	ExpressName string `json:"expr_name,omitempty"`
	Express     string `json:"expr_content,omitempty"`
}

Edge TODO

type Event

type Event struct {
	Name string `json:"name"` // 事件名称
	Data any    `json:"data"` // 事件值
	Type string `json:"type"` // 事件类型
}

Event ...

type Executor

type Executor interface {
}

Executor ...

type Node

type Node struct {
	ID          string   `json:"id"`          // 节点ID
	Name        string   `json:"name"`        // 节点名称 support expr @TODO
	Description string   `json:"description"` // 节点描述
	Kind        NodeKind `json:"kind"`        // 节点类型
	Subref      string   `json:"subref"`      // reference to function or subprocess (gateway)
	// set of expressions to evaluate, test or pass to function
	Inputs  Parameters `json:"inputs"`
	Outputs Parameters `json:"outputs"`

	// Events    []Event   `json:"events2"` // 边界事件
	// Callbacks []*Action `json:"events"`  // 普通事件
	// for business configure
	// its free now, need tobe constraint in the future
	Metadata map[string]any `json:"metadata"`
}

Node ...

type NodeID

type NodeID struct {
	ID string
}

type NodeKind

type NodeKind string

NodeKind TODO

const (
	// NodeKindTool TODO
	NodeKindTool NodeKind = "tool" // ref = <tool ref>
	// NodeKindExpr TODO
	NodeKindExpr NodeKind = "expr" // ref = <expr>
	// NodeKindLLM TODO
	NodeKindLLM NodeKind = "llm" // ref = <llm ref>
	// NodeKindGateway TODO
	NodeKindGateway NodeKind = "gateway" // ref = join|fork|excl|incl
	// NodeKindIterator TODO
	NodeKindIterator NodeKind = "iterator" // ref = <iterator function ref>
	// NodeKindError TODO
	NodeKindError NodeKind = "error" // no ref
	// NodeKindTermination TODO
	NodeKindTermination NodeKind = "termination" // no ref
	// NodeKindPrompt TODO
	NodeKindPrompt NodeKind = "prompt" // ref = <client function>
	// NodeKindDelay TODO
	NodeKindDelay NodeKind = "delay" // no ref
	// NodeKindWait TODO
	NodeKindWait NodeKind = "wait" // no ref
	// NodeKindVisual TODO
	NodeKindVisual NodeKind = "visual" // ref = <*>
	// NodeKindDebug TODO
	NodeKindDebug NodeKind = "debug" // ref = <*>
	// NodeKindBreak TODO
	NodeKindBreak NodeKind = "break" // ref = <*>
	// NodeKindContinue TODO
	NodeKindContinue NodeKind = "continue" // ref = <*>
	// NodeKindStart TODO
	NodeKindStart NodeKind = "start" // start event
	// NodeKindEnd TODO
	NodeKindEnd NodeKind = "end" // end event
	// NodeKindHuman TODO
	NodeKindHuman NodeKind = "human" // user involved in node
)

type Nodes

type Nodes []Node

Nodes ...

type Parameter

type Parameter struct {
	Name  string `json:"name"`  // 参数名称
	Value string `json:"value"` // 参数值
	Type  string `json:"type"`  // 参数类型
}

Parameter ...

type Parameters

type Parameters map[string]Parameter

Parameters ...

type Result

type Result struct {
	Outputs map[string]any
}

Result ...

type Workflow

type Workflow struct {
	ID          int64
	Name        string
	Description string
	Key         string
	Version     int64
	Nodes       []Node
	Edges       []Edge
}

Workflow ...

func NewWorkflow

func NewWorkflow(id int64, name string) *Workflow

NewWorkflow 初始化workflow

func (*Workflow) AddNode

func (w *Workflow) AddNode(nodes ...Node) *Workflow

AddNode 添加节点

func (w *Workflow) Link(nodes ...Node) *Workflow

Link 链接节点

func (*Workflow) LinkWithCondition

func (w *Workflow) LinkWithCondition(node1, expr string, node2 any, nodes ...Node) *Workflow

Link 链接节点

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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