diff --git a/web/app/components/base/file-uploader/file-uploader-in-attachment/file-item.tsx b/web/app/components/base/file-uploader/file-uploader-in-attachment/file-item.tsx index be81c8ea4a..4b889bc6e8 100644 --- a/web/app/components/base/file-uploader/file-uploader-in-attachment/file-item.tsx +++ b/web/app/components/base/file-uploader/file-uploader-in-attachment/file-item.tsx @@ -5,6 +5,7 @@ import { } from '@remixicon/react' import FileTypeIcon from '../file-type-icon' import { + fileIsUploaded, getFileAppearanceType, getFileExtension, } from '../utils' @@ -81,7 +82,7 @@ const FileInAttachmentItem = ({
{ - progress >= 0 && !file.uploadedId && ( + progress >= 0 && !fileIsUploaded(file) && ( { - progress > 0 && progress < 100 && ( + progress >= 0 && !fileIsUploaded(file) && (
= 0 && !file.uploadedId && ( + progress >= 0 && !fileIsUploaded(file) && ( { }).filter(Boolean)).filter(item => item?.model_identity === '__dify__file__') return getProcessedFilesFromResponse(originalFiles) } + +export const fileIsUploaded = (file: FileEntity) => { + const localFileUploaded = file.transferMethod === TransferMethod.local_file && file.uploadedId + const fromUrlFileUploaded = file.transferMethod === TransferMethod.remote_url && file.progress === 100 + + return localFileUploaded || fromUrlFileUploaded +} diff --git a/web/app/components/workflow/panel/inputs-panel.tsx b/web/app/components/workflow/panel/inputs-panel.tsx index ac83e69ee0..f08155c7b0 100644 --- a/web/app/components/workflow/panel/inputs-panel.tsx +++ b/web/app/components/workflow/panel/inputs-panel.tsx @@ -20,6 +20,9 @@ import type { StartNodeType } from '../nodes/start/types' import { TransferMethod } from '../../base/text-generation/types' import Button from '@/app/components/base/button' import { useFeatures } from '@/app/components/base/features/hooks' +import { + getProcessedInputs, +} from '@/app/components/base/chat/chat/utils' type Props = { onRun: () => void @@ -76,8 +79,8 @@ const InputsPanel = ({ onRun }: Props) => { const doRun = useCallback(() => { onRun() - handleRun({ inputs, files }) - }, [files, handleRun, inputs, onRun]) + handleRun({ inputs: getProcessedInputs(inputs, variables as any), files }) + }, [files, handleRun, inputs, onRun, variables]) const canRun = useMemo(() => { if (files?.some(item => (item.transfer_method as any) === TransferMethod.local_file && !item.upload_file_id))