From 08c517dd990dcfa5f47038f05379a587a581ac0b Mon Sep 17 00:00:00 2001 From: Joel Date: Fri, 27 Dec 2024 14:20:05 +0800 Subject: [PATCH] feat: iteration support parallel --- .../install-from-marketplace/index.tsx | 1 - .../workflow/run/utils/format-log/index.ts | 2 +- .../run/utils/format-log/iteration/index.ts | 13 ++++++++++--- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/web/app/components/plugins/install-plugin/install-from-marketplace/index.tsx b/web/app/components/plugins/install-plugin/install-from-marketplace/index.tsx index f1126e09c8..046806ee08 100644 --- a/web/app/components/plugins/install-plugin/install-from-marketplace/index.tsx +++ b/web/app/components/plugins/install-plugin/install-from-marketplace/index.tsx @@ -38,7 +38,6 @@ const InstallFromMarketplace: React.FC = ({ const updateModelProviders = useUpdateModelProviders() const invalidateAllToolProviders = useInvalidateAllToolProviders() const invalidateInstalledPluginList = useInvalidateInstalledPluginList() - // TODO: check installed in beta version. const getTitle = useCallback(() => { if (isBundle && step === InstallStep.installed) diff --git a/web/app/components/workflow/run/utils/format-log/index.ts b/web/app/components/workflow/run/utils/format-log/index.ts index 4a974fc35a..8239f6ca33 100644 --- a/web/app/components/workflow/run/utils/format-log/index.ts +++ b/web/app/components/workflow/run/utils/format-log/index.ts @@ -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 diff --git a/web/app/components/workflow/run/utils/format-log/iteration/index.ts b/web/app/components/workflow/run/utils/format-log/iteration/index.ts index 7583f40b1a..ca3dad7fb0 100644 --- a/web/app/components/workflow/run/utils/format-log/iteration/index.ts +++ b/web/app/components/workflow/run/utils/format-log/iteration/index.ts @@ -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