Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
D
dify
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ai-tech
dify
Commits
9730b243
Commit
9730b243
authored
Feb 23, 2024
by
Joel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: can pass multi files
parent
818c0ce8
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
29 additions
and
22 deletions
+29
-22
index.tsx
web/app/components/datasets/create/file-uploader/index.tsx
+29
-22
No files found.
web/app/components/datasets/create/file-uploader/index.tsx
View file @
9730b243
...
...
@@ -42,6 +42,7 @@ const FileUploader = ({
const
dropRef
=
useRef
<
HTMLDivElement
>
(
null
)
const
dragRef
=
useRef
<
HTMLDivElement
>
(
null
)
const
fileUploader
=
useRef
<
HTMLInputElement
>
(
null
)
const
hideUpload
=
notSupportBatchUpload
&&
fileList
.
length
>
0
const
{
data
:
fileUploadConfigResponse
}
=
useSWR
({
url
:
'/files/upload'
},
fetchFileUploadConfig
)
const
{
data
:
supportFileTypesResponse
}
=
useSWR
({
url
:
'/files/support-type'
},
fetchSupportFileTypes
)
...
...
@@ -254,30 +255,36 @@ const FileUploader = ({
return
(
<
div
className=
{
s
.
fileUploader
}
>
<
input
ref=
{
fileUploader
}
id=
"fileUploader"
style=
{
{
display
:
'none'
}
}
type=
"file"
multiple=
{
!
notSupportBatchUpload
}
accept=
{
ACCEPTS
.
join
(
','
)
}
onChange=
{
fileChangeHandle
}
/>
{
!
hideUpload
&&
(
<
input
ref=
{
fileUploader
}
id=
"fileUploader"
style=
{
{
display
:
'none'
}
}
type=
"file"
multiple=
{
!
notSupportBatchUpload
}
accept=
{
ACCEPTS
.
join
(
','
)
}
onChange=
{
fileChangeHandle
}
/>
)
}
<
div
className=
{
cn
(
s
.
title
,
titleClassName
)
}
>
{
t
(
'datasetCreation.stepOne.uploader.title'
)
}
</
div
>
<
div
ref=
{
dropRef
}
className=
{
cn
(
s
.
uploader
,
dragging
&&
s
.
dragging
)
}
>
<
div
className=
'flex justify-center items-center min-h-6 mb-2'
>
<
span
className=
{
s
.
uploadIcon
}
/>
<
span
>
{
t
(
'datasetCreation.stepOne.uploader.button'
)
}
<
label
className=
{
s
.
browse
}
onClick=
{
selectHandle
}
>
{
t
(
'datasetCreation.stepOne.uploader.browse'
)
}
</
label
>
</
span
>
{
!
hideUpload
&&
(
<
div
ref=
{
dropRef
}
className=
{
cn
(
s
.
uploader
,
dragging
&&
s
.
dragging
)
}
>
<
div
className=
'flex justify-center items-center min-h-6 mb-2'
>
<
span
className=
{
s
.
uploadIcon
}
/>
<
span
>
{
t
(
'datasetCreation.stepOne.uploader.button'
)
}
<
label
className=
{
s
.
browse
}
onClick=
{
selectHandle
}
>
{
t
(
'datasetCreation.stepOne.uploader.browse'
)
}
</
label
>
</
span
>
</
div
>
<
div
className=
{
s
.
tip
}
>
{
t
(
'datasetCreation.stepOne.uploader.tip'
,
{
size
:
fileUploadConfig
.
file_size_limit
,
supportTypes
:
supportTypesShowNames
,
})
}
</
div
>
{
dragging
&&
<
div
ref=
{
dragRef
}
className=
{
s
.
draggingCover
}
/>
}
</
div
>
<
div
className=
{
s
.
tip
}
>
{
t
(
'datasetCreation.stepOne.uploader.tip'
,
{
size
:
fileUploadConfig
.
file_size_limit
,
supportTypes
:
supportTypesShowNames
,
})
}
</
div
>
{
dragging
&&
<
div
ref=
{
dragRef
}
className=
{
s
.
draggingCover
}
/>
}
</
div
>
)
}
<
div
className=
{
s
.
fileList
}
>
{
fileList
.
map
((
fileItem
,
index
)
=>
(
<
div
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment