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
841e967d
Unverified
Commit
841e967d
authored
Sep 24, 2023
by
KVOJJJin
Committed by
GitHub
Sep 24, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix: add loading for dataset creation (#1214)
parent
9df0dced
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
4 deletions
+9
-4
index.tsx
web/app/components/datasets/create/step-two/index.tsx
+9
-4
No files found.
web/app/components/datasets/create/step-two/index.tsx
View file @
841e967d
...
@@ -107,6 +107,7 @@ const StepTwo = ({
...
@@ -107,6 +107,7 @@ const StepTwo = ({
const
fileIndexingEstimate
=
(()
=>
{
const
fileIndexingEstimate
=
(()
=>
{
return
segmentationType
===
SegmentType
.
AUTO
?
automaticFileIndexingEstimate
:
customFileIndexingEstimate
return
segmentationType
===
SegmentType
.
AUTO
?
automaticFileIndexingEstimate
:
customFileIndexingEstimate
})()
})()
const
[
isCreating
,
setIsCreating
]
=
useState
(
false
)
const
scrollHandle
=
(
e
:
Event
)
=>
{
const
scrollHandle
=
(
e
:
Event
)
=>
{
if
((
e
.
target
as
HTMLDivElement
).
scrollTop
>
0
)
if
((
e
.
target
as
HTMLDivElement
).
scrollTop
>
0
)
...
@@ -277,7 +278,7 @@ const StepTwo = ({
...
@@ -277,7 +278,7 @@ const StepTwo = ({
}
as
CreateDocumentReq
}
as
CreateDocumentReq
if
(
dataSourceType
===
DataSourceType
.
FILE
)
{
if
(
dataSourceType
===
DataSourceType
.
FILE
)
{
params
.
data_source
.
info_list
.
file_info_list
=
{
params
.
data_source
.
info_list
.
file_info_list
=
{
file_ids
:
files
.
map
(
file
=>
file
.
id
),
file_ids
:
files
.
map
(
file
=>
file
.
id
||
''
).
filter
(
Boolean
),
}
}
}
}
if
(
dataSourceType
===
DataSourceType
.
NOTION
)
if
(
dataSourceType
===
DataSourceType
.
NOTION
)
...
@@ -321,6 +322,7 @@ const StepTwo = ({
...
@@ -321,6 +322,7 @@ const StepTwo = ({
try
{
try
{
let
res
let
res
const
params
=
getCreationParams
()
const
params
=
getCreationParams
()
setIsCreating
(
true
)
if
(
!
datasetId
)
{
if
(
!
datasetId
)
{
res
=
await
createFirstDocument
({
res
=
await
createFirstDocument
({
body
:
params
,
body
:
params
,
...
@@ -347,6 +349,9 @@ const StepTwo = ({
...
@@ -347,6 +349,9 @@ const StepTwo = ({
message
:
`
${
err
}
`
,
message
:
`
${
err
}
`
,
})
})
}
}
finally
{
setIsCreating
(
false
)
}
}
}
const
handleSwitch
=
(
state
:
boolean
)
=>
{
const
handleSwitch
=
(
state
:
boolean
)
=>
{
...
@@ -622,7 +627,7 @@ const StepTwo = ({
...
@@ -622,7 +627,7 @@ const StepTwo = ({
<>
<>
<
div
className=
'mb-2 text-xs font-medium text-gray-500'
>
{
t
(
'datasetCreation.stepTwo.fileSource'
)
}
</
div
>
<
div
className=
'mb-2 text-xs font-medium text-gray-500'
>
{
t
(
'datasetCreation.stepTwo.fileSource'
)
}
</
div
>
<
div
className=
'flex items-center text-sm leading-6 font-medium text-gray-800'
>
<
div
className=
'flex items-center text-sm leading-6 font-medium text-gray-800'
>
<
span
className=
{
cn
(
s
.
fileIcon
,
files
.
length
&&
s
[
files
[
0
].
extension
])
}
/>
<
span
className=
{
cn
(
s
.
fileIcon
,
files
.
length
&&
s
[
files
[
0
].
extension
||
''
])
}
/>
{
getFileName
(
files
[
0
].
name
||
''
)
}
{
getFileName
(
files
[
0
].
name
||
''
)
}
{
files
.
length
>
1
&&
(
{
files
.
length
>
1
&&
(
<
span
className=
{
s
.
sourceCount
}
>
<
span
className=
{
s
.
sourceCount
}
>
...
@@ -676,12 +681,12 @@ const StepTwo = ({
...
@@ -676,12 +681,12 @@ const StepTwo = ({
<
div
className=
'flex items-center mt-8 py-2'
>
<
div
className=
'flex items-center mt-8 py-2'
>
<
Button
onClick=
{
()
=>
onStepChange
&&
onStepChange
(
-
1
)
}
>
{
t
(
'datasetCreation.stepTwo.lastStep'
)
}
</
Button
>
<
Button
onClick=
{
()
=>
onStepChange
&&
onStepChange
(
-
1
)
}
>
{
t
(
'datasetCreation.stepTwo.lastStep'
)
}
</
Button
>
<
div
className=
{
s
.
divider
}
/>
<
div
className=
{
s
.
divider
}
/>
<
Button
type=
'primary'
onClick=
{
createHandle
}
>
{
t
(
'datasetCreation.stepTwo.nextStep'
)
}
</
Button
>
<
Button
loading=
{
isCreating
}
type=
'primary'
onClick=
{
createHandle
}
>
{
t
(
'datasetCreation.stepTwo.nextStep'
)
}
</
Button
>
</
div
>
</
div
>
)
)
:
(
:
(
<
div
className=
'flex items-center mt-8 py-2'
>
<
div
className=
'flex items-center mt-8 py-2'
>
<
Button
type=
'primary'
onClick=
{
createHandle
}
>
{
t
(
'datasetCreation.stepTwo.save'
)
}
</
Button
>
<
Button
loading=
{
isCreating
}
type=
'primary'
onClick=
{
createHandle
}
>
{
t
(
'datasetCreation.stepTwo.save'
)
}
</
Button
>
<
Button
className=
'ml-2'
onClick=
{
onCancel
}
>
{
t
(
'datasetCreation.stepTwo.cancel'
)
}
</
Button
>
<
Button
className=
'ml-2'
onClick=
{
onCancel
}
>
{
t
(
'datasetCreation.stepTwo.cancel'
)
}
</
Button
>
</
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