mirror of
https://git.mirrors.martin98.com/https://github.com/langgenius/dify.git
synced 2025-08-19 15:09:11 +08:00
fix: http file node not added
This commit is contained in:
parent
66953d57a2
commit
8b26ae6532
@ -80,6 +80,8 @@ const varTypeToInputVarType = (type: VarType, {
|
|||||||
return InputVarType.number
|
return InputVarType.number
|
||||||
if ([VarType.object, VarType.array, VarType.arrayNumber, VarType.arrayString, VarType.arrayObject].includes(type))
|
if ([VarType.object, VarType.array, VarType.arrayNumber, VarType.arrayString, VarType.arrayObject].includes(type))
|
||||||
return InputVarType.json
|
return InputVarType.json
|
||||||
|
if (type === VarType.file)
|
||||||
|
return InputVarType.singleFile
|
||||||
if (type === VarType.arrayFile)
|
if (type === VarType.arrayFile)
|
||||||
return InputVarType.files
|
return InputVarType.files
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { useCallback, useEffect, useState } from 'react'
|
import { useCallback, useEffect, useMemo, useState } from 'react'
|
||||||
import produce from 'immer'
|
import produce from 'immer'
|
||||||
import { useBoolean } from 'ahooks'
|
import { useBoolean } from 'ahooks'
|
||||||
import useVarList from '../_base/hooks/use-var-list'
|
import useVarList from '../_base/hooks/use-var-list'
|
||||||
@ -132,11 +132,23 @@ const useConfig = (id: string, payload: HttpNodeType) => {
|
|||||||
defaultRunInputData: {},
|
defaultRunInputData: {},
|
||||||
})
|
})
|
||||||
|
|
||||||
|
const fileVarInputs = useMemo(() => {
|
||||||
|
if (!Array.isArray(inputs.body.data))
|
||||||
|
return ''
|
||||||
|
|
||||||
|
const res = inputs.body.data
|
||||||
|
.filter(item => item.file?.length)
|
||||||
|
.map(item => item.file ? `{{#${item.file.join('.')}#}}` : '')
|
||||||
|
.join(' ')
|
||||||
|
return res
|
||||||
|
}, [inputs.body.data])
|
||||||
|
|
||||||
const varInputs = getInputVars([
|
const varInputs = getInputVars([
|
||||||
inputs.url,
|
inputs.url,
|
||||||
inputs.headers,
|
inputs.headers,
|
||||||
inputs.params,
|
inputs.params,
|
||||||
typeof inputs.body.data === 'string' ? inputs.body.data : inputs.body.data.map(item => item.value).join(''),
|
typeof inputs.body.data === 'string' ? inputs.body.data : inputs.body.data.map(item => item.value).join(''),
|
||||||
|
fileVarInputs,
|
||||||
])
|
])
|
||||||
|
|
||||||
const inputVarValues = (() => {
|
const inputVarValues = (() => {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user