mirror of https://github.com/langgenius/dify.git
fix: update hasConnectedUserInput function to use specific types for nodes and edges
This commit is contained in:
parent
cc4d4adfb9
commit
4601be8b67
|
|
@ -18,18 +18,19 @@ import {
|
|||
import type { FetchWorkflowDraftResponse } from '@/types/workflow'
|
||||
import { useWorkflowConfig } from '@/service/use-workflow'
|
||||
import type { FileUploadConfigResponse } from '@/models/common'
|
||||
import type { Edge, Node } from '@/app/components/workflow/types'
|
||||
import { BlockEnum } from '@/app/components/workflow/types'
|
||||
import { AppModeEnum } from '@/types/app'
|
||||
|
||||
const hasConnectedUserInput = (nodes: any[] = [], edges: any[] = []) => {
|
||||
const hasConnectedUserInput = (nodes: Node[] = [], edges: Edge[] = []): boolean => {
|
||||
const startNodeIds = nodes
|
||||
.filter(node => node?.data?.type === BlockEnum.Start)
|
||||
.map((node: any) => node.id)
|
||||
.map(node => node.id)
|
||||
|
||||
if (!startNodeIds.length)
|
||||
return false
|
||||
|
||||
return edges?.some((edge: any) => startNodeIds.includes(edge.source))
|
||||
return edges.some(edge => startNodeIds.includes(edge.source))
|
||||
}
|
||||
export const useWorkflowInit = () => {
|
||||
const workflowStore = useWorkflowStore()
|
||||
|
|
|
|||
Loading…
Reference in New Issue