Documentation
¶
Overview ¶
Package models provides core data type definitions and mapping utilities.
Package models contains error types for the AI Agents Transformer.
Index ¶
- Variables
- func ConvertVariableReferenceAdvanced(ref *VariableReference, platform PlatformType) string
- func GetDifyValueType(unifiedType UnifiedDataType) string
- func GetIFlytekSchemaType(unifiedType UnifiedDataType) string
- func GetNodeTypeMapping() map[PlatformType]map[NodeType]string
- func GetReverseNodeTypeMapping() map[PlatformType]map[string]NodeType
- func GetTypeCategory(dataType UnifiedDataType) string
- func IsArrayType(dataType UnifiedDataType) bool
- func IsNumericType(dataType UnifiedDataType) bool
- func IsObjectType(dataType UnifiedDataType) bool
- func IsPrimitiveType(dataType UnifiedDataType) bool
- func IsStringType(dataType UnifiedDataType) bool
- func IsValidNodeType(nodeType NodeType) bool
- func IsValidPlatformType(platform PlatformType) bool
- func ValidateTypeCompatibility(sourceType, targetType UnifiedDataType) bool
- type ClassifierClass
- type ClassifierConfig
- type CodeConfig
- type Condition
- type ConditionCase
- type ConditionConfig
- type Constraints
- type ContextConfig
- type ConversionError
- type CozeMetadata
- type DataTypeMapping
- func (dtm *DataTypeMapping) ConvertValue(value interface{}, fromType, toType UnifiedDataType) (interface{}, error)
- func (dtm *DataTypeMapping) FromDifyType(difyType string) UnifiedDataType
- func (dtm *DataTypeMapping) FromIFlytekType(iflytekType string) UnifiedDataType
- func (dtm *DataTypeMapping) MapToDifyTypeWithAliases(inputType string) string
- func (dtm *DataTypeMapping) ToCozeType(unifiedType UnifiedDataType) string
- func (dtm *DataTypeMapping) ToDifyType(unifiedType UnifiedDataType) string
- func (dtm *DataTypeMapping) ToIFlytekType(unifiedType UnifiedDataType) string
- type DataTypeValidator
- type DifyMetadata
- type Edge
- type EdgeType
- type EndConfig
- type EndOutput
- type ErrorSeverity
- type ExecutionConfig
- type Features
- type FileUploadConfig
- type IFlytekMetadata
- type Input
- type IterationConfig
- type IteratorConfig
- type LLMConfig
- type Location
- type MemoryConfig
- type Message
- type Metadata
- type ModelConfig
- type ModelParameters
- type Node
- type NodeConfig
- type NodeType
- type Output
- type OutputSelectorConfig
- type ParseError
- type PlatformConfig
- type PlatformMetadata
- type PlatformType
- type Position
- type PromptConfig
- type ReferenceType
- type Size
- type SpeechConfig
- type StartConfig
- type SubWorkflowConfig
- type UIConfig
- type UnifiedDSL
- func (dsl *UnifiedDSL) AddEdge(edge Edge)
- func (dsl *UnifiedDSL) AddNode(node Node)
- func (dsl *UnifiedDSL) GetEdgesBySource(sourceID string) []Edge
- func (dsl *UnifiedDSL) GetEdgesByTarget(targetID string) []Edge
- func (dsl *UnifiedDSL) GetNodeByID(id string) *Node
- func (dsl *UnifiedDSL) UpdateTimestamp()
- type UnifiedDataType
- type ValidationError
- type Variable
- type VariableReference
- type VariableReferenceSystem
- func (vrs *VariableReferenceSystem) DeserializeReference(data []byte) (*VariableReference, error)
- func (vrs *VariableReferenceSystem) ExtractReferencesFromDifyNode(nodeData map[string]interface{}) ([]*VariableReference, error)
- func (vrs *VariableReferenceSystem) ExtractReferencesFromIFlytekNode(nodeData map[string]interface{}) ([]*VariableReference, error)
- func (vrs *VariableReferenceSystem) ParseDifyReference(valueSelector []string, valueType string) (*VariableReference, error)
- func (vrs *VariableReferenceSystem) ParseIFlytekReference(refData map[string]interface{}) (*VariableReference, error)
- func (vrs *VariableReferenceSystem) ParseTemplateReference(template string) ([]*VariableReference, error)
- func (vrs *VariableReferenceSystem) RegisterOutputMapping(nodeID, oldOutputName, newOutputName string)
- func (vrs *VariableReferenceSystem) ReplaceTemplateReferences(template string, fromPlatform, toPlatform PlatformType) (string, error)
- func (vrs *VariableReferenceSystem) ResolveOutputName(nodeID, outputName string) string
- func (vrs *VariableReferenceSystem) SerializeReference(ref *VariableReference) ([]byte, error)
- func (vrs *VariableReferenceSystem) ToDifyReference(ref *VariableReference) ([]string, string, error)
- func (vrs *VariableReferenceSystem) ToDifyTemplate(ref *VariableReference) (string, error)
- func (vrs *VariableReferenceSystem) ToIFlytekReference(ref *VariableReference) (map[string]interface{}, error)
- func (vrs *VariableReferenceSystem) ToIFlytekTemplate(ref *VariableReference) (string, error)
- func (vrs *VariableReferenceSystem) ToUnifiedTemplate(ref *VariableReference) (string, error)
- func (vrs *VariableReferenceSystem) ValidateReference(ref *VariableReference, dsl *UnifiedDSL) error
- type VisionConfig
- type Workflow
Constants ¶
This section is empty.
Variables ¶
var DifyInputTypeMapping = map[string]UnifiedDataType{ "text-input": DataTypeString, "number": DataTypeNumber, "boolean": DataTypeBoolean, "select": DataTypeString, "textarea": DataTypeString, }
var IFlytekCustomParameterTypeMapping = map[string]UnifiedDataType{ "xfyun-file": DataTypeString, }
Functions ¶
func ConvertVariableReferenceAdvanced ¶
func ConvertVariableReferenceAdvanced(ref *VariableReference, platform PlatformType) string
ConvertVariableReferenceAdvanced performs advanced variable reference format conversion
func GetDifyValueType ¶
func GetDifyValueType(unifiedType UnifiedDataType) string
GetDifyValueType returns Dify value_type for unified type.
func GetIFlytekSchemaType ¶
func GetIFlytekSchemaType(unifiedType UnifiedDataType) string
GetIFlytekSchemaType returns iFlytek schema type for unified type.
func GetNodeTypeMapping ¶
func GetNodeTypeMapping() map[PlatformType]map[NodeType]string
GetNodeTypeMapping returns node type mapping
func GetReverseNodeTypeMapping ¶
func GetReverseNodeTypeMapping() map[PlatformType]map[string]NodeType
GetReverseNodeTypeMapping returns reverse node type mapping
func GetTypeCategory ¶
func GetTypeCategory(dataType UnifiedDataType) string
GetTypeCategory returns the general category of a data type.
func IsArrayType ¶
func IsArrayType(dataType UnifiedDataType) bool
func IsNumericType ¶
func IsNumericType(dataType UnifiedDataType) bool
func IsObjectType ¶
func IsObjectType(dataType UnifiedDataType) bool
func IsPrimitiveType ¶
func IsPrimitiveType(dataType UnifiedDataType) bool
func IsStringType ¶
func IsStringType(dataType UnifiedDataType) bool
func IsValidNodeType ¶
IsValidNodeType checks if the node type is valid
func IsValidPlatformType ¶
func IsValidPlatformType(platform PlatformType) bool
IsValidPlatformType checks if the platform type is valid
func ValidateTypeCompatibility ¶
func ValidateTypeCompatibility(sourceType, targetType UnifiedDataType) bool
ValidateTypeCompatibility checks if two types are compatible for conversion.
Types ¶
type ClassifierClass ¶
type ClassifierClass struct {
ID string `yaml:"id" json:"id"`
Name string `yaml:"name" json:"name"`
Description string `yaml:"description,omitempty" json:"description,omitempty"`
IsDefault bool `yaml:"is_default,omitempty" json:"is_default,omitempty"` // Indicates if this is the default intent
}
ClassifierClass represents classification category
type ClassifierConfig ¶
type ClassifierConfig struct {
Model ModelConfig `yaml:"model" json:"model"`
Parameters ModelParameters `yaml:"parameters" json:"parameters"` // Use unified model parameter structure
Classes []ClassifierClass `yaml:"classes" json:"classes"`
QueryVariable string `yaml:"query_variable" json:"query_variable"`
Instructions string `yaml:"instructions,omitempty" json:"instructions,omitempty"`
IsInIteration bool `yaml:"is_in_iteration,omitempty" json:"is_in_iteration,omitempty"`
IterationID string `yaml:"iteration_id,omitempty" json:"iteration_id,omitempty"`
}
ClassifierConfig defines classifier decision node configuration
func (ClassifierConfig) GetNodeType ¶
func (c ClassifierConfig) GetNodeType() NodeType
type CodeConfig ¶
type CodeConfig struct {
Language string `yaml:"language" json:"language"` // python3/javascript
Code string `yaml:"code" json:"code"`
Dependencies []string `yaml:"dependencies,omitempty" json:"dependencies,omitempty"`
IsInIteration bool `yaml:"is_in_iteration,omitempty" json:"is_in_iteration,omitempty"`
IterationID string `yaml:"iteration_id,omitempty" json:"iteration_id,omitempty"`
}
CodeConfig defines code node configuration
func (CodeConfig) GetNodeType ¶
func (c CodeConfig) GetNodeType() NodeType
type Condition ¶
type Condition struct {
VariableSelector []string `yaml:"variable_selector" json:"variable_selector"`
ComparisonOperator string `yaml:"comparison_operator" json:"comparison_operator"`
Value interface{} `yaml:"value" json:"value"`
VarType UnifiedDataType `yaml:"var_type" json:"var_type"`
}
Condition defines condition specification
type ConditionCase ¶
type ConditionCase struct {
CaseID string `yaml:"case_id" json:"case_id"`
Conditions []Condition `yaml:"conditions" json:"conditions"`
LogicalOperator string `yaml:"logical_operator" json:"logical_operator"` // and/or
Level int `yaml:"level,omitempty" json:"level,omitempty"` // Branch level, 999 for default branch
}
ConditionCase represents condition branch
type ConditionConfig ¶
type ConditionConfig struct {
Cases []ConditionCase `yaml:"cases" json:"cases"`
DefaultCase string `yaml:"default_case,omitempty" json:"default_case,omitempty"`
IsInIteration bool `yaml:"is_in_iteration,omitempty" json:"is_in_iteration,omitempty"`
IterationID string `yaml:"iteration_id,omitempty" json:"iteration_id,omitempty"`
}
ConditionConfig defines condition branch node configuration
func (ConditionConfig) GetNodeType ¶
func (c ConditionConfig) GetNodeType() NodeType
type Constraints ¶
type Constraints struct {
MaxLength int `yaml:"max_length,omitempty" json:"max_length,omitempty"`
MinLength int `yaml:"min_length,omitempty" json:"min_length,omitempty"`
Options []interface{} `yaml:"options,omitempty" json:"options,omitempty"`
Pattern string `yaml:"pattern,omitempty" json:"pattern,omitempty"`
}
Constraints defines variable constraints
type ContextConfig ¶
type ContextConfig struct {
Enabled bool `yaml:"enabled" json:"enabled"`
VariableSelector []string `yaml:"variable_selector,omitempty" json:"variable_selector,omitempty"`
}
ContextConfig defines context configuration
type ConversionError ¶
type ConversionError struct {
// Core error information
Code string `json:"code"`
Message string `json:"message"`
SourceLocation *Location `json:"source_location,omitempty"`
Suggestions []string `json:"suggestions,omitempty"`
Severity ErrorSeverity `json:"severity,omitempty"`
// Platform-specific information (preserved for compatibility)
SourcePlatform string `json:"source_platform"`
TargetPlatform string `json:"target_platform"`
ErrorType string `json:"error_type"`
Details string `json:"details"`
FallbackStrategy string `json:"fallback_strategy,omitempty"`
}
ConversionError represents a conversion error between platforms.
func (*ConversionError) Error ¶
func (e *ConversionError) Error() string
type CozeMetadata ¶
type CozeMetadata struct {
WorkflowID string `yaml:"workflow_id" json:"workflow_id"`
Version string `yaml:"version" json:"version"`
CreateTime int64 `yaml:"create_time" json:"create_time"`
UpdateTime int64 `yaml:"update_time" json:"update_time"`
ContentType string `yaml:"content_type" json:"content_type"`
CreatorID string `yaml:"creator_id" json:"creator_id"`
SpaceID string `yaml:"space_id" json:"space_id"`
Mode string `yaml:"mode" json:"mode"`
ExportFormat string `yaml:"export_format" json:"export_format"`
}
CozeMetadata contains Coze platform specific metadata
type DataTypeMapping ¶
type DataTypeMapping struct {
UnifiedTypes []UnifiedDataType `yaml:"unified_types" json:"unified_types"`
IFlytekMapping map[UnifiedDataType]string `yaml:"iflytek_mapping" json:"iflytek_mapping"`
DifyMapping map[UnifiedDataType]string `yaml:"dify_mapping" json:"dify_mapping"`
CozeMapping map[UnifiedDataType]string `yaml:"coze_mapping" json:"coze_mapping"`
// Alias mappings for backward compatibility and alternative type names
IFlytekAliases map[string]string `yaml:"iflytek_aliases" json:"iflytek_aliases"`
DifyAliases map[string]string `yaml:"dify_aliases" json:"dify_aliases"`
}
DataTypeMapping defines cross-platform type mapping and alias resolution.
func GetDefaultDataTypeMapping ¶
func GetDefaultDataTypeMapping() *DataTypeMapping
GetDefaultDataTypeMapping returns the standard cross-platform type mapping configuration.
func (*DataTypeMapping) ConvertValue ¶
func (dtm *DataTypeMapping) ConvertValue(value interface{}, fromType, toType UnifiedDataType) (interface{}, error)
ConvertValue performs type conversion between unified data types.
func (*DataTypeMapping) FromDifyType ¶
func (dtm *DataTypeMapping) FromDifyType(difyType string) UnifiedDataType
FromDifyType converts Dify platform type to unified type with alias resolution.
func (*DataTypeMapping) FromIFlytekType ¶
func (dtm *DataTypeMapping) FromIFlytekType(iflytekType string) UnifiedDataType
FromIFlytekType converts iFlytek platform type to unified type with precise type recognition.
func (*DataTypeMapping) MapToDifyTypeWithAliases ¶
func (dtm *DataTypeMapping) MapToDifyTypeWithAliases(inputType string) string
MapToDifyTypeWithAliases maps any input type to Dify format with comprehensive alias support. Attempts multiple resolution strategies before defaulting to string type.
func (*DataTypeMapping) ToCozeType ¶
func (dtm *DataTypeMapping) ToCozeType(unifiedType UnifiedDataType) string
ToCozeType converts unified type to Coze platform-specific type.
func (*DataTypeMapping) ToDifyType ¶
func (dtm *DataTypeMapping) ToDifyType(unifiedType UnifiedDataType) string
ToDifyType converts unified type to Dify platform-specific type.
func (*DataTypeMapping) ToIFlytekType ¶
func (dtm *DataTypeMapping) ToIFlytekType(unifiedType UnifiedDataType) string
ToIFlytekType converts unified type to iFlytek platform-specific type.
type DataTypeValidator ¶
type DataTypeValidator struct {
// contains filtered or unexported fields
}
DataTypeValidator provides validation utilities for data types.
func NewDataTypeValidator ¶
func NewDataTypeValidator() *DataTypeValidator
NewDataTypeValidator creates a validator with default mapping configuration.
func (*DataTypeValidator) ValidateDifyType ¶
func (v *DataTypeValidator) ValidateDifyType(difyType string) bool
ValidateDifyType checks if the Dify data type is supported.
func (*DataTypeValidator) ValidateIFlytekType ¶
func (v *DataTypeValidator) ValidateIFlytekType(iflytekType string) bool
ValidateIFlytekType checks if the iFlytek data type is supported.
func (*DataTypeValidator) ValidateType ¶
func (v *DataTypeValidator) ValidateType(dataType UnifiedDataType) bool
ValidateType checks if the unified data type is supported.
type DifyMetadata ¶
type DifyMetadata struct {
Icon string `yaml:"icon" json:"icon"`
IconBackground string `yaml:"icon_background" json:"icon_background"`
Mode string `yaml:"mode" json:"mode"`
UseIconAsAnswerIcon bool `yaml:"use_icon_as_answer_icon" json:"use_icon_as_answer_icon"`
Kind string `yaml:"kind" json:"kind"`
AppVersion string `yaml:"app_version" json:"app_version"`
}
DifyMetadata contains Dify platform specific metadata
type Edge ¶
type Edge struct {
ID string `yaml:"id" json:"id"`
Source string `yaml:"source" json:"source"`
Target string `yaml:"target" json:"target"`
SourceHandle string `yaml:"source_handle,omitempty" json:"source_handle,omitempty"`
TargetHandle string `yaml:"target_handle,omitempty" json:"target_handle,omitempty"`
Type EdgeType `yaml:"type" json:"type"`
Condition string `yaml:"condition,omitempty" json:"condition,omitempty"`
PlatformConfig PlatformConfig `yaml:"platform_config" json:"platform_config"`
}
Edge represents connection relationship
type EndConfig ¶
type EndConfig struct {
OutputMode string `yaml:"output_mode" json:"output_mode"` // template/variables
Template string `yaml:"template,omitempty" json:"template,omitempty"`
StreamOutput bool `yaml:"stream_output" json:"stream_output"`
Outputs []EndOutput `yaml:"outputs,omitempty" json:"outputs,omitempty"`
}
EndConfig defines end node configuration
func (EndConfig) GetNodeType ¶
type EndOutput ¶
type EndOutput struct {
Variable string `yaml:"variable" json:"variable"`
ValueSelector []string `yaml:"value_selector" json:"value_selector"`
ValueType UnifiedDataType `yaml:"value_type" json:"value_type"`
Reference *VariableReference `yaml:"reference,omitempty" json:"reference,omitempty"`
}
EndOutput defines end node output configuration
type ErrorSeverity ¶
type ErrorSeverity string
ErrorSeverity represents the severity level of an error.
const ( // SeverityCritical indicates a critical error that prevents operation SeverityCritical ErrorSeverity = "critical" // SeverityError indicates a regular error SeverityError ErrorSeverity = "error" // SeverityWarning indicates a warning that doesn't prevent operation SeverityWarning ErrorSeverity = "warning" // SeverityInfo indicates informational message SeverityInfo ErrorSeverity = "info" )
type ExecutionConfig ¶
type ExecutionConfig struct {
IsParallel bool `yaml:"is_parallel" json:"is_parallel"`
ParallelNums int `yaml:"parallel_nums" json:"parallel_nums"`
ErrorHandleMode string `yaml:"error_handle_mode" json:"error_handle_mode"`
}
ExecutionConfig defines execution configuration
type Features ¶
type Features struct {
FileUpload *FileUploadConfig `yaml:"file_upload,omitempty" json:"file_upload,omitempty"`
OpeningStatement string `yaml:"opening_statement,omitempty" json:"opening_statement,omitempty"`
SuggestedQuestions []string `yaml:"suggested_questions,omitempty" json:"suggested_questions,omitempty"`
SpeechToText *SpeechConfig `yaml:"speech_to_text,omitempty" json:"speech_to_text,omitempty"`
TextToSpeech *SpeechConfig `yaml:"text_to_speech,omitempty" json:"text_to_speech,omitempty"`
}
Features contains feature configuration
type FileUploadConfig ¶
type FileUploadConfig struct {
Enabled bool `yaml:"enabled" json:"enabled"`
AllowedFileTypes []string `yaml:"allowed_file_types" json:"allowed_file_types"`
AllowedFileExtensions []string `yaml:"allowed_file_extensions" json:"allowed_file_extensions"`
AllowedUploadMethods []string `yaml:"allowed_upload_methods" json:"allowed_upload_methods"`
FileSizeLimit int `yaml:"file_size_limit" json:"file_size_limit"`
ImageFileSizeLimit int `yaml:"image_file_size_limit" json:"image_file_size_limit"`
AudioFileSizeLimit int `yaml:"audio_file_size_limit" json:"audio_file_size_limit"`
VideoFileSizeLimit int `yaml:"video_file_size_limit" json:"video_file_size_limit"`
WorkflowFileUploadLimit int `yaml:"workflow_file_upload_limit" json:"workflow_file_upload_limit"`
BatchCountLimit int `yaml:"batch_count_limit" json:"batch_count_limit"`
NumberLimits int `yaml:"number_limits" json:"number_limits"`
}
FileUploadConfig contains file upload configuration
type IFlytekMetadata ¶
type IFlytekMetadata struct {
AvatarIcon string `yaml:"avatar_icon" json:"avatar_icon"`
AvatarColor string `yaml:"avatar_color" json:"avatar_color"`
AdvancedConfig string `yaml:"advanced_config" json:"advanced_config"`
DSLVersion string `yaml:"dsl_version" json:"dsl_version"`
}
IFlytekMetadata contains iFlytek platform specific metadata
type Input ¶
type Input struct {
Name string `yaml:"name" json:"name"`
Label string `yaml:"label,omitempty" json:"label,omitempty"`
Type UnifiedDataType `yaml:"type" json:"type"`
Required bool `yaml:"required" json:"required"`
Default interface{} `yaml:"default,omitempty" json:"default,omitempty"`
Description string `yaml:"description,omitempty" json:"description,omitempty"`
Reference *VariableReference `yaml:"reference,omitempty" json:"reference,omitempty"`
Constraints *Constraints `yaml:"constraints,omitempty" json:"constraints,omitempty"`
}
Input defines node input specification
type IterationConfig ¶
type IterationConfig struct {
Iterator IteratorConfig `yaml:"iterator" json:"iterator"`
Execution ExecutionConfig `yaml:"execution" json:"execution"`
SubWorkflow SubWorkflowConfig `yaml:"sub_workflow" json:"sub_workflow"`
OutputSelector OutputSelectorConfig `yaml:"output_selector" json:"output_selector"`
OutputType string `yaml:"output_type" json:"output_type"`
}
IterationConfig defines iteration node configuration
func (IterationConfig) GetNodeType ¶
func (c IterationConfig) GetNodeType() NodeType
type IteratorConfig ¶
type IteratorConfig struct {
InputType string `yaml:"input_type" json:"input_type"`
SourceNode string `yaml:"source_node" json:"source_node"`
SourceOutput string `yaml:"source_output" json:"source_output"`
}
IteratorConfig defines iterator configuration
type LLMConfig ¶
type LLMConfig struct {
Model ModelConfig `yaml:"model" json:"model"`
Parameters ModelParameters `yaml:"parameters" json:"parameters"`
Prompt PromptConfig `yaml:"prompt" json:"prompt"`
Context *ContextConfig `yaml:"context,omitempty" json:"context,omitempty"`
Vision *VisionConfig `yaml:"vision,omitempty" json:"vision,omitempty"`
IsInIteration bool `yaml:"is_in_iteration,omitempty" json:"is_in_iteration,omitempty"`
IterationID string `yaml:"iteration_id,omitempty" json:"iteration_id,omitempty"`
}
LLMConfig defines large language model node configuration
func (LLMConfig) GetNodeType ¶
type Location ¶
type Location struct {
NodeID string `json:"node_id,omitempty"`
Field string `json:"field,omitempty"`
Line int `json:"line,omitempty"`
}
Location represents error location information.
type MemoryConfig ¶
type MemoryConfig struct {
Enabled bool `yaml:"enabled" json:"enabled"`
Window int `yaml:"window,omitempty" json:"window,omitempty"` // Memory window size
}
MemoryConfig defines memory configuration
type Message ¶
type Message struct {
Role string `yaml:"role" json:"role"`
Content string `yaml:"content" json:"content"`
}
Message represents message structure
type Metadata ¶
type Metadata struct {
Name string `yaml:"name" json:"name"`
Description string `yaml:"description" json:"description"`
CreatedAt time.Time `yaml:"created_at" json:"created_at"`
UpdatedAt time.Time `yaml:"updated_at" json:"updated_at"`
UIConfig *UIConfig `yaml:"ui_config,omitempty" json:"ui_config,omitempty"`
}
Metadata contains common metadata information
type ModelConfig ¶
type ModelConfig struct {
Provider string `yaml:"provider" json:"provider"`
Name string `yaml:"name" json:"name"`
Mode string `yaml:"mode" json:"mode"` // chat/completion
}
ModelConfig defines model configuration
type ModelParameters ¶
type ModelParameters struct {
Temperature float64 `yaml:"temperature" json:"temperature"`
MaxTokens int `yaml:"max_tokens" json:"max_tokens"`
TopK int `yaml:"top_k,omitempty" json:"top_k,omitempty"`
TopP float64 `yaml:"top_p,omitempty" json:"top_p,omitempty"`
ResponseFormat int `yaml:"response_format,omitempty" json:"response_format,omitempty"` // 0=text, 1=markdown, 2=json
}
ModelParameters defines model parameters
type Node ¶
type Node struct {
ID string `yaml:"id" json:"id"`
Type NodeType `yaml:"type" json:"type"`
Title string `yaml:"title" json:"title"`
Description string `yaml:"description,omitempty" json:"description,omitempty"`
Position Position `yaml:"position" json:"position"`
Size Size `yaml:"size" json:"size"`
Inputs []Input `yaml:"inputs" json:"inputs"`
Outputs []Output `yaml:"outputs" json:"outputs"`
Config NodeConfig `yaml:"config" json:"config"`
PlatformConfig PlatformConfig `yaml:"platform_config" json:"platform_config"`
}
Node represents unified node structure
type NodeConfig ¶
type NodeConfig interface {
GetNodeType() NodeType
}
NodeConfig interface for node configuration (implemented by specific node types)
type NodeType ¶
type NodeType string
NodeType represents node type enumeration
const ( NodeTypeStart NodeType = "start" // Start node NodeTypeEnd NodeType = "end" // End node NodeTypeLLM NodeType = "llm" // Large language model node NodeTypeCode NodeType = "code" // Code execution node NodeTypeCondition NodeType = "condition" // Conditional branch node NodeTypeClassifier NodeType = "classifier" // Classification decision node NodeTypeIteration NodeType = "iteration" // Iteration node )
type Output ¶
type Output struct {
Name string `yaml:"name" json:"name"`
Label string `yaml:"label,omitempty" json:"label,omitempty"`
Type UnifiedDataType `yaml:"type" json:"type"`
Required bool `yaml:"required" json:"required"`
Description string `yaml:"description,omitempty" json:"description,omitempty"`
Default interface{} `yaml:"default,omitempty" json:"default,omitempty"`
}
Output defines node output specification
type OutputSelectorConfig ¶
type OutputSelectorConfig struct {
NodeID string `yaml:"node_id" json:"node_id"`
OutputName string `yaml:"output_name" json:"output_name"`
}
OutputSelectorConfig defines output selector configuration
type ParseError ¶
type ParseError struct {
Code string `json:"code"`
Message string `json:"message"`
Location *Location `json:"location,omitempty"`
Suggestions []string `json:"suggestions,omitempty"`
}
ParseError represents a parsing error with location information.
func (*ParseError) Error ¶
func (e *ParseError) Error() string
type PlatformConfig ¶
type PlatformConfig struct {
IFlytek map[string]interface{} `yaml:"iflytek,omitempty" json:"iflytek,omitempty"`
Dify map[string]interface{} `yaml:"dify,omitempty" json:"dify,omitempty"`
Coze map[string]interface{} `yaml:"coze,omitempty" json:"coze,omitempty"`
}
PlatformConfig contains platform-specific configuration
type PlatformMetadata ¶
type PlatformMetadata struct {
IFlytek *IFlytekMetadata `yaml:"iflytek,omitempty" json:"iflytek,omitempty"`
Dify *DifyMetadata `yaml:"dify,omitempty" json:"dify,omitempty"`
Coze *CozeMetadata `yaml:"coze,omitempty" json:"coze,omitempty"`
}
PlatformMetadata contains platform-specific metadata
type PlatformType ¶
type PlatformType string
PlatformType represents platform type enumeration
const ( PlatformIFlytek PlatformType = "iflytek" // iFlytek platform PlatformDify PlatformType = "dify" // Dify platform PlatformCoze PlatformType = "coze" // Coze platform )
func GetSupportedPlatformTypes ¶
func GetSupportedPlatformTypes() []PlatformType
GetSupportedPlatformTypes returns list of supported platforms.
type PromptConfig ¶
type PromptConfig struct {
SystemTemplate string `yaml:"system_template,omitempty" json:"system_template,omitempty"`
UserTemplate string `yaml:"user_template,omitempty" json:"user_template,omitempty"`
Messages []Message `yaml:"messages,omitempty" json:"messages,omitempty"`
}
PromptConfig defines prompt configuration
type ReferenceType ¶
type ReferenceType string
ReferenceType represents reference type enumeration
const ( ReferenceTypeNodeOutput ReferenceType = "node_output" // Node output reference ReferenceTypeLiteral ReferenceType = "literal" // Literal value ReferenceTypeTemplate ReferenceType = "template" // Template )
type Size ¶
type Size struct {
Width float64 `yaml:"width" json:"width"`
Height float64 `yaml:"height" json:"height"`
}
Size represents node dimensions
type SpeechConfig ¶
type SpeechConfig struct {
Enabled bool `yaml:"enabled" json:"enabled"`
Language string `yaml:"language,omitempty" json:"language,omitempty"`
Voice string `yaml:"voice,omitempty" json:"voice,omitempty"`
}
SpeechConfig contains speech configuration
type StartConfig ¶
type StartConfig struct {
Variables []Variable `yaml:"variables" json:"variables"`
IsInIteration bool `yaml:"is_in_iteration,omitempty" json:"is_in_iteration,omitempty"`
ParentID string `yaml:"parent_id,omitempty" json:"parent_id,omitempty"`
}
StartConfig defines start node configuration
func (StartConfig) GetNodeType ¶
func (c StartConfig) GetNodeType() NodeType
type SubWorkflowConfig ¶
type SubWorkflowConfig struct {
Nodes []Node `yaml:"nodes" json:"nodes"`
Edges []Edge `yaml:"edges" json:"edges"`
StartNodeID string `yaml:"start_node_id" json:"start_node_id"`
EndNodeID string `yaml:"end_node_id,omitempty" json:"end_node_id,omitempty"`
}
SubWorkflowConfig defines sub-workflow configuration
type UIConfig ¶
type UIConfig struct {
OpeningStatement string `yaml:"opening_statement,omitempty" json:"opening_statement,omitempty"`
SuggestedQuestions []string `yaml:"suggested_questions,omitempty" json:"suggested_questions,omitempty"`
Icon string `yaml:"icon,omitempty" json:"icon,omitempty"`
IconBackground string `yaml:"icon_background,omitempty" json:"icon_background,omitempty"`
}
UIConfig contains user interface configuration
type UnifiedDSL ¶
type UnifiedDSL struct {
Version string `yaml:"version" json:"version"`
Metadata Metadata `yaml:"metadata" json:"metadata"`
PlatformMetadata PlatformMetadata `yaml:"platform_metadata" json:"platform_metadata"`
Workflow Workflow `yaml:"workflow" json:"workflow"`
}
UnifiedDSL represents the root structure of the unified DSL standard
func NewUnifiedDSL ¶
func NewUnifiedDSL() *UnifiedDSL
func (*UnifiedDSL) AddEdge ¶
func (dsl *UnifiedDSL) AddEdge(edge Edge)
AddEdge adds an edge to the workflow
func (*UnifiedDSL) AddNode ¶
func (dsl *UnifiedDSL) AddNode(node Node)
AddNode adds a node to the workflow
func (*UnifiedDSL) GetEdgesBySource ¶
func (dsl *UnifiedDSL) GetEdgesBySource(sourceID string) []Edge
GetEdgesBySource retrieves edges by source node ID
func (*UnifiedDSL) GetEdgesByTarget ¶
func (dsl *UnifiedDSL) GetEdgesByTarget(targetID string) []Edge
GetEdgesByTarget retrieves edges by target node ID
func (*UnifiedDSL) GetNodeByID ¶
func (dsl *UnifiedDSL) GetNodeByID(id string) *Node
GetNodeByID retrieves a node by its ID
func (*UnifiedDSL) UpdateTimestamp ¶
func (dsl *UnifiedDSL) UpdateTimestamp()
UpdateTimestamp updates the timestamp
type UnifiedDataType ¶
type UnifiedDataType string
UnifiedDataType represents standardized data types across different AI platforms.
const ( DataTypeString UnifiedDataType = "string" // Text or string data DataTypeInteger UnifiedDataType = "integer" // Integer numeric values DataTypeFloat UnifiedDataType = "float" // Floating-point numeric values DataTypeNumber UnifiedDataType = "number" // Generic numeric values (backward compatibility) DataTypeBoolean UnifiedDataType = "boolean" // Boolean true/false values DataTypeArrayString UnifiedDataType = "array[string]" // Array of strings DataTypeArrayInteger UnifiedDataType = "array[integer]" // Array of integers DataTypeArrayFloat UnifiedDataType = "array[float]" // Array of floats DataTypeArrayNumber UnifiedDataType = "array[number]" // Array of numbers (backward compatibility) DataTypeArrayBoolean UnifiedDataType = "array[boolean]" // Array of booleans DataTypeArrayObject UnifiedDataType = "array[object]" // Array of objects DataTypeObject UnifiedDataType = "object" // Complex object/map structure )
func ConvertDifyInputType ¶
func ConvertDifyInputType(difyInputType string) UnifiedDataType
ConvertDifyInputType maps Dify input types to unified types.
func ConvertIFlytekCustomParameterType ¶
func ConvertIFlytekCustomParameterType(customType string) UnifiedDataType
ConvertIFlytekCustomParameterType maps iFlytek custom parameter types to unified types.
func GetAllUnifiedTypes ¶
func GetAllUnifiedTypes() []UnifiedDataType
GetAllUnifiedTypes returns all available unified data types.
type ValidationError ¶
type ValidationError struct {
Type string `json:"type"` // node/edge/reference
Severity string `json:"severity"` // error/warning
Message string `json:"message"`
AffectedItems []string `json:"affected_items,omitempty"`
FixSuggestions []string `json:"fix_suggestions,omitempty"`
}
ValidationError represents a validation error in DSL processing.
func (*ValidationError) Error ¶
func (e *ValidationError) Error() string
type Variable ¶
type Variable struct {
Name string `yaml:"name" json:"name"`
Label string `yaml:"label" json:"label"`
Type string `yaml:"type" json:"type"`
Required bool `yaml:"required" json:"required"`
Default interface{} `yaml:"default,omitempty" json:"default,omitempty"`
Description string `yaml:"description,omitempty" json:"description,omitempty"`
Constraints *Constraints `yaml:"constraints,omitempty" json:"constraints,omitempty"`
// Extended fields to support platform-specific information
ID string `yaml:"id,omitempty" json:"id,omitempty"`
Properties []interface{} `yaml:"properties,omitempty" json:"properties,omitempty"`
CustomParameterType string `yaml:"custom_parameter_type,omitempty" json:"custom_parameter_type,omitempty"`
DeleteDisabled bool `yaml:"delete_disabled,omitempty" json:"delete_disabled,omitempty"`
NameErrMsg string `yaml:"name_err_msg,omitempty" json:"name_err_msg,omitempty"`
}
Variable defines global variable structure
type VariableReference ¶
type VariableReference struct {
Type ReferenceType `yaml:"type" json:"type"`
NodeID string `yaml:"node_id,omitempty" json:"node_id,omitempty"`
OutputName string `yaml:"output_name,omitempty" json:"output_name,omitempty"`
DataType UnifiedDataType `yaml:"data_type" json:"data_type"`
Value interface{} `yaml:"value,omitempty" json:"value,omitempty"`
Template string `yaml:"template,omitempty" json:"template,omitempty"`
}
VariableReference represents variable reference
type VariableReferenceSystem ¶
type VariableReferenceSystem struct {
// Used for parsing and generating variable reference formats for different platforms
// OutputMappings maps nodeID -> (oldOutputName -> newOutputName) for reference resolution
OutputMappings map[string]map[string]string
}
VariableReferenceSystem manages variable reference parsing and conversion
func NewVariableReferenceSystem ¶
func NewVariableReferenceSystem() *VariableReferenceSystem
func (*VariableReferenceSystem) DeserializeReference ¶
func (vrs *VariableReferenceSystem) DeserializeReference(data []byte) (*VariableReference, error)
DeserializeReference deserializes variable reference
func (*VariableReferenceSystem) ExtractReferencesFromDifyNode ¶
func (vrs *VariableReferenceSystem) ExtractReferencesFromDifyNode(nodeData map[string]interface{}) ([]*VariableReference, error)
ExtractReferencesFromDifyNode extracts variable references from Dify node
func (*VariableReferenceSystem) ExtractReferencesFromIFlytekNode ¶
func (vrs *VariableReferenceSystem) ExtractReferencesFromIFlytekNode(nodeData map[string]interface{}) ([]*VariableReference, error)
ExtractReferencesFromIFlytekNode extracts variable references from iFlytek Agent node
func (*VariableReferenceSystem) ParseDifyReference ¶
func (vrs *VariableReferenceSystem) ParseDifyReference(valueSelector []string, valueType string) (*VariableReference, error)
ParseDifyReference parses Dify variable reference format Dify uses value_selector array to represent variable references
func (*VariableReferenceSystem) ParseIFlytekReference ¶
func (vrs *VariableReferenceSystem) ParseIFlytekReference(refData map[string]interface{}) (*VariableReference, error)
ParseIFlytekReference parses iFlytek Agent variable reference format iFlytek Agent uses references structure to represent variable references
func (*VariableReferenceSystem) ParseTemplateReference ¶
func (vrs *VariableReferenceSystem) ParseTemplateReference(template string) ([]*VariableReference, error)
ParseTemplateReference parses variable references in templates Supports multiple template formats: {{input_01}}, {{#nodeId.variable#}}, {{$nodes.nodeId.output}}
func (*VariableReferenceSystem) RegisterOutputMapping ¶
func (vrs *VariableReferenceSystem) RegisterOutputMapping(nodeID, oldOutputName, newOutputName string)
RegisterOutputMapping registers an output name mapping for a specific node This allows the system to automatically map output names during reference resolution
func (*VariableReferenceSystem) ReplaceTemplateReferences ¶
func (vrs *VariableReferenceSystem) ReplaceTemplateReferences(template string, fromPlatform, toPlatform PlatformType) (string, error)
ReplaceTemplateReferences replaces variable references in template
func (*VariableReferenceSystem) ResolveOutputName ¶
func (vrs *VariableReferenceSystem) ResolveOutputName(nodeID, outputName string) string
ResolveOutputName resolves an output name using registered mappings Returns the mapped name if a mapping exists, otherwise returns the original name
func (*VariableReferenceSystem) SerializeReference ¶
func (vrs *VariableReferenceSystem) SerializeReference(ref *VariableReference) ([]byte, error)
SerializeReference serializes variable reference
func (*VariableReferenceSystem) ToDifyReference ¶
func (vrs *VariableReferenceSystem) ToDifyReference(ref *VariableReference) ([]string, string, error)
ToDifyReference converts to Dify reference format
func (*VariableReferenceSystem) ToDifyTemplate ¶
func (vrs *VariableReferenceSystem) ToDifyTemplate(ref *VariableReference) (string, error)
ToDifyTemplate converts to Dify template format
func (*VariableReferenceSystem) ToIFlytekReference ¶
func (vrs *VariableReferenceSystem) ToIFlytekReference(ref *VariableReference) (map[string]interface{}, error)
ToIFlytekReference converts to iFlytek Agent reference format
func (*VariableReferenceSystem) ToIFlytekTemplate ¶
func (vrs *VariableReferenceSystem) ToIFlytekTemplate(ref *VariableReference) (string, error)
ToIFlytekTemplate converts to iFlytek Agent template format
func (*VariableReferenceSystem) ToUnifiedTemplate ¶
func (vrs *VariableReferenceSystem) ToUnifiedTemplate(ref *VariableReference) (string, error)
ToUnifiedTemplate converts to unified DSL template format
func (*VariableReferenceSystem) ValidateReference ¶
func (vrs *VariableReferenceSystem) ValidateReference(ref *VariableReference, dsl *UnifiedDSL) error
ValidateReference validates the validity of variable reference
type VisionConfig ¶
type VisionConfig struct {
Enabled bool `yaml:"enabled" json:"enabled"`
}
VisionConfig defines vision configuration