Skip to content

armgit / dify

Public Imported from GitHub
0

Build Agentic workflows, RAG pipelines, with rich AI model and tool support on one collaborative workspace. Deploy on cloud, VPC, or self-hosted, so teams move from prototype to production without rebuilding the stack.

fix: can not upload file in single run (#32276)

Stephen Zhou8fd3eeb76022
diff --git a/web/app/components/base/file-uploader/store.tsx b/web/app/components/base/file-uploader/store.tsx
index 24015df5cff..b281a9de8fb 100644
--- a/web/app/components/base/file-uploader/store.tsx
+++ b/web/app/components/base/file-uploader/store.tsx
@@ -1,11 +1,9 @@
import type {
FileEntity,
} from './types'
-import { isEqual } from 'es-toolkit/predicate'
import {
createContext,
useContext,
- useEffect,
useRef,
} from 'react'
import {
@@ -57,20 +55,10 @@ export const FileContextProvider = ({
onChange,
}: FileProviderProps) => {
const storeRef = useRef<FileStore | undefined>(undefined)
+
if (!storeRef.current)
storeRef.current = createFileStore(value, onChange)
- useEffect(() => {
- if (!storeRef.current)
- return
- if (isEqual(value, storeRef.current.getState().files))
- return
-
- storeRef.current.setState({
- files: value ? [...value] : [],
- })
- }, [value])
-
return (
<FileContext.Provider value={storeRef.current}>
{children}
diff --git a/web/app/components/workflow/nodes/_base/components/before-run-form/form-item.tsx b/web/app/components/workflow/nodes/_base/components/before-run-form/form-item.tsx
index d66d47cc1f5..e45c9dbd95a 100644
--- a/web/app/components/workflow/nodes/_base/components/before-run-form/form-item.tsx
+++ b/web/app/components/workflow/nodes/_base/components/before-run-form/form-item.tsx
@@ -108,7 +108,7 @@ const FormItem: FC<Props> = ({
const isIteratorItemFile = isIterator && payload.isFileItem
const singleFileValue = useMemo(() => {
if (payload.variable === '#files#')
- return value?.[0] || []
+ return value || []
return value ? [value] : []
}, [payload.variable, value])
@@ -124,19 +124,19 @@ const FormItem: FC<Props> = ({
return (
<div className={cn(className)}>
{!isArrayLikeType && !isBooleanType && (
- <div className="system-sm-semibold mb-1 flex h-6 items-center gap-1 text-text-secondary">
+ <div className="mb-1 flex h-6 items-center gap-1 text-text-secondary system-sm-semibold">
<div className="truncate">
{typeof payload.label === 'object' ? nodeKey : payload.label}
</div>
{payload.hide === true
? (
- <span className="system-xs-regular text-text-tertiary">
+ <span className="text-text-tertiary system-xs-regular">
{t('panel.optional_and_hidden', { ns: 'workflow' })}
</span>
)
: (
!payload.required && (
- <span className="system-xs-regular text-text-tertiary">
+ <span className="text-text-tertiary system-xs-regular">
{t('panel.optional', { ns: 'workflow' })}
</span>
)
diff --git a/web/eslint-suppressions.json b/web/eslint-suppressions.json
index 90571e49472..f55a49c5642 100644
--- a/web/eslint-suppressions.json
+++ b/web/eslint-suppressions.json
@@ -4102,11 +4102,6 @@
"count": 1
}
},
- "app/components/explore/app-card/index.spec.tsx": {
- "ts/no-explicit-any": {
- "count": 1
- }
- },
"app/components/explore/app-card/index.tsx": {
"tailwindcss/enforce-consistent-class-order": {
"count": 1
@@ -6201,9 +6196,6 @@
}
},
"app/components/workflow/nodes/_base/components/before-run-form/form-item.tsx": {
- "tailwindcss/enforce-consistent-class-order": {
- "count": 3
- },
"ts/no-explicit-any": {
"count": 11
}