feat: iteration support parallel

This commit is contained in:
Joel 2024-12-27 14:20:05 +08:00
parent 69a6556f52
commit 08c517dd99
3 changed files with 11 additions and 5 deletions

View File

@ -38,7 +38,6 @@ const InstallFromMarketplace: React.FC<InstallFromMarketplaceProps> = ({
const updateModelProviders = useUpdateModelProviders()
const invalidateAllToolProviders = useInvalidateAllToolProviders()
const invalidateInstalledPluginList = useInvalidateInstalledPluginList()
// TODO: check installed in beta version.
const getTitle = useCallback(() => {
if (isBundle && step === InstallStep.installed)

View File

@ -13,7 +13,7 @@ const formatToTracingNodeList = (list: NodeTracing[], t: any) => {
const formattedAgentList = formatAgentNode(allItems)
const formattedRetryList = formatRetryNode(formattedAgentList) // retry one node
// would change the structure of the list. Iteration and parallel can include each other.
const formattedIterationList = formatIterationNode(formattedRetryList)
const formattedIterationList = formatIterationNode(formattedRetryList, t)
const formattedParallelList = formatParallelNode(formattedIterationList, t)
const result = formattedParallelList

View File

@ -1,6 +1,6 @@
import { BlockEnum } from '@/app/components/workflow/types'
import type { NodeTracing } from '@/types/workflow'
import formatParallelNode from '../parallel'
function addChildrenToIterationNode(iterationNode: NodeTracing, childrenNodes: NodeTracing[]): NodeTracing {
const details: NodeTracing[][] = []
childrenNodes.forEach((item) => {
@ -18,7 +18,7 @@ function addChildrenToIterationNode(iterationNode: NodeTracing, childrenNodes: N
}
}
const format = (list: NodeTracing[]): NodeTracing[] => {
const format = (list: NodeTracing[], t: any): NodeTracing[] => {
const iterationNodeIds = list
.filter(item => item.node_type === BlockEnum.Iteration)
.map(item => item.node_id)
@ -36,7 +36,14 @@ const format = (list: NodeTracing[]): NodeTracing[] => {
item.status = 'failed'
item.error = error.error
}
return addChildrenToIterationNode(item, childrenNodes)
const addedChildrenList = addChildrenToIterationNode(item, childrenNodes)
// handle parallel node in iteration node
if (addedChildrenList.details && addedChildrenList.details.length > 0) {
addedChildrenList.details = addedChildrenList.details.map((row) => {
return formatParallelNode(row, t)
})
}
return addedChildrenList
}
return item