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
8dec4061
Unverified
Commit
8dec4061
authored
Dec 19, 2023
by
Joel
Committed by
GitHub
Dec 19, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
chore: enchance ext name (#1787)
parent
58f8d745
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
33 additions
and
1 deletion
+33
-1
index.tsx
web/app/components/datasets/create/file-uploader/index.tsx
+33
-1
No files found.
web/app/components/datasets/create/file-uploader/index.tsx
View file @
8dec4061
...
@@ -41,6 +41,38 @@ const FileUploader = ({
...
@@ -41,6 +41,38 @@ const FileUploader = ({
const
{
data
:
fileUploadConfigResponse
}
=
useSWR
({
url
:
'/files/upload'
},
fetchFileUploadConfig
)
const
{
data
:
fileUploadConfigResponse
}
=
useSWR
({
url
:
'/files/upload'
},
fetchFileUploadConfig
)
const
{
data
:
supportFileTypesResponse
}
=
useSWR
({
url
:
'/files/support-type'
},
fetchSupportFileTypes
)
const
{
data
:
supportFileTypesResponse
}
=
useSWR
({
url
:
'/files/support-type'
},
fetchSupportFileTypes
)
const
supportTypes
=
supportFileTypesResponse
?.
allowed_extensions
||
[]
const
supportTypes
=
supportFileTypesResponse
?.
allowed_extensions
||
[]
const
supportTypesShowNames
=
(()
=>
{
let
res
=
[...
supportTypes
]
if
(
res
.
includes
(
'markdown'
)
&&
res
.
includes
(
'md'
))
res
=
res
.
filter
(
item
=>
item
!==
'md'
)
if
(
res
.
includes
(
'pptx'
)
&&
res
.
includes
(
'ppt'
))
res
=
res
.
filter
(
item
=>
item
!==
'ppt'
)
if
(
res
.
includes
(
'html'
)
&&
res
.
includes
(
'htm'
))
res
=
res
.
filter
(
item
=>
item
!==
'htm'
)
res
=
res
.
map
((
item
)
=>
{
if
(
item
===
'md'
)
return
'markdown'
if
(
item
===
'pptx'
)
return
'ppt'
if
(
item
===
'htm'
)
return
'html'
if
(
item
===
'xlsx'
)
return
'xls'
if
(
item
===
'docx'
)
return
'doc'
return
item
})
return
res
.
map
(
item
=>
item
.
toUpperCase
()).
join
(
locale
===
'en'
?
', '
:
'、 '
)
})()
const
ACCEPTS
=
supportTypes
.
map
((
ext
:
string
)
=>
`.
${
ext
}
`
)
const
ACCEPTS
=
supportTypes
.
map
((
ext
:
string
)
=>
`.
${
ext
}
`
)
const
fileUploadConfig
=
useMemo
(()
=>
fileUploadConfigResponse
??
{
const
fileUploadConfig
=
useMemo
(()
=>
fileUploadConfigResponse
??
{
file_size_limit
:
15
,
file_size_limit
:
15
,
...
@@ -230,7 +262,7 @@ const FileUploader = ({
...
@@ -230,7 +262,7 @@ const FileUploader = ({
</
div
>
</
div
>
<
div
className=
{
s
.
tip
}
>
{
t
(
'datasetCreation.stepOne.uploader.tip'
,
{
<
div
className=
{
s
.
tip
}
>
{
t
(
'datasetCreation.stepOne.uploader.tip'
,
{
size
:
fileUploadConfig
.
file_size_limit
,
size
:
fileUploadConfig
.
file_size_limit
,
supportTypes
:
supportTypes
.
map
(
item
=>
item
.
toUpperCase
()).
join
(
locale
===
'en'
?
', '
:
'、 '
)
,
supportTypes
:
supportTypes
ShowNames
,
})
}
</
div
>
})
}
</
div
>
{
dragging
&&
<
div
ref=
{
dragRef
}
className=
{
s
.
draggingCover
}
/>
}
{
dragging
&&
<
div
ref=
{
dragRef
}
className=
{
s
.
draggingCover
}
/>
}
</
div
>
</
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