Commit b13345ce authored by Joel's avatar Joel

chore: remove useless and node filter

parent f15dce9e
......@@ -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 = () => {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment