Skip to content

armgit / dify

Public Imported from GitHub
0

Build Agentic workflows, RAG pipelines, with rich AI model and tool support on one collaborative workspace. Deploy on cloud, VPC, or self-hosted, so teams move from prototype to production without rebuilding the stack.

fix: in tool and http node of iteration can not show item var correctly (#4791)

Joel3175a2c76a6a
diff --git a/web/app/components/workflow/nodes/http/components/api-input.tsx b/web/app/components/workflow/nodes/http/components/api-input.tsx
index 6c588cc3aac..c84556d92b3 100644
--- a/web/app/components/workflow/nodes/http/components/api-input.tsx
+++ b/web/app/components/workflow/nodes/http/components/api-input.tsx
@@ -39,7 +39,7 @@ const ApiInput: FC<Props> = ({
const { t } = useTranslation()
const [isFocus, setIsFocus] = useState(false)
- const { availableVars, availableNodes } = useAvailableVarList(nodeId, {
+ const { availableVars, availableNodesWithParent } = useAvailableVarList(nodeId, {
onlyLeafNodeVar: false,
filterVar: (varPayload: Var) => {
return [VarType.string, VarType.number].includes(varPayload.type)
@@ -70,7 +70,7 @@ const ApiInput: FC<Props> = ({
onChange={onUrlChange}
readOnly={readonly}
nodesOutputVars={availableVars}
- availableNodes={availableNodes}
+ availableNodes={availableNodesWithParent}
onFocusChange={setIsFocus}
placeholder={!readonly ? t('workflow.nodes.http.apiPlaceholder')! : ''}
placeholderClassName='!leading-[21px]'
diff --git a/web/app/components/workflow/nodes/http/components/key-value/key-value-edit/input-item.tsx b/web/app/components/workflow/nodes/http/components/key-value/key-value-edit/input-item.tsx
index 7020723ae91..40140db191a 100644
--- a/web/app/components/workflow/nodes/http/components/key-value/key-value-edit/input-item.tsx
+++ b/web/app/components/workflow/nodes/http/components/key-value/key-value-edit/input-item.tsx
@@ -36,7 +36,7 @@ const InputItem: FC<Props> = ({
const hasValue = !!value
const [isFocus, setIsFocus] = useState(false)
- const { availableVars, availableNodes } = useAvailableVarList(nodeId, {
+ const { availableVars, availableNodesWithParent } = useAvailableVarList(nodeId, {
onlyLeafNodeVar: false,
filterVar: (varPayload: Var) => {
return [VarType.string, VarType.number].includes(varPayload.type)
@@ -59,7 +59,7 @@ const InputItem: FC<Props> = ({
onChange={onChange}
readOnly={readOnly}
nodesOutputVars={availableVars}
- availableNodes={availableNodes}
+ availableNodes={availableNodesWithParent}
onFocusChange={setIsFocus}
placeholder={t('workflow.nodes.http.insertVarPlaceholder')!}
placeholderClassName='!leading-[21px]'
@@ -78,7 +78,7 @@ const InputItem: FC<Props> = ({
onChange={onChange}
readOnly={readOnly}
nodesOutputVars={availableVars}
- availableNodes={availableNodes}
+ availableNodes={availableNodesWithParent}
onFocusChange={setIsFocus}
placeholder={t('workflow.nodes.http.insertVarPlaceholder')!}
placeholderClassName='!leading-[21px]'
diff --git a/web/app/components/workflow/nodes/tool/components/input-var-list.tsx b/web/app/components/workflow/nodes/tool/components/input-var-list.tsx
index a4faf7d0814..f992ce79066 100644
--- a/web/app/components/workflow/nodes/tool/components/input-var-list.tsx
+++ b/web/app/components/workflow/nodes/tool/components/input-var-list.tsx
@@ -37,7 +37,7 @@ const InputVarList: FC<Props> = ({
}) => {
const language = useLanguage()
const { t } = useTranslation()
- const { availableVars, availableNodes } = useAvailableVarList(nodeId, {
+ const { availableVars, availableNodesWithParent } = useAvailableVarList(nodeId, {
onlyLeafNodeVar: false,
filterVar: (varPayload: Var) => {
return [VarType.string, VarType.number].includes(varPayload.type)
@@ -139,7 +139,7 @@ const InputVarList: FC<Props> = ({
onChange={handleMixedTypeChange(variable)}
readOnly={readOnly}
nodesOutputVars={availableVars}
- availableNodes={availableNodes}
+ availableNodes={availableNodesWithParent}
onFocusChange={handleInputFocus(variable)}
placeholder={t('workflow.nodes.http.insertVarPlaceholder')!}
placeholderClassName='!leading-[21px]'