fix: app workflow publish panic (#719)

This commit is contained in:
shentongmartin 2025-08-13 11:40:57 +08:00 committed by GitHub
parent 99c759addc
commit 708a6ed0c0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 7 additions and 4 deletions

View File

@ -1649,7 +1649,7 @@ func replaceRelatedWorkflowOrExternalResourceInWorkflowNodes(nodes []*vo.Node, r
for _, node := range nodes { for _, node := range nodes {
switch entity.IDStrToNodeType(node.Type) { switch entity.IDStrToNodeType(node.Type) {
case entity.NodeTypeSubWorkflow: case entity.NodeTypeSubWorkflow:
if !hasWorkflowRelated { if !hasWorkflowRelated || node.Data.Inputs.SubWorkflow == nil {
continue continue
} }
workflowID, err := strconv.ParseInt(node.Data.Inputs.WorkflowID, 10, 64) workflowID, err := strconv.ParseInt(node.Data.Inputs.WorkflowID, 10, 64)
@ -1661,7 +1661,7 @@ func replaceRelatedWorkflowOrExternalResourceInWorkflowNodes(nodes []*vo.Node, r
node.Data.Inputs.WorkflowVersion = wf.Version node.Data.Inputs.WorkflowVersion = wf.Version
} }
case entity.NodeTypePlugin: case entity.NodeTypePlugin:
if !hasPluginRelated { if !hasPluginRelated || node.Data.Inputs.PluginAPIParam == nil {
continue continue
} }
apiParams := slices.ToMap(node.Data.Inputs.APIParams, func(e *vo.Param) (string, *vo.Param) { apiParams := slices.ToMap(node.Data.Inputs.APIParams, func(e *vo.Param) (string, *vo.Param) {
@ -1704,6 +1704,9 @@ func replaceRelatedWorkflowOrExternalResourceInWorkflowNodes(nodes []*vo.Node, r
} }
case entity.NodeTypeLLM: case entity.NodeTypeLLM:
if node.Data.Inputs.LLM == nil {
continue
}
if hasWorkflowRelated && node.Data.Inputs.FCParam != nil && node.Data.Inputs.FCParam.WorkflowFCParam != nil { if hasWorkflowRelated && node.Data.Inputs.FCParam != nil && node.Data.Inputs.FCParam.WorkflowFCParam != nil {
for idx := range node.Data.Inputs.FCParam.WorkflowFCParam.WorkflowList { for idx := range node.Data.Inputs.FCParam.WorkflowFCParam.WorkflowList {
wf := node.Data.Inputs.FCParam.WorkflowFCParam.WorkflowList[idx] wf := node.Data.Inputs.FCParam.WorkflowFCParam.WorkflowList[idx]
@ -1750,7 +1753,7 @@ func replaceRelatedWorkflowOrExternalResourceInWorkflowNodes(nodes []*vo.Node, r
} }
case entity.NodeTypeKnowledgeIndexer, entity.NodeTypeKnowledgeRetriever: case entity.NodeTypeKnowledgeIndexer, entity.NodeTypeKnowledgeRetriever:
if !hasKnowledgeRelated { if !hasKnowledgeRelated || node.Data.Inputs.Knowledge == nil {
continue continue
} }
datasetListInfoParam := node.Data.Inputs.DatasetParam[0] datasetListInfoParam := node.Data.Inputs.DatasetParam[0]
@ -1766,7 +1769,7 @@ func replaceRelatedWorkflowOrExternalResourceInWorkflowNodes(nodes []*vo.Node, r
} }
case entity.NodeTypeDatabaseCustomSQL, entity.NodeTypeDatabaseQuery, entity.NodeTypeDatabaseInsert, entity.NodeTypeDatabaseDelete, entity.NodeTypeDatabaseUpdate: case entity.NodeTypeDatabaseCustomSQL, entity.NodeTypeDatabaseQuery, entity.NodeTypeDatabaseInsert, entity.NodeTypeDatabaseDelete, entity.NodeTypeDatabaseUpdate:
if !hasDatabaseRelated { if !hasDatabaseRelated || node.Data.Inputs.DatabaseNode == nil {
continue continue
} }
dsList := node.Data.Inputs.DatabaseInfoList dsList := node.Data.Inputs.DatabaseInfoList