112 lines
3.1 KiB
Go
112 lines
3.1 KiB
Go
package node
|
|
|
|
// ======================== 【常量定义:所有中文文案放这里!】 ========================
|
|
// 分组名称
|
|
const (
|
|
NodeGroupNameComponent = "组件"
|
|
NodeGroupNameBase = "基础"
|
|
NodeGroupNameCustom = "自定义"
|
|
)
|
|
|
|
// 节点名称
|
|
const (
|
|
NodeNameTextModel = "生成文案"
|
|
NodeNameImageModel = "生成图片"
|
|
NodeNameVideoModel = "生成视频"
|
|
NodeNameSenseOptimize = "语义优化"
|
|
NodeNameStoryOptimize = "分镜优化"
|
|
NodeNameScriptOptimize = "剧本优化"
|
|
NodeNameAudioModel = "音频"
|
|
NodeNameModel = "模型"
|
|
NodeNameMerge = "结果合并"
|
|
NodeNameJudge = "条件判断"
|
|
NodeNameForm = "表单"
|
|
NodeNameHttp = "HTTP(S)接口"
|
|
NodeNameCustomNode = "自定义节点"
|
|
)
|
|
|
|
// 表单字段 Label
|
|
const (
|
|
FormLabelApiKey = "API Key"
|
|
FormLabelModel = "模型名称"
|
|
|
|
FormLabelCondition = "判断条件"
|
|
)
|
|
|
|
// ======================== 枚举类型 ========================
|
|
type NodeGroup string
|
|
|
|
const (
|
|
NodeGroupComponent NodeGroup = "component"
|
|
NodeGroupBase NodeGroup = "base"
|
|
NodeGroupCustom NodeGroup = "custom"
|
|
)
|
|
|
|
type NodeType string
|
|
|
|
const (
|
|
// 组件
|
|
NodeTypeTextModel NodeType = "text_model"
|
|
NodeTypeImageModel NodeType = "image_model"
|
|
NodeTypeVideoModel NodeType = "video_model"
|
|
NodeTypeSenseOptimize NodeType = "sense_optimize"
|
|
NodeTypeStoryOptimize NodeType = "story_optimize"
|
|
NodeTypeScriptOptimize NodeType = "script_optimize"
|
|
NodeTypeAudioModel NodeType = "audio_model"
|
|
|
|
// 基础
|
|
NodeTypeModel NodeType = "model"
|
|
NodeTypeMerge NodeType = "merge"
|
|
NodeTypeJudge NodeType = "judge"
|
|
NodeTypeForm NodeType = "form"
|
|
NodeTypeIntent NodeType = "intent"
|
|
NodeTypeHttp NodeType = "http"
|
|
// 自定义
|
|
NodeTypeCustomNode NodeType = "custom_node"
|
|
)
|
|
|
|
const (
|
|
ModelTypeText = 1
|
|
ModelTypeImage = 2
|
|
)
|
|
|
|
// ======================== 结构定义 ========================
|
|
type NodeFormField struct {
|
|
Value string `json:"value"`
|
|
Field string `json:"field"`
|
|
Label string `json:"label"` // 从常量来
|
|
Type string `json:"type"`
|
|
Required bool `json:"required"`
|
|
Default any `json:"default,omitempty"`
|
|
Options []SelectOption `json:"options"`
|
|
Expand any `json:"expand"`
|
|
}
|
|
|
|
type SelectOption struct {
|
|
Label string `json:"label"`
|
|
Value string `json:"value"`
|
|
}
|
|
|
|
type ModelItem struct {
|
|
ModelApiKey string `json:"modelApiKey"`
|
|
ModelName string `json:"modelName"`
|
|
ModelForm map[string]any `json:"modelForm"`
|
|
ModelResponse map[string]any `json:"modelResponse"`
|
|
}
|
|
|
|
type NodeItem struct {
|
|
NodeId string `json:"nodeId"`
|
|
NodeCode NodeType `json:"nodeCode"`
|
|
ModelType int `json:"modelType"`
|
|
NodeName string `json:"nodeName"` // 从常量来
|
|
SkillOption bool `json:"skillOption"`
|
|
FormConfig []NodeFormField `json:"formConfig"`
|
|
ModelConfig []ModelItem `json:"modelConfig"`
|
|
}
|
|
|
|
type NodeGroupItem struct {
|
|
Group NodeGroup `json:"group"`
|
|
Label string `json:"label"` // 从常量来
|
|
Items []NodeItem `json:"items"`
|
|
}
|