feat: 添加流程执行查询接口及模型类型与节点名称优化
This commit is contained in:
@@ -16,7 +16,7 @@ const (
|
|||||||
NodeNameAudioModel = "音频"
|
NodeNameAudioModel = "音频"
|
||||||
NodeNameModel = "模型"
|
NodeNameModel = "模型"
|
||||||
NodeNameMerge = "结果合并"
|
NodeNameMerge = "结果合并"
|
||||||
NodeNameJudge = "判断节点"
|
NodeNameJudge = "条件判断"
|
||||||
NodeNameForm = "表单"
|
NodeNameForm = "表单"
|
||||||
NodeNameCustomNode = "自定义节点"
|
NodeNameCustomNode = "自定义节点"
|
||||||
)
|
)
|
||||||
@@ -58,6 +58,11 @@ const (
|
|||||||
NodeTypeCustomNode NodeType = "custom_node"
|
NodeTypeCustomNode NodeType = "custom_node"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
const (
|
||||||
|
ModelTypeText = 1
|
||||||
|
ModelTypeImage = 2
|
||||||
|
)
|
||||||
|
|
||||||
// ======================== 结构定义 ========================
|
// ======================== 结构定义 ========================
|
||||||
type NodeFormField struct {
|
type NodeFormField struct {
|
||||||
Value string `json:"value"`
|
Value string `json:"value"`
|
||||||
@@ -85,6 +90,7 @@ type ModelItem struct {
|
|||||||
type NodeItem struct {
|
type NodeItem struct {
|
||||||
NodeId string `json:"nodeId"`
|
NodeId string `json:"nodeId"`
|
||||||
NodeCode NodeType `json:"nodeCode"`
|
NodeCode NodeType `json:"nodeCode"`
|
||||||
|
ModelType int `json:"modelType"`
|
||||||
NodeName string `json:"nodeName"` // 从常量来
|
NodeName string `json:"nodeName"` // 从常量来
|
||||||
SkillOption bool `json:"skillOption"`
|
SkillOption bool `json:"skillOption"`
|
||||||
FormConfig []NodeFormField `json:"formConfig"`
|
FormConfig []NodeFormField `json:"formConfig"`
|
||||||
|
|||||||
@@ -21,6 +21,10 @@ func (c *flowExecution) ModelCallback(ctx context.Context, req *flowDto.ModelCal
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (c *flowExecution) Get(ctx context.Context, req *flowDto.GetFlowExecutionReq) (res *flowDto.VOFlowExecution, err error) {
|
||||||
|
return flowService.FlowExecutionService.Get(ctx, req)
|
||||||
|
}
|
||||||
|
|
||||||
func (c *flowExecution) List(ctx context.Context, req *flowDto.ListFlowExecutionReq) (res *flowDto.ListFlowExecutionTreeRes, err error) {
|
func (c *flowExecution) List(ctx context.Context, req *flowDto.ListFlowExecutionReq) (res *flowDto.ListFlowExecutionTreeRes, err error) {
|
||||||
return flowService.FlowExecutionService.List(ctx, req)
|
return flowService.FlowExecutionService.List(ctx, req)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -219,7 +219,7 @@ type OutputItem struct {
|
|||||||
}
|
}
|
||||||
type FlowNode struct {
|
type FlowNode struct {
|
||||||
FlowName string `json:"flowName" description:"流程名称"`
|
FlowName string `json:"flowName" description:"流程名称"`
|
||||||
FlowId int64 `json:"flowId,string" description:"流程ID"`
|
Id int64 `json:"Id,string" description:"任务ID"`
|
||||||
SessionId string `json:"sessionId" description:"会话ID"`
|
SessionId string `json:"sessionId" description:"会话ID"`
|
||||||
Items []OutputItem `json:"items" description:"输出项列表"`
|
Items []OutputItem `json:"items" description:"输出项列表"`
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,6 +25,16 @@ var FlowExecutionService = &flowExecutionService{}
|
|||||||
|
|
||||||
type flowExecutionService struct{}
|
type flowExecutionService struct{}
|
||||||
|
|
||||||
|
func (s *flowExecutionService) Get(ctx context.Context, req *flowDto.GetFlowExecutionReq) (res *flowDto.VOFlowExecution, err error) {
|
||||||
|
r, err := flowDao.FlowExecutionDao.Get(ctx, req)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
res = new(flowDto.VOFlowExecution)
|
||||||
|
err = gconv.Struct(r, &res)
|
||||||
|
return res, err
|
||||||
|
}
|
||||||
|
|
||||||
func (s *flowExecutionService) List(ctx context.Context, req *flowDto.ListFlowExecutionReq) (res *flowDto.ListFlowExecutionTreeRes, err error) {
|
func (s *flowExecutionService) List(ctx context.Context, req *flowDto.ListFlowExecutionReq) (res *flowDto.ListFlowExecutionTreeRes, err error) {
|
||||||
user, err := utils.GetUserInfo(ctx)
|
user, err := utils.GetUserInfo(ctx)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -121,7 +131,7 @@ func (s *flowExecutionService) List(ctx context.Context, req *flowDto.ListFlowEx
|
|||||||
// 组装节点
|
// 组装节点
|
||||||
node := flowDto.FlowNode{
|
node := flowDto.FlowNode{
|
||||||
FlowName: displayFlowName,
|
FlowName: displayFlowName,
|
||||||
FlowId: execution.FlowUserId,
|
Id: execution.Id,
|
||||||
SessionId: gconv.String(execution.SessionId),
|
SessionId: gconv.String(execution.SessionId),
|
||||||
Items: tempItems,
|
Items: tempItems,
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ func (s *nodeLibraryService) GetNodeLibrary(ctx context.Context, req *nodeDto.Wo
|
|||||||
{
|
{
|
||||||
NodeCode: node.NodeTypeTextModel,
|
NodeCode: node.NodeTypeTextModel,
|
||||||
NodeName: node.NodeNameTextModel,
|
NodeName: node.NodeNameTextModel,
|
||||||
|
ModelType: node.ModelTypeText,
|
||||||
SkillOption: true,
|
SkillOption: true,
|
||||||
FormConfig: []node.NodeFormField{}, // 技能下拉
|
FormConfig: []node.NodeFormField{}, // 技能下拉
|
||||||
ModelConfig: []node.ModelItem{},
|
ModelConfig: []node.ModelItem{},
|
||||||
@@ -32,6 +33,7 @@ func (s *nodeLibraryService) GetNodeLibrary(ctx context.Context, req *nodeDto.Wo
|
|||||||
{
|
{
|
||||||
NodeCode: node.NodeTypeImageModel,
|
NodeCode: node.NodeTypeImageModel,
|
||||||
NodeName: node.NodeNameImageModel,
|
NodeName: node.NodeNameImageModel,
|
||||||
|
ModelType: node.ModelTypeImage,
|
||||||
SkillOption: true,
|
SkillOption: true,
|
||||||
FormConfig: []node.NodeFormField{}, // 技能下拉
|
FormConfig: []node.NodeFormField{}, // 技能下拉
|
||||||
ModelConfig: []node.ModelItem{},
|
ModelConfig: []node.ModelItem{},
|
||||||
|
|||||||
Reference in New Issue
Block a user