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
accc5faa
Unverified
Commit
accc5faa
authored
Jun 28, 2023
by
Joel
Committed by
GitHub
Jun 28, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: delete dataset not trigger show start new conversation message (#471)
parent
0462f09e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
28 additions
and
25 deletions
+28
-25
index.tsx
...app/components/app/configuration/dataset-config/index.tsx
+28
-25
No files found.
web/app/components/app/configuration/dataset-config/index.tsx
View file @
accc5faa
'use client'
'use client'
import
React
,
{
FC
}
from
'react'
import
type
{
FC
}
from
'react'
import
React
from
'react'
import
{
useTranslation
}
from
'react-i18next'
import
{
useTranslation
}
from
'react-i18next'
import
{
useContext
}
from
'use-context-selector'
import
{
useContext
}
from
'use-context-selector'
import
ConfigContext
from
'@/context/debug-configuration'
import
{
useBoolean
}
from
'ahooks'
import
{
isEqual
}
from
'lodash-es'
import
FeaturePanel
from
'../base/feature-panel'
import
FeaturePanel
from
'../base/feature-panel'
import
OperationBtn
from
'../base/operation-btn'
import
OperationBtn
from
'../base/operation-btn'
import
CardItem
from
'./card-item'
import
CardItem
from
'./card-item'
import
{
useBoolean
}
from
'ahooks'
import
SelectDataSet
from
'./select-dataset'
import
SelectDataSet
from
'./select-dataset'
import
{
DataSet
}
from
'@/models/datasets
'
import
ConfigContext
from
'@/context/debug-configuration
'
import
{
isEqual
}
from
'lodash-e
s'
import
type
{
DataSet
}
from
'@/models/dataset
s'
const
Icon
=
(
const
Icon
=
(
<
svg
width=
"24"
height=
"24"
viewBox=
"0 0 24 24"
fill=
"none"
xmlns=
"http://www.w3.org/2000/svg"
>
<
svg
width=
"24"
height=
"24"
viewBox=
"0 0 24 24"
fill=
"none"
xmlns=
"http://www.w3.org/2000/svg"
>
...
@@ -23,25 +24,25 @@ const DatasetConfig: FC = () => {
...
@@ -23,25 +24,25 @@ const DatasetConfig: FC = () => {
const
{
const
{
dataSets
:
dataSet
,
dataSets
:
dataSet
,
setDataSets
:
setDataSet
,
setDataSets
:
setDataSet
,
setFormattingChanged
setFormattingChanged
,
}
=
useContext
(
ConfigContext
)
}
=
useContext
(
ConfigContext
)
const
selectedIds
=
dataSet
.
map
(
(
item
)
=>
item
.
id
)
const
selectedIds
=
dataSet
.
map
(
item
=>
item
.
id
)
const
hasData
=
dataSet
.
length
>
0
const
hasData
=
dataSet
.
length
>
0
const
[
isShowSelectDataSet
,
{
setTrue
:
showSelectDataSet
,
setFalse
:
hideSelectDataSet
}]
=
useBoolean
(
false
)
const
[
isShowSelectDataSet
,
{
setTrue
:
showSelectDataSet
,
setFalse
:
hideSelectDataSet
}]
=
useBoolean
(
false
)
const
handleSelect
=
(
data
:
DataSet
[])
=>
{
const
handleSelect
=
(
data
:
DataSet
[])
=>
{
if
(
isEqual
(
data
,
dataSet
))
{
if
(
isEqual
(
data
,
dataSet
))
hideSelectDataSet
()
hideSelectDataSet
()
}
setFormattingChanged
(
true
)
setFormattingChanged
(
true
)
setDataSet
(
data
)
setDataSet
(
data
)
hideSelectDataSet
()
hideSelectDataSet
()
}
}
const
onRemove
=
(
id
:
string
)
=>
{
const
onRemove
=
(
id
:
string
)
=>
{
setDataSet
(
dataSet
.
filter
((
item
)
=>
item
.
id
!==
id
))
setDataSet
(
dataSet
.
filter
(
item
=>
item
.
id
!==
id
))
setFormattingChanged
(
true
)
}
}
return
(
return
(
<
FeaturePanel
<
FeaturePanel
className=
'mt-3'
className=
'mt-3'
...
@@ -50,20 +51,22 @@ const DatasetConfig: FC = () => {
...
@@ -50,20 +51,22 @@ const DatasetConfig: FC = () => {
headerRight=
{
<
OperationBtn
type=
"add"
onClick=
{
showSelectDataSet
}
/>
}
headerRight=
{
<
OperationBtn
type=
"add"
onClick=
{
showSelectDataSet
}
/>
}
hasHeaderBottomBorder=
{
!
hasData
}
hasHeaderBottomBorder=
{
!
hasData
}
>
>
{
hasData
?
(
{
hasData
<
div
className=
'flex flex-wrap justify-between'
>
?
(
{
dataSet
.
map
((
item
)
=>
(
<
div
className=
'flex flex-wrap justify-between'
>
<
CardItem
{
dataSet
.
map
(
item
=>
(
className=
"mb-2"
<
CardItem
key=
{
item
.
id
}
className=
"mb-2"
config=
{
item
}
key=
{
item
.
id
}
onRemove=
{
onRemove
}
config=
{
item
}
/>
onRemove=
{
onRemove
}
))
}
/>
</
div
>
))
}
)
:
(
</
div
>
<
div
className=
'pt-2 pb-1 text-xs text-gray-500'
>
{
t
(
'appDebug.feature.dataSet.noData'
)
}
</
div
>
)
)
}
:
(
<
div
className=
'pt-2 pb-1 text-xs text-gray-500'
>
{
t
(
'appDebug.feature.dataSet.noData'
)
}
</
div
>
)
}
{
isShowSelectDataSet
&&
(
{
isShowSelectDataSet
&&
(
<
SelectDataSet
<
SelectDataSet
...
...
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