|
|
|
@ -1,13 +1,13 @@
|
|
|
|
'use client'
|
|
|
|
'use client'
|
|
|
|
import type { FC } from 'react'
|
|
|
|
import type { FC } from 'react'
|
|
|
|
import React, { useCallback } from 'react'
|
|
|
|
import React, { useCallback, useMemo } from 'react'
|
|
|
|
import type { GeneratorType } from './types'
|
|
|
|
import type { GeneratorType } from './types'
|
|
|
|
import type { ValueSelector, Var } from '@/app/components/workflow/types'
|
|
|
|
import type { ValueSelector, Var } from '@/app/components/workflow/types'
|
|
|
|
import { VarType } from '@/app/components/workflow/types'
|
|
|
|
import { VarType } from '@/app/components/workflow/types'
|
|
|
|
import useAvailableVarList from '@/app/components/workflow/nodes/_base/hooks/use-available-var-list'
|
|
|
|
import useAvailableVarList from '@/app/components/workflow/nodes/_base/hooks/use-available-var-list'
|
|
|
|
import InstructionEditor from './instruction-editor'
|
|
|
|
import InstructionEditor from './instruction-editor'
|
|
|
|
import { useWorkflowVariableType } from '@/app/components/workflow/hooks'
|
|
|
|
import { useWorkflowVariableType } from '@/app/components/workflow/hooks'
|
|
|
|
import { useWorkflowStore } from '@/app/components/workflow/store'
|
|
|
|
import { useStore, useWorkflowStore } from '@/app/components/workflow/store'
|
|
|
|
|
|
|
|
|
|
|
|
type Props = {
|
|
|
|
type Props = {
|
|
|
|
nodeId: string
|
|
|
|
nodeId: string
|
|
|
|
@ -27,7 +27,10 @@ const InstructionEditorInWorkflow: FC<Props> = ({
|
|
|
|
isShowCurrentBlock,
|
|
|
|
isShowCurrentBlock,
|
|
|
|
}) => {
|
|
|
|
}) => {
|
|
|
|
const workflowStore = useWorkflowStore()
|
|
|
|
const workflowStore = useWorkflowStore()
|
|
|
|
|
|
|
|
const nodesWithInspectVars = useStore(s => s.nodesWithInspectVars)
|
|
|
|
|
|
|
|
const isShowLastRunBlock = useMemo(() => {
|
|
|
|
|
|
|
|
return !!nodesWithInspectVars.find(node => node.nodeId === nodeId)
|
|
|
|
|
|
|
|
}, [nodesWithInspectVars])
|
|
|
|
const filterVar = useCallback((payload: Var, selector: ValueSelector) => {
|
|
|
|
const filterVar = useCallback((payload: Var, selector: ValueSelector) => {
|
|
|
|
const { nodesWithInspectVars } = workflowStore.getState()
|
|
|
|
const { nodesWithInspectVars } = workflowStore.getState()
|
|
|
|
const nodeId = selector?.[0]
|
|
|
|
const nodeId = selector?.[0]
|
|
|
|
@ -52,6 +55,7 @@ const InstructionEditorInWorkflow: FC<Props> = ({
|
|
|
|
availableNodes={availableNodes}
|
|
|
|
availableNodes={availableNodes}
|
|
|
|
getVarType={getVarType}
|
|
|
|
getVarType={getVarType}
|
|
|
|
isShowCurrentBlock={isShowCurrentBlock}
|
|
|
|
isShowCurrentBlock={isShowCurrentBlock}
|
|
|
|
|
|
|
|
isShowLastRunBlock
|
|
|
|
/>
|
|
|
|
/>
|
|
|
|
)
|
|
|
|
)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|