generator

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Sep 28, 2025 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var CozeDataTypeMapping = map[string]int{
	"string":  1,
	"integer": 2,
	"boolean": 3,
	"float":   4,
	"number":  4,
	"array":   5,
	"list":    99,
}

CozeDataTypeMapping maps unified types to Coze rawMeta type numbers

Functions

func GetCozeRawMetaType

func GetCozeRawMetaType(dataType string) int

GetCozeRawMetaType returns the Coze rawMeta type number for a given data type

Types

type ClassifierNodeGenerator

type ClassifierNodeGenerator struct {
	// contains filtered or unexported fields
}

ClassifierNodeGenerator generates Coze Intent Recognition nodes from unified DSL classifier configurations.

func NewClassifierNodeGenerator

func NewClassifierNodeGenerator() *ClassifierNodeGenerator

NewClassifierNodeGenerator creates a classifier node generator for Coze platform.

func (*ClassifierNodeGenerator) GenerateNode

func (g *ClassifierNodeGenerator) GenerateNode(unifiedNode *models.Node) (*CozeNode, error)

GenerateNode generates Coze Intent Recognition node from unified classifier configuration.

func (*ClassifierNodeGenerator) GenerateSchemaNode

func (g *ClassifierNodeGenerator) GenerateSchemaNode(unifiedNode *models.Node) (*CozeSchemaNode, error)

GenerateSchemaNode generates schema node for Coze classifier workflow definition.

func (*ClassifierNodeGenerator) GetNodeType

func (g *ClassifierNodeGenerator) GetNodeType() models.NodeType

GetNodeType returns the node type for interface compatibility.

func (*ClassifierNodeGenerator) GetSupportedNodeType

func (g *ClassifierNodeGenerator) GetSupportedNodeType() models.NodeType

GetSupportedNodeType returns the supported node type.

func (*ClassifierNodeGenerator) SetIDGenerator

func (g *ClassifierNodeGenerator) SetIDGenerator(idGenerator *CozeIDGenerator)

SetIDGenerator configures the shared ID generator instance.

func (*ClassifierNodeGenerator) ValidateNode

func (g *ClassifierNodeGenerator) ValidateNode(node *models.Node) error

ValidateNode validates the classifier node configuration.

type CodeNodeGenerator

type CodeNodeGenerator struct {
	// contains filtered or unexported fields
}

CodeNodeGenerator generates Coze code nodes

func NewCodeNodeGenerator

func NewCodeNodeGenerator() *CodeNodeGenerator

NewCodeNodeGenerator creates a code node generator

func (*CodeNodeGenerator) GenerateNode

func (g *CodeNodeGenerator) GenerateNode(unifiedNode *models.Node) (*CozeNode, error)

GenerateNode generates a Coze workflow code node

func (*CodeNodeGenerator) GenerateSchemaNode

func (g *CodeNodeGenerator) GenerateSchemaNode(unifiedNode *models.Node) (*CozeSchemaNode, error)

GenerateSchemaNode generates a Coze schema code node

func (*CodeNodeGenerator) GetNodeType

func (g *CodeNodeGenerator) GetNodeType() models.NodeType

GetNodeType returns the node type this generator handles

func (*CodeNodeGenerator) SetIDGenerator

func (g *CodeNodeGenerator) SetIDGenerator(idGenerator *CozeIDGenerator)

SetIDGenerator sets the shared ID generator

func (*CodeNodeGenerator) SetIterationContext

func (g *CodeNodeGenerator) SetIterationContext(inIteration bool)

SetIterationContext sets whether this code node is inside an iteration

func (*CodeNodeGenerator) ValidateNode

func (g *CodeNodeGenerator) ValidateNode(unifiedNode *models.Node) error

ValidateNode validates the unified node before generation

type ConditionNodeGenerator

type ConditionNodeGenerator struct {
	// contains filtered or unexported fields
}

ConditionNodeGenerator generates Coze condition nodes (selectors)

func NewConditionNodeGenerator

func NewConditionNodeGenerator() *ConditionNodeGenerator

NewConditionNodeGenerator creates a condition node generator

func (*ConditionNodeGenerator) GenerateNode

func (g *ConditionNodeGenerator) GenerateNode(unifiedNode *models.Node) (*CozeNode, error)

GenerateNode generates a Coze workflow condition node

func (*ConditionNodeGenerator) GenerateSchemaBranch

func (g *ConditionNodeGenerator) GenerateSchemaBranch(caseItem models.ConditionCase, unifiedNode *models.Node) (map[string]interface{}, error)

GenerateSchemaBranch generates a schema branch for schema section (public for iteration use)

func (*ConditionNodeGenerator) GenerateSchemaNode

func (g *ConditionNodeGenerator) GenerateSchemaNode(unifiedNode *models.Node) (*CozeSchemaNode, error)

GenerateSchemaNode generates a Coze schema condition node

func (*ConditionNodeGenerator) GetNodeType

func (g *ConditionNodeGenerator) GetNodeType() models.NodeType

GetNodeType returns the node type this generator handles

func (*ConditionNodeGenerator) SetIDGenerator

func (g *ConditionNodeGenerator) SetIDGenerator(idGenerator *CozeIDGenerator)

SetIDGenerator sets the shared ID generator

func (*ConditionNodeGenerator) ValidateNode

func (g *ConditionNodeGenerator) ValidateNode(unifiedNode *models.Node) error

ValidateNode validates the unified node before generation

type CozeBlockInputParameter

type CozeBlockInputParameter struct {
	Input *CozeBlockInputValue `yaml:"input" json:"input"`
	Name  string               `yaml:"name" json:"name"`
}

CozeBlockInputParameter represents input parameter for block nodes

type CozeBlockInputRef

type CozeBlockInputRef struct {
	Content *CozeRefContent `yaml:"content,omitempty" json:"content,omitempty"`
	RawMeta *CozeRawMeta    `yaml:"rawMeta,omitempty" json:"rawMeta,omitempty"`
	Type    string          `yaml:"type" json:"type"`
	// Literal value alternative when not using reference content
	// Use a distinct field name to avoid duplicate tags with Content
	Literal interface{} `yaml:"literal,omitempty" json:"literal,omitempty"`
}

CozeBlockInputRef represents input reference for block nodes

type CozeBlockInputValue

type CozeBlockInputValue struct {
	Type    string             `yaml:"type" json:"type"`
	Value   *CozeBlockInputRef `yaml:"value" json:"value"`
	RawMeta *CozeRawMeta       `yaml:"rawMeta,omitempty" json:"rawMeta,omitempty"`
}

CozeBlockInputValue represents input value for block nodes

type CozeBlockInputs

type CozeBlockInputs struct {
	InputParameters []CozeBlockInputParameter `yaml:"inputParameters,omitempty" json:"inputParameters,omitempty"`
	LLMParam        []CozeBlockInputParameter `yaml:"llmParam,omitempty" json:"llmParam,omitempty"`
	SettingOnError  *CozeBlockSettingOnError  `yaml:"settingOnError,omitempty" json:"settingOnError,omitempty"`
}

CozeBlockInputs represents inputs for iteration block nodes

type CozeBlockNode

type CozeBlockNode struct {
	Data *CozeBlockNodeData `yaml:"data" json:"data"` // ✅ data first
	ID   string             `yaml:"id" json:"id"`     // ✅ id after data
	Meta *CozeNodeMeta      `yaml:"meta" json:"meta"` // ✅ meta after id
	Type string             `yaml:"type" json:"type"` // ✅ type last
}

CozeBlockNode represents a node inside iteration blocks with correct field ordering

type CozeBlockNodeData

type CozeBlockNodeData struct {
	Inputs   interface{}       `yaml:"inputs" json:"inputs"`     // ✅ inputs first
	NodeMeta *CozeNodeMetaInfo `yaml:"nodeMeta" json:"nodeMeta"` // ✅ nodeMeta second
	Outputs  interface{}       `yaml:"outputs" json:"outputs"`   // ✅ outputs third
	Version  string            `yaml:"version" json:"version"`   // ✅ version last (inside data)
}

CozeBlockNodeData represents data for iteration block nodes with correct structure

type CozeBlockOutput

type CozeBlockOutput struct {
	Name string `yaml:"name" json:"name"`
	Type string `yaml:"type" json:"type"`
}

CozeBlockOutput represents output for block nodes

type CozeBlockSettingOnError

type CozeBlockSettingOnError struct {
	ProcessType int `yaml:"processType" json:"processType"`
	RetryTimes  int `yaml:"retryTimes" json:"retryTimes"`
	TimeoutMs   int `yaml:"timeoutMs" json:"timeoutMs"`
}

CozeBlockSettingOnError represents error settings for block nodes

type CozeChatHistorySetting

type CozeChatHistorySetting struct {
	EnableChatHistory bool `yaml:"enableChatHistory" json:"enableChatHistory"`
	ChatHistoryRound  int  `yaml:"chatHistoryRound" json:"chatHistoryRound"`
}

CozeChatHistorySetting represents chat history settings

type CozeContextConfig

type CozeContextConfig struct {
	Enabled          bool     `yaml:"enabled" json:"enabled"`
	VariableSelector []string `yaml:"variableSelector,omitempty" json:"variableSelector,omitempty"`
}

CozeContextConfig represents context configuration

type CozeDependency

type CozeDependency struct {
	Metadata     *CozeDependencyMeta `yaml:"metadata" json:"metadata"`
	ResourceID   string              `yaml:"resource_id" json:"resource_id"`
	ResourceName string              `yaml:"resource_name" json:"resource_name"`
	ResourceType string              `yaml:"resource_type" json:"resource_type"`
}

CozeDependency represents workflow dependency

type CozeDependencyMeta

type CozeDependencyMeta struct {
	NodeType string `yaml:"node_type" json:"node_type"`
}

CozeDependencyMeta represents dependency metadata

type CozeEdge

type CozeEdge struct {
	FromNode string `yaml:"from_node" json:"from_node"`
	FromPort string `yaml:"from_port" json:"from_port"`
	ToNode   string `yaml:"to_node" json:"to_node"`
	ToPort   string `yaml:"to_port" json:"to_port"`
}

CozeEdge represents workflow edge

type CozeGenerator

type CozeGenerator struct {
	*common.BaseGenerator
	// contains filtered or unexported fields
}

CozeGenerator implements DSL generation for ByteDance Coze workflow platform

func NewCozeGenerator

func NewCozeGenerator() *CozeGenerator

NewCozeGenerator creates a Coze DSL generator

func (*CozeGenerator) Generate

func (g *CozeGenerator) Generate(unifiedDSL *models.UnifiedDSL) ([]byte, error)

Generate generates Coze DSL from unified DSL

func (*CozeGenerator) GetPlatformType

func (g *CozeGenerator) GetPlatformType() models.PlatformType

GetPlatformType returns the platform type

func (*CozeGenerator) Validate

func (g *CozeGenerator) Validate(unifiedDSL *models.UnifiedDSL) error

Validate validates the unified DSL before generation

type CozeIDGenerator

type CozeIDGenerator struct {
	// contains filtered or unexported fields
}

CozeIDGenerator handles ID generation and mapping for Coze platform

func NewCozeIDGenerator

func NewCozeIDGenerator() *CozeIDGenerator

NewCozeIDGenerator creates a Coze ID generator

func (*CozeIDGenerator) GenerateWorkflowID

func (g *CozeIDGenerator) GenerateWorkflowID() string

GenerateWorkflowID generates a workflow ID

func (*CozeIDGenerator) GetCurrentIterationNodeID

func (g *CozeIDGenerator) GetCurrentIterationNodeID() string

GetCurrentIterationNodeID gets the current iteration node ID for edge generation

func (*CozeIDGenerator) MapToCozeNodeID

func (g *CozeIDGenerator) MapToCozeNodeID(unifiedID string) string

MapToCozeNodeID dynamically maps unified node ID to Coze node ID based on node type

func (*CozeIDGenerator) MapToCozeNodeIDByType

func (g *CozeIDGenerator) MapToCozeNodeIDByType(unifiedID string, nodeType models.NodeType) string

MapToCozeNodeIDByType generates Coze ID directly based on node type (fallback method)

func (*CozeIDGenerator) SetCurrentIterationNodeID

func (g *CozeIDGenerator) SetCurrentIterationNodeID(nodeID string)

SetCurrentIterationNodeID sets the current iteration node ID for edge generation

type CozeInputParameter

type CozeInputParameter struct {
	Name  string          `yaml:"name" json:"name"`
	Input *CozeInputValue `yaml:"input" json:"input"`
}

CozeInputParameter represents input parameter for end node

type CozeInputRef

type CozeInputRef struct {
	Content *CozeRefContent `yaml:"content" json:"content"`
	RawMeta *CozeRawMeta    `yaml:"rawMeta,omitempty" json:"rawMeta,omitempty"`
	Type    string          `yaml:"type" json:"type"`
}

CozeInputRef represents input reference

type CozeInputSchema

type CozeInputSchema struct {
	Type string `yaml:"type" json:"type"` // Schema type (string, integer, etc.)
}

CozeInputSchema represents input schema definition

type CozeInputValue

type CozeInputValue struct {
	Type   string           `yaml:"type" json:"type"`                         // Maps unified data types to Coze type format
	Schema *CozeInputSchema `yaml:"schema,omitempty" json:"schema,omitempty"` // Schema definition for iteration inputs
	Value  *CozeInputRef    `yaml:"value" json:"value"`                       // Contains reference content and metadata
}

CozeInputValue represents input value with reference

type CozeIntent

type CozeIntent struct {
	Name string `yaml:"name" json:"name"`
}

CozeIntent represents intent for intent recognition node

type CozeIntentInputs

type CozeIntentInputs struct {
	InputParameters    []CozeInputParameter   `yaml:"inputParameters" json:"inputParameters"`
	ChatHistorySetting CozeChatHistorySetting `yaml:"chatHistorySetting,omitempty" json:"chatHistorySetting,omitempty"`
	Intents            []CozeIntent           `yaml:"intents,omitempty" json:"intents,omitempty"`
	LLMParam           CozeLLMParam           `yaml:"llmParam,omitempty" json:"llmParam,omitempty"`
	Mode               string                 `yaml:"mode,omitempty" json:"mode,omitempty"`
	SettingOnError     CozeSettingOnError     `yaml:"settingOnError" json:"settingOnError"`
}

CozeIntentInputs represents complete node inputs structure for intent recognition

type CozeLLMConfig

type CozeLLMConfig struct {
	Model      *CozeLLMModel      `yaml:"model" json:"model"`
	Parameters *CozeLLMParams     `yaml:"parameters" json:"parameters"`
	Prompt     *CozePromptConfig  `yaml:"prompt" json:"prompt"`
	Context    *CozeContextConfig `yaml:"context,omitempty" json:"context,omitempty"`
}

CozeLLMConfig represents LLM node configuration

type CozeLLMModel

type CozeLLMModel struct {
	ID       string `yaml:"id" json:"id"`
	Name     string `yaml:"name" json:"name"`
	Provider string `yaml:"provider" json:"provider"`
	Domain   string `yaml:"domain,omitempty" json:"domain,omitempty"`
	Service  string `yaml:"service,omitempty" json:"service,omitempty"`
}

CozeLLMModel represents LLM model configuration

type CozeLLMParam

type CozeLLMParam struct {
	ChatHistoryRound    int             `yaml:"chatHistoryRound" json:"chatHistoryRound"`
	EnableChatHistory   bool            `yaml:"enableChatHistory" json:"enableChatHistory"`
	GenerationDiversity string          `yaml:"generationDiversity" json:"generationDiversity"`
	MaxTokens           int             `yaml:"maxTokens" json:"maxTokens"`
	ModelName           string          `yaml:"modelName" json:"modelName"`
	ModelType           int             `yaml:"modelType" json:"modelType"`
	Prompt              CozePromptValue `yaml:"prompt" json:"prompt"`
	ResponseFormat      int             `yaml:"responseFormat" json:"responseFormat"`
	SystemPrompt        CozePromptValue `yaml:"systemPrompt" json:"systemPrompt"`
	Temperature         float64         `yaml:"temperature" json:"temperature"`
	TopP                float64         `yaml:"topP" json:"topP"`
}

CozeLLMParam represents LLM parameters for intent recognition

type CozeLLMParams

type CozeLLMParams struct {
	Temperature float64 `yaml:"temperature" json:"temperature"`
	MaxTokens   int     `yaml:"maxTokens" json:"maxTokens"`
	TopK        int     `yaml:"topK,omitempty" json:"topK,omitempty"`
}

CozeLLMParams represents LLM model parameters

type CozeMetadata

type CozeMetadata struct {
	ContentType string `yaml:"content_type" json:"content_type"`
	CreatorID   string `yaml:"creator_id" json:"creator_id"`
	Mode        string `yaml:"mode" json:"mode"`
	SpaceID     string `yaml:"space_id" json:"space_id"`
}

CozeMetadata represents workflow metadata

type CozeNode

type CozeNode struct {
	ID      string        `yaml:"id" json:"id"`
	Type    string        `yaml:"type" json:"type"`
	Meta    *CozeNodeMeta `yaml:"meta" json:"meta"`
	Data    *CozeNodeData `yaml:"data" json:"data"`
	Blocks  []interface{} `yaml:"blocks" json:"blocks"`
	Edges   []interface{} `yaml:"edges" json:"edges"`
	Version string        `yaml:"version" json:"version"`
	Size    interface{}   `yaml:"size" json:"size"`
}

CozeNode represents a workflow node in Coze format

type CozeNodeData

type CozeNodeData struct {
	Meta    *CozeNodeMetaInfo `yaml:"meta" json:"meta"`
	Outputs interface{}       `yaml:"outputs" json:"outputs"` // Changed to interface{} to support both []CozeNodeOutput and complex reference structures for iteration nodes
	Inputs  interface{}       `yaml:"inputs" json:"inputs"`
	Size    interface{}       `yaml:"size" json:"size"`
	// LLM node specific configuration
	LLM *CozeLLMConfig `yaml:"llm,omitempty" json:"llm,omitempty"`
}

CozeNodeData represents node data

type CozeNodeGenerator

type CozeNodeGenerator interface {
	// GenerateNode generates a Coze workflow node from unified node
	GenerateNode(unifiedNode *models.Node) (*CozeNode, error)

	// GenerateSchemaNode generates a Coze schema node from unified node
	GenerateSchemaNode(unifiedNode *models.Node) (*CozeSchemaNode, error)

	// GetNodeType returns the node type this generator handles
	GetNodeType() models.NodeType

	// ValidateNode validates the unified node before generation
	ValidateNode(unifiedNode *models.Node) error

	// SetIDGenerator sets the shared ID generator
	SetIDGenerator(idGenerator *CozeIDGenerator)
}

CozeNodeGenerator defines the interface for Coze node generators

type CozeNodeInputs

type CozeNodeInputs struct {
	InputParameters []CozeInputParameter `yaml:"inputParameters" json:"inputParameters"`
}

CozeNodeInputs represents node inputs for end node

type CozeNodeMeta

type CozeNodeMeta struct {
	CanvasPosition *CozePosition `yaml:"canvasPosition,omitempty" json:"canvasPosition,omitempty"` // FIXED: Add missing canvasPosition field
	Position       *CozePosition `yaml:"position" json:"position"`
}

CozeNodeMeta represents node metadata

type CozeNodeMetaInfo

type CozeNodeMetaInfo struct {
	Title       string `yaml:"title" json:"title"`
	Description string `yaml:"description" json:"description"`
	Icon        string `yaml:"icon" json:"icon"`
	SubTitle    string `yaml:"subTitle,omitempty" json:"subTitle,omitempty"`
	Subtitle    string `yaml:"subtitle,omitempty" json:"subtitle,omitempty"`
	MainColor   string `yaml:"maincolor,omitempty" json:"maincolor,omitempty"`
}

CozeNodeMetaInfo represents node meta information

type CozeNodeOutput

type CozeNodeOutput struct {
	Name     string            `yaml:"name" json:"name"`
	Required bool              `yaml:"required" json:"required"`
	Type     string            `yaml:"type" json:"type"`
	Schema   *CozeOutputSchema `yaml:"schema,omitempty" json:"schema,omitempty"` // Schema for array/complex types
}

CozeNodeOutput represents node output parameter

type CozeOutputSchema

type CozeOutputSchema struct {
	Type string `yaml:"type" json:"type"` // Element type for arrays
}

CozeOutputSchema represents output schema for array/complex types

type CozePosition

type CozePosition struct {
	X interface{} `yaml:"x" json:"x"`
	Y interface{} `yaml:"y" json:"y"`
}

CozePosition represents node position

type CozePromptConfig

type CozePromptConfig struct {
	SystemTemplate string               `yaml:"systemTemplate" json:"systemTemplate"`
	UserTemplate   string               `yaml:"userTemplate,omitempty" json:"userTemplate,omitempty"`
	Variables      []CozePromptVariable `yaml:"variables,omitempty" json:"variables,omitempty"`
}

CozePromptConfig represents prompt configuration

type CozePromptContent

type CozePromptContent struct {
	Content string `yaml:"content" json:"content"`
	Type    string `yaml:"type" json:"type"`
}

CozePromptContent represents prompt content structure

type CozePromptValue

type CozePromptValue struct {
	Type  string            `yaml:"type" json:"type"`
	Value CozePromptContent `yaml:"value" json:"value"`
}

CozePromptValue represents prompt value structure

type CozePromptVariable

type CozePromptVariable struct {
	Name     string `yaml:"name" json:"name"`
	Source   string `yaml:"source" json:"source"`
	NodeID   string `yaml:"nodeID" json:"nodeID"`
	OutputID string `yaml:"outputID" json:"outputID"`
}

CozePromptVariable represents prompt template variable

type CozeRawMeta

type CozeRawMeta struct {
	Type int `yaml:"type" json:"type"`
}

CozeRawMeta represents raw metadata for type mapping

type CozeRefContent

type CozeRefContent struct {
	BlockID string `yaml:"blockID" json:"blockID"`
	Name    string `yaml:"name" json:"name"`
	Source  string `yaml:"source" json:"source"`
}

CozeRefContent represents reference content

type CozeRootStructure

type CozeRootStructure struct {
	WorkflowID     string           `yaml:"workflowid" json:"workflowid"`
	Name           string           `yaml:"name" json:"name"`
	Description    string           `yaml:"description" json:"description"`
	Version        string           `yaml:"version" json:"version"`
	CreateTime     int64            `yaml:"createtime" json:"createtime"`
	UpdateTime     int64            `yaml:"updatetime" json:"updatetime"`
	Schema         *CozeSchema      `yaml:"schema" json:"schema"`
	Nodes          []CozeNode       `yaml:"nodes" json:"nodes"`
	Edges          []CozeEdge       `yaml:"edges" json:"edges"`
	Metadata       *CozeMetadata    `yaml:"metadata" json:"metadata"`
	Dependencies   []CozeDependency `yaml:"dependencies" json:"dependencies"`
	ExportFormat   string           `yaml:"exportformat" json:"exportformat"`
	SerializedData string           `yaml:"serializeddata" json:"serializeddata"`
}

CozeRootStructure represents the root structure of Coze workflow DSL

type CozeSchema

type CozeSchema struct {
	Edges    []CozeSchemaEdge `yaml:"edges" json:"edges"`
	Nodes    []CozeSchemaNode `yaml:"nodes" json:"nodes"`
	Versions *CozeVersions    `yaml:"versions" json:"versions"`
}

CozeSchema represents the schema section of Coze workflow

type CozeSchemaEdge

type CozeSchemaEdge struct {
	SourceNodeID string `yaml:"sourceNodeID" json:"sourceNodeID"`
	SourcePortID string `yaml:"sourcePortID,omitempty" json:"sourcePortID,omitempty"`
	TargetNodeID string `yaml:"targetNodeID" json:"targetNodeID"`
	TargetPortID string `yaml:"targetPortID,omitempty" json:"targetPortID,omitempty"`
}

CozeSchemaEdge represents edge in schema section

type CozeSchemaNode

type CozeSchemaNode struct {
	Data   *CozeSchemaNodeData `yaml:"data" json:"data"`
	ID     string              `yaml:"id" json:"id"`
	Meta   *CozeNodeMeta       `yaml:"meta" json:"meta"`
	Type   string              `yaml:"type" json:"type"`
	Blocks []interface{}       `yaml:"blocks,omitempty" json:"blocks,omitempty"` // Added for iteration nodes
	Edges  []interface{}       `yaml:"edges,omitempty" json:"edges,omitempty"`   // Added for iteration internal edges
}

CozeSchemaNode represents node in schema section

type CozeSchemaNodeData

type CozeSchemaNodeData struct {
	NodeMeta          *CozeNodeMetaInfo `yaml:"nodeMeta" json:"nodeMeta"`
	Outputs           interface{}       `yaml:"outputs,omitempty" json:"outputs,omitempty"` // Changed to interface{} to support complex reference structures for iteration nodes
	Inputs            interface{}       `yaml:"inputs,omitempty" json:"inputs,omitempty"`   // Supports different input types through interface
	TriggerParameters []CozeNodeOutput  `yaml:"trigger_parameters,omitempty" json:"trigger_parameters,omitempty"`
	TerminatePlan     string            `yaml:"terminatePlan,omitempty" json:"terminatePlan,omitempty"`
	Version           string            `yaml:"version,omitempty" json:"version,omitempty"` // Specifies node version for compatibility
}

CozeSchemaNodeData represents node data in schema section

type CozeSchemaNodeInputs

type CozeSchemaNodeInputs struct {
	InputParameters []CozeInputParameter     `yaml:"inputParameters,omitempty" json:"inputParameters,omitempty"`
	LLMParam        []map[string]interface{} `yaml:"llmParam,omitempty" json:"llmParam,omitempty"`
	SettingOnError  map[string]interface{}   `yaml:"settingOnError,omitempty" json:"settingOnError,omitempty"`
}

CozeSchemaNodeInputs represents comprehensive node inputs for schema section (includes LLM params)

type CozeSettingOnError

type CozeSettingOnError struct {
	ProcessType int `yaml:"processType" json:"processType"`
	RetryTimes  int `yaml:"retryTimes" json:"retryTimes"`
	TimeoutMs   int `yaml:"timeoutMs" json:"timeoutMs"`
}

CozeSettingOnError represents error handling settings

type CozeVersions

type CozeVersions struct {
	Loop string `yaml:"loop" json:"loop"`
}

CozeVersions represents version information

type EdgeGenerator

type EdgeGenerator struct {
	// contains filtered or unexported fields
}

EdgeGenerator handles Coze workflow edge generation and port mapping between platforms.

func NewEdgeGenerator

func NewEdgeGenerator() *EdgeGenerator

NewEdgeGenerator creates an edge generator with platform-specific ID mapping.

func (*EdgeGenerator) GenerateEdge

func (g *EdgeGenerator) GenerateEdge(unifiedEdge *models.Edge) *CozeEdge

GenerateEdge converts unified edge definitions to Coze edge format.

func (*EdgeGenerator) GenerateSchemaEdge

func (g *EdgeGenerator) GenerateSchemaEdge(unifiedEdge *models.Edge) *CozeSchemaEdge

GenerateSchemaEdge converts unified edge definitions to Coze schema edge format.

func (*EdgeGenerator) SetUnifiedDSL

func (g *EdgeGenerator) SetUnifiedDSL(unifiedDSL *models.UnifiedDSL)

SetUnifiedDSL configures the unified DSL reference for context-aware port mapping.

type EndNodeGenerator

type EndNodeGenerator struct {
	// contains filtered or unexported fields
}

EndNodeGenerator generates Coze end nodes

func NewEndNodeGenerator

func NewEndNodeGenerator() *EndNodeGenerator

NewEndNodeGenerator creates an end node generator

func (*EndNodeGenerator) GenerateNode

func (g *EndNodeGenerator) GenerateNode(unifiedNode *models.Node) (*CozeNode, error)

GenerateNode generates a Coze workflow end node

func (*EndNodeGenerator) GenerateSchemaNode

func (g *EndNodeGenerator) GenerateSchemaNode(unifiedNode *models.Node) (*CozeSchemaNode, error)

GenerateSchemaNode generates a Coze schema end node

func (*EndNodeGenerator) GetNodeType

func (g *EndNodeGenerator) GetNodeType() models.NodeType

GetNodeType returns the node type this generator handles

func (*EndNodeGenerator) SetIDGenerator

func (g *EndNodeGenerator) SetIDGenerator(idGenerator *CozeIDGenerator)

SetIDGenerator sets the shared ID generator

func (*EndNodeGenerator) ValidateNode

func (g *EndNodeGenerator) ValidateNode(unifiedNode *models.Node) error

ValidateNode validates the unified node before generation

type IterationNodeGenerator

type IterationNodeGenerator struct {
	// contains filtered or unexported fields
}

IterationNodeGenerator generates Coze iteration nodes

func NewIterationNodeGenerator

func NewIterationNodeGenerator() *IterationNodeGenerator

NewIterationNodeGenerator creates an iteration node generator

func (*IterationNodeGenerator) GenerateNode

func (g *IterationNodeGenerator) GenerateNode(unifiedNode *models.Node) (*CozeNode, error)

GenerateNode generates a Coze workflow iteration node

func (*IterationNodeGenerator) GenerateSchemaNode

func (g *IterationNodeGenerator) GenerateSchemaNode(unifiedNode *models.Node) (*CozeSchemaNode, error)

GenerateSchemaNode generates a Coze schema iteration node

func (*IterationNodeGenerator) GetNodeType

func (g *IterationNodeGenerator) GetNodeType() models.NodeType

GetNodeType returns the node type this generator handles

func (*IterationNodeGenerator) SetEdgeGenerator

func (g *IterationNodeGenerator) SetEdgeGenerator(edgeGenerator *EdgeGenerator)

SetEdgeGenerator sets the edge generator for generating internal edges

func (*IterationNodeGenerator) SetIDGenerator

func (g *IterationNodeGenerator) SetIDGenerator(idGenerator *CozeIDGenerator)

SetIDGenerator sets the shared ID generator

func (*IterationNodeGenerator) SetNodeFactory

func (g *IterationNodeGenerator) SetNodeFactory(factory *NodeGeneratorFactory)

SetNodeFactory sets the node factory for generating sub-nodes

func (*IterationNodeGenerator) ValidateNode

func (g *IterationNodeGenerator) ValidateNode(unifiedNode *models.Node) error

ValidateNode validates the unified node before generation

type LLMNodeGenerator

type LLMNodeGenerator struct {
	// contains filtered or unexported fields
}

LLMNodeGenerator generates Coze LLM nodes

func NewLLMNodeGenerator

func NewLLMNodeGenerator() *LLMNodeGenerator

NewLLMNodeGenerator creates an LLM node generator

func (*LLMNodeGenerator) GenerateNode

func (g *LLMNodeGenerator) GenerateNode(unifiedNode *models.Node) (*CozeNode, error)

GenerateNode generates a Coze workflow LLM node

func (*LLMNodeGenerator) GenerateSchemaNode

func (g *LLMNodeGenerator) GenerateSchemaNode(unifiedNode *models.Node) (*CozeSchemaNode, error)

GenerateSchemaNode generates schema node for LLM

func (*LLMNodeGenerator) GetNodeType

func (g *LLMNodeGenerator) GetNodeType() models.NodeType

GetNodeType returns the node type for this generator

func (*LLMNodeGenerator) SetIDGenerator

func (g *LLMNodeGenerator) SetIDGenerator(idGenerator *CozeIDGenerator)

SetIDGenerator sets the shared ID generator

func (*LLMNodeGenerator) SetIterationContext

func (g *LLMNodeGenerator) SetIterationContext(isInIteration bool)

SetIterationContext sets the iteration context for generating blocks format

func (*LLMNodeGenerator) ValidateNode

func (g *LLMNodeGenerator) ValidateNode(unifiedNode *models.Node) error

ValidateNode validates the unified node for LLM generation

type NodeGeneratorFactory

type NodeGeneratorFactory struct {
	// contains filtered or unexported fields
}

NodeGeneratorFactory creates node generators for different node types

func NewNodeGeneratorFactory

func NewNodeGeneratorFactory() *NodeGeneratorFactory

NewNodeGeneratorFactory creates a node generator factory

func (*NodeGeneratorFactory) GetNodeGenerator

func (f *NodeGeneratorFactory) GetNodeGenerator(nodeType models.NodeType) (CozeNodeGenerator, error)

GetNodeGenerator returns the appropriate node generator for the given node type

func (*NodeGeneratorFactory) GetSupportedNodeTypes

func (f *NodeGeneratorFactory) GetSupportedNodeTypes() []models.NodeType

GetSupportedNodeTypes returns list of supported node types

type StartNodeGenerator

type StartNodeGenerator struct {
	// contains filtered or unexported fields
}

StartNodeGenerator generates Coze start nodes

func NewStartNodeGenerator

func NewStartNodeGenerator() *StartNodeGenerator

NewStartNodeGenerator creates a start node generator

func (*StartNodeGenerator) GenerateNode

func (g *StartNodeGenerator) GenerateNode(unifiedNode *models.Node) (*CozeNode, error)

GenerateNode generates a Coze workflow start node

func (*StartNodeGenerator) GenerateSchemaNode

func (g *StartNodeGenerator) GenerateSchemaNode(unifiedNode *models.Node) (*CozeSchemaNode, error)

GenerateSchemaNode generates a Coze schema start node

func (*StartNodeGenerator) GetNodeType

func (g *StartNodeGenerator) GetNodeType() models.NodeType

GetNodeType returns the node type this generator handles

func (*StartNodeGenerator) SetIDGenerator

func (g *StartNodeGenerator) SetIDGenerator(idGenerator *CozeIDGenerator)

SetIDGenerator sets the shared ID generator

func (*StartNodeGenerator) ValidateNode

func (g *StartNodeGenerator) ValidateNode(unifiedNode *models.Node) error

ValidateNode validates the unified node before generation

Jump to

Keyboard shortcuts

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