fix: can not set llm struct the right var type

This commit is contained in:
Joel 2025-03-18 15:15:29 +08:00
parent 7a647cf18e
commit a75e77e156

View File

@ -8,7 +8,7 @@ import type {
ValueSelector, ValueSelector,
Var, Var,
} from '@/app/components/workflow/types' } from '@/app/components/workflow/types'
import { useIsChatMode, useWorkflow } from './use-workflow' import { useIsChatMode } from './use-workflow'
import { useStoreApi } from 'reactflow' import { useStoreApi } from 'reactflow'
export const useWorkflowVariables = () => { export const useWorkflowVariables = () => {
@ -80,7 +80,6 @@ export const useWorkflowVariableType = () => {
const { const {
getNodes, getNodes,
} = store.getState() } = store.getState()
const { getBeforeNodesInSameBranch } = useWorkflow()
const { getCurrentVariableType } = useWorkflowVariables() const { getCurrentVariableType } = useWorkflowVariables()
const isChatMode = useIsChatMode() const isChatMode = useIsChatMode()
@ -92,12 +91,10 @@ export const useWorkflowVariableType = () => {
nodeId: string, nodeId: string,
valueSelector: ValueSelector, valueSelector: ValueSelector,
}) => { }) => {
// debugger
const node = getNodes().find(n => n.id === nodeId) const node = getNodes().find(n => n.id === nodeId)
// console.log(nodeId, valueSelector)
const isInIteration = !!node?.data.isInIteration const isInIteration = !!node?.data.isInIteration
const iterationNode = isInIteration ? getNodes().find(n => n.id === node.parentId) : null const iterationNode = isInIteration ? getNodes().find(n => n.id === node.parentId) : null
const availableNodes = getBeforeNodesInSameBranch(nodeId) const availableNodes = [node]
const type = getCurrentVariableType({ const type = getCurrentVariableType({
parentNode: iterationNode, parentNode: iterationNode,