mirror of
https://github.com/langgenius/dify.git
synced 2024-11-16 19:59:50 +08:00
fix: checkout inputs before workflow run
This commit is contained in:
parent
63ae66b827
commit
575ef4bb9d
|
@ -114,7 +114,7 @@ export const useWorkflowStartRun = () => {
|
|||
setShowDebugAndPreviewPanel(true)
|
||||
setShowInputsPanel(true)
|
||||
}
|
||||
}, [store, workflowStore, featuresStore, handleCancelDebugAndPreviewPanel, handleRun, doSyncWorkflowDraft])
|
||||
}, [store, workflowStore, featuresStore, handleCancelDebugAndPreviewPanel, handleRun, doSyncWorkflowDraft, isFromStartNode, t, currentModel, rerankDefaultModel, checkKnowledgeRetrievalValid])
|
||||
|
||||
const handleWorkflowStartRunInChatflow = useCallback(async () => {
|
||||
const {
|
||||
|
|
|
@ -23,6 +23,7 @@ import { useFeatures } from '@/app/components/base/features/hooks'
|
|||
import {
|
||||
getProcessedInputs,
|
||||
} from '@/app/components/base/chat/chat/utils'
|
||||
import { useCheckInputsForms } from '@/app/components/base/chat/chat/check-input-forms-hooks'
|
||||
|
||||
type Props = {
|
||||
onRun: () => void
|
||||
|
@ -41,6 +42,7 @@ const InputsPanel = ({ onRun }: Props) => {
|
|||
} = useWorkflowRun()
|
||||
const startNode = nodes.find(node => node.data.type === BlockEnum.Start)
|
||||
const startVariables = startNode?.data.variables
|
||||
const { checkInputsForm } = useCheckInputsForms()
|
||||
|
||||
const variables = useMemo(() => {
|
||||
const data = startVariables || []
|
||||
|
@ -78,9 +80,11 @@ const InputsPanel = ({ onRun }: Props) => {
|
|||
}
|
||||
|
||||
const doRun = useCallback(() => {
|
||||
if (!checkInputsForm(inputs, variables as any))
|
||||
return
|
||||
onRun()
|
||||
handleRun({ inputs: getProcessedInputs(inputs, variables as any), files })
|
||||
}, [files, handleRun, inputs, onRun, variables])
|
||||
}, [files, handleRun, inputs, onRun, variables, checkInputsForm])
|
||||
|
||||
const canRun = useMemo(() => {
|
||||
if (files?.some(item => (item.transfer_method as any) === TransferMethod.local_file && !item.upload_file_id))
|
||||
|
|
Loading…
Reference in New Issue
Block a user