- {!isEnv && !isChatVar && (
-
-
-
-
-
{node?.data.title}
-
-
- )}
-
- {!isEnv && !isChatVar &&
}
- {isEnv &&
}
- {!isChatVar &&
{varName}
}
- {isChatVar
- &&
+
+ {
+ node && (
+ <>
+
+
+
+
+ {node?.data.title}
+
+
+ >
+ )
}
+ {VariableIcon}
+ {VariableName}
+ {writeMode &&
}
)
}
diff --git a/web/app/components/workflow/operator/add-block.tsx b/web/app/components/workflow/operator/add-block.tsx
index bc5a4ddc62..d35a5be8b4 100644
--- a/web/app/components/workflow/operator/add-block.tsx
+++ b/web/app/components/workflow/operator/add-block.tsx
@@ -9,6 +9,7 @@ import { useTranslation } from 'react-i18next'
import type { OffsetOptions } from '@floating-ui/react'
import {
generateNewNode,
+ getNodeCustomTypeByNodeDataType,
} from '../utils'
import {
useAvailableBlocks,
@@ -56,6 +57,7 @@ const AddBlock = ({
const nodes = getNodes()
const nodesWithSameType = nodes.filter(node => node.data.type === type)
const { newNode } = generateNewNode({
+ type: getNodeCustomTypeByNodeDataType(type),
data: {
...NODES_INITIAL_DATA[type],
title: nodesWithSameType.length > 0 ? `${t(`workflow.blocks.${type}`)} ${nodesWithSameType.length + 1}` : t(`workflow.blocks.${type}`),
diff --git a/web/app/components/workflow/run/hooks.ts b/web/app/components/workflow/run/hooks.ts
index 8a74688a26..1835eb53db 100644
--- a/web/app/components/workflow/run/hooks.ts
+++ b/web/app/components/workflow/run/hooks.ts
@@ -8,6 +8,7 @@ import type {
AgentLogItemWithChildren,
IterationDurationMap,
LoopDurationMap,
+ LoopVariableMap,
NodeTracing,
} from '@/types/workflow'
@@ -40,10 +41,12 @@ export const useLogs = () => {
}] = useBoolean(false)
const [loopResultList, setLoopResultList] = useState
([])
const [loopResultDurationMap, setLoopResultDurationMap] = useState({})
- const handleShowLoopResultList = useCallback((detail: NodeTracing[][], loopDurationMap: LoopDurationMap) => {
+ const [loopResultVariableMap, setLoopResultVariableMap] = useState>({})
+ const handleShowLoopResultList = useCallback((detail: NodeTracing[][], loopDurationMap: LoopDurationMap, loopVariableMap: LoopVariableMap) => {
setShowLoopingDetailTrue()
setLoopResultList(detail)
setLoopResultDurationMap(loopDurationMap)
+ setLoopResultVariableMap(loopVariableMap)
}, [setShowLoopingDetailTrue, setLoopResultList, setLoopResultDurationMap])
const [agentOrToolLogItemStack, setAgentOrToolLogItemStack] = useState([])
@@ -101,6 +104,8 @@ export const useLogs = () => {
setLoopResultList,
loopResultDurationMap,
setLoopResultDurationMap,
+ loopResultVariableMap,
+ setLoopResultVariableMap,
handleShowLoopResultList,
agentOrToolLogItemStack,
diff --git a/web/app/components/workflow/run/loop-log/loop-log-trigger.tsx b/web/app/components/workflow/run/loop-log/loop-log-trigger.tsx
index ab3ae1d964..fca549b2a1 100644
--- a/web/app/components/workflow/run/loop-log/loop-log-trigger.tsx
+++ b/web/app/components/workflow/run/loop-log/loop-log-trigger.tsx
@@ -3,13 +3,14 @@ import { RiArrowRightSLine } from '@remixicon/react'
import Button from '@/app/components/base/button'
import type {
LoopDurationMap,
+ LoopVariableMap,
NodeTracing,
} from '@/types/workflow'
import { Loop } from '@/app/components/base/icons/src/vender/workflow'
type LoopLogTriggerProps = {
nodeInfo: NodeTracing
- onShowLoopResultList: (loopResultList: NodeTracing[][], loopResultDurationMap: LoopDurationMap) => void
+ onShowLoopResultList: (loopResultList: NodeTracing[][], loopResultDurationMap: LoopDurationMap, loopVariableMap: LoopVariableMap) => void
}
const LoopLogTrigger = ({
nodeInfo,
@@ -35,7 +36,11 @@ const LoopLogTrigger = ({
const handleOnShowLoopDetail = (e: React.MouseEvent) => {
e.stopPropagation()
e.nativeEvent.stopImmediatePropagation()
- onShowLoopResultList(nodeInfo.details || [], nodeInfo?.loopDurationMap || nodeInfo.execution_metadata?.loop_duration_map || {})
+ onShowLoopResultList(
+ nodeInfo.details || [],
+ nodeInfo?.loopDurationMap || nodeInfo.execution_metadata?.loop_duration_map || {},
+ nodeInfo.execution_metadata?.loop_variable_map || {},
+ )
}
return (
+ )
+ }