Documentation
¶
Index ¶
- type InMemoryInterruptStore
- func (s *InMemoryInterruptStore) List(ctx context.Context, workflowID string, status InterruptStatus) ([]*Interrupt, error)
- func (s *InMemoryInterruptStore) Load(ctx context.Context, interruptID string) (*Interrupt, error)
- func (s *InMemoryInterruptStore) Save(ctx context.Context, interrupt *Interrupt) error
- func (s *InMemoryInterruptStore) Update(ctx context.Context, interrupt *Interrupt) error
- type Interrupt
- type InterruptHandler
- type InterruptManager
- func (m *InterruptManager) CancelInterrupt(ctx context.Context, interruptID string) error
- func (m *InterruptManager) CreateInterrupt(ctx context.Context, opts InterruptOptions) (*Response, error)
- func (m *InterruptManager) GetPendingInterrupts(workflowID string) []*Interrupt
- func (m *InterruptManager) RegisterHandler(interruptType InterruptType, handler InterruptHandler)
- func (m *InterruptManager) ResolveInterrupt(ctx context.Context, interruptID string, response *Response) error
- type InterruptOptions
- type InterruptStatus
- type InterruptStore
- type InterruptType
- type Option
- type Response
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type InMemoryInterruptStore ¶
type InMemoryInterruptStore struct {
// contains filtered or unexported fields
}
在MemoryInterruptStore中为中断提供内存.
func NewInMemoryInterruptStore ¶
func NewInMemoryInterruptStore() *InMemoryInterruptStore
New InMemory InterruptStore 创建了新的内存中断商店.
func (*InMemoryInterruptStore) List ¶
func (s *InMemoryInterruptStore) List(ctx context.Context, workflowID string, status InterruptStatus) ([]*Interrupt, error)
type Interrupt ¶
type Interrupt struct {
ID string `json:"id"`
WorkflowID string `json:"workflow_id"`
NodeID string `json:"node_id"`
Type InterruptType `json:"type"`
Status InterruptStatus `json:"status"`
Title string `json:"title"`
Description string `json:"description"`
Data any `json:"data,omitempty"`
Options []Option `json:"options,omitempty"`
InputSchema json.RawMessage `json:"input_schema,omitempty"`
Response *Response `json:"response,omitempty"`
CreatedAt time.Time `json:"created_at"`
ResolvedAt *time.Time `json:"resolved_at,omitempty"`
Timeout time.Duration `json:"timeout"`
CheckpointID string `json:"checkpoint_id,omitempty"`
Metadata map[string]any `json:"metadata,omitempty"`
}
中断代表工作流程中断点.
type InterruptHandler ¶
中断汉德勒处理中断事件.
type InterruptManager ¶
type InterruptManager struct {
// contains filtered or unexported fields
}
中断管理者管理工作流程中断 。
func NewInterruptManager ¶
func NewInterruptManager(store InterruptStore, logger *zap.Logger) *InterruptManager
新干扰管理器创建了新的中断管理器 。
func (*InterruptManager) CancelInterrupt ¶
func (m *InterruptManager) CancelInterrupt(ctx context.Context, interruptID string) error
取消中断取消待决中断 。
func (*InterruptManager) CreateInterrupt ¶
func (m *InterruptManager) CreateInterrupt(ctx context.Context, opts InterruptOptions) (*Response, error)
创建中断创建并等待中断解决 。
func (*InterruptManager) GetPendingInterrupts ¶
func (m *InterruptManager) GetPendingInterrupts(workflowID string) []*Interrupt
获得待定 中断返回工作流程中所有待处理中断 。
func (*InterruptManager) RegisterHandler ¶
func (m *InterruptManager) RegisterHandler(interruptType InterruptType, handler InterruptHandler)
登记 Handler 为中断类型登记处理器 。
func (*InterruptManager) ResolveInterrupt ¶
func (m *InterruptManager) ResolveInterrupt(ctx context.Context, interruptID string, response *Response) error
解析中断解决待决中断 。
type InterruptOptions ¶
type InterruptOptions struct {
WorkflowID string
NodeID string
Type InterruptType
Title string
Description string
Data any
Options []Option
InputSchema json.RawMessage
Timeout time.Duration
CheckpointID string
Metadata map[string]any
}
中断选项配置中断创建 。
type InterruptStatus ¶
type InterruptStatus string
中断状态代表中断状态.
const ( InterruptStatusPending InterruptStatus = "pending" InterruptStatusResolved InterruptStatus = "resolved" InterruptStatusRejected InterruptStatus = "rejected" InterruptStatusTimeout InterruptStatus = "timeout" InterruptStatusCanceled InterruptStatus = "canceled" )
type InterruptStore ¶
type InterruptStore interface {
Save(ctx context.Context, interrupt *Interrupt) error
Load(ctx context.Context, interruptID string) (*Interrupt, error)
List(ctx context.Context, workflowID string, status InterruptStatus) ([]*Interrupt, error)
Update(ctx context.Context, interrupt *Interrupt) error
}
InterruptStore定义了中断的存储接口.
type InterruptType ¶
type InterruptType string
中断Type定义了工作流程中断的类型.
const ( InterruptTypeApproval InterruptType = "approval" InterruptTypeInput InterruptType = "input" InterruptTypeReview InterruptType = "review" InterruptTypeBreakpoint InterruptType = "breakpoint" InterruptTypeError InterruptType = "error" )
type Option ¶
type Option struct {
ID string `json:"id"`
Label string `json:"label"`
Description string `json:"description,omitempty"`
IsDefault bool `json:"is_default,omitempty"`
}
备选办法是可选择的核准中断的备选办法。
type Response ¶
type Response struct {
OptionID string `json:"option_id,omitempty"`
Input any `json:"input,omitempty"`
Comment string `json:"comment,omitempty"`
Approved bool `json:"approved"`
Timestamp time.Time `json:"timestamp"`
UserID string `json:"user_id,omitempty"`
Metadata map[string]any `json:"metadata,omitempty"`
}
反应代表了人类对中断的反应。
Click to show internal directories.
Click to hide internal directories.