mirror of https://github.com/langgenius/dify.git
chore: remove useless and node filter
This commit is contained in:
parent
f15dce9ee3
commit
b13345ceb2
|
|
@ -8,6 +8,7 @@ import {
|
|||
import { getLayoutByDagre } from '../utils'
|
||||
import type { Node } from '../types'
|
||||
import { BlockEnum } from '../types'
|
||||
import { SUPPORT_OUTPUT_VARS_NODE } from '../constants'
|
||||
import { useStore as useAppStore } from '@/app/components/app/store'
|
||||
|
||||
export const useIsChatMode = () => {
|
||||
|
|
@ -105,13 +106,7 @@ export const useWorkflow = () => {
|
|||
const length = list.length
|
||||
if (length && list.some(item => item.data.type === BlockEnum.Start)) {
|
||||
return list.reverse().filter((item) => {
|
||||
if (item.data.type === BlockEnum.IfElse)
|
||||
return false
|
||||
|
||||
if (item.data.type === BlockEnum.QuestionClassifier)
|
||||
return false
|
||||
|
||||
return true
|
||||
return SUPPORT_OUTPUT_VARS_NODE.includes(item.data.type)
|
||||
})
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -25,13 +25,6 @@ type Props = {
|
|||
onChange: (value: ValueSelector) => void
|
||||
}
|
||||
|
||||
// const toShowVarType = (type: string) => {
|
||||
// if (['text-input', 'paragraph', 'select', 'url'].includes(type))
|
||||
// return 'String'
|
||||
|
||||
// return type.charAt(0).toUpperCase() + type.substring(1)
|
||||
// }
|
||||
|
||||
export const getNodeInfoById = (nodes: any, id: string) => {
|
||||
return nodes.find((node: any) => node.id === id)
|
||||
}
|
||||
|
|
@ -45,15 +38,12 @@ const VarReferencePicker: FC<Props> = ({
|
|||
onChange,
|
||||
}) => {
|
||||
const { getTreeLeafNodes, getBeforeNodesInSameBranch } = useWorkflow()
|
||||
// console.log(getBeforeNodesInSameBranch(nodeId), getTreeLeafNodes())
|
||||
const availableNodes = getBeforeNodesInSameBranch(nodeId)
|
||||
const outputVars = toNodeOutputVars(availableNodes)
|
||||
// console.log(outputVars)
|
||||
const [open, setOpen] = useState(false)
|
||||
const hasValue = value.length > 0
|
||||
const outputVarNodeId = hasValue ? value[0] : ''
|
||||
const outputVarNode = hasValue ? getNodeInfoById(availableNodes, outputVarNodeId)?.data : null
|
||||
// console.log(hasValue, value, outputVarNode)
|
||||
const varName = hasValue ? value[value.length - 1] : ''
|
||||
|
||||
const getVarType = () => {
|
||||
|
|
|
|||
Loading…
Reference in New Issue