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
91bcbd0b
Unverified
Commit
91bcbd0b
authored
May 30, 2023
by
Joel
Committed by
GitHub
May 30, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: svg attr in ts file (#260)
parent
54bb309d
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
182 additions
and
178 deletions
+182
-178
layout.tsx
...ut)/datasets/(datasetDetailLayout)/[datasetId]/layout.tsx
+34
-32
basic.tsx
web/app/components/app-sidebar/basic.tsx
+13
-13
index.tsx
web/app/components/app/log/index.tsx
+10
-10
index.tsx
...omponents/app/text-generate/saved-items/no-data/index.tsx
+7
-6
index.tsx
web/app/components/base/input/index.tsx
+1
-1
index.tsx
.../components/datasets/documents/detail/embedding/index.tsx
+43
-43
index.tsx
web/app/components/datasets/documents/index.tsx
+4
-5
list.tsx
web/app/components/datasets/documents/list.tsx
+36
-34
index.tsx
web/app/components/explore/app-card/index.tsx
+9
-10
index.tsx
web/app/components/explore/sidebar/index.tsx
+25
-24
No files found.
web/app/(commonLayout)/datasets/(datasetDetailLayout)/[datasetId]/layout.tsx
View file @
91bcbd0b
'use client'
'use client'
import
type
{
FC
}
from
'react'
import
type
{
FC
}
from
'react'
import
React
,
{
useEffect
}
from
'react'
import
React
,
{
useEffect
}
from
'react'
import
{
usePathname
,
useSelectedLayoutSegments
}
from
'next/navigation'
import
{
usePathname
}
from
'next/navigation'
import
useSWR
from
'swr'
import
useSWR
from
'swr'
import
{
useTranslation
}
from
'react-i18next'
import
{
useTranslation
}
from
'react-i18next'
import
{
getLocaleOnClient
}
from
'@/i18n/client'
import
{
import
{
Cog8ToothIcon
,
Cog8ToothIcon
,
// CommandLineIcon,
// CommandLineIcon,
Squares2X2Icon
,
Squares2X2Icon
,
// eslint-disable-next-line sort-imports
PuzzlePieceIcon
,
PuzzlePieceIcon
,
DocumentTextIcon
,
DocumentTextIcon
,
}
from
'@heroicons/react/24/outline'
}
from
'@heroicons/react/24/outline'
...
@@ -18,9 +18,10 @@ import {
...
@@ -18,9 +18,10 @@ import {
DocumentTextIcon
as
DocumentTextSolidIcon
,
DocumentTextIcon
as
DocumentTextSolidIcon
,
}
from
'@heroicons/react/24/solid'
}
from
'@heroicons/react/24/solid'
import
Link
from
'next/link'
import
Link
from
'next/link'
import
s
from
'./style.module.css'
import
{
fetchDataDetail
,
fetchDatasetRelatedApps
}
from
'@/service/datasets'
import
{
fetchDataDetail
,
fetchDatasetRelatedApps
}
from
'@/service/datasets'
import
type
{
RelatedApp
}
from
'@/models/datasets'
import
type
{
RelatedApp
}
from
'@/models/datasets'
import
s
from
'./style.module.css
'
import
{
getLocaleOnClient
}
from
'@/i18n/client
'
import
AppSideBar
from
'@/app/components/app-sidebar'
import
AppSideBar
from
'@/app/components/app-sidebar'
import
Divider
from
'@/app/components/base/divider'
import
Divider
from
'@/app/components/base/divider'
import
Indicator
from
'@/app/components/header/indicator'
import
Indicator
from
'@/app/components/header/indicator'
...
@@ -38,7 +39,7 @@ export type IAppDetailLayoutProps = {
...
@@ -38,7 +39,7 @@ export type IAppDetailLayoutProps = {
const
LikedItem
:
FC
<
{
type
?:
'plugin'
|
'app'
;
appStatus
?:
boolean
;
detail
:
RelatedApp
}
>
=
({
const
LikedItem
:
FC
<
{
type
?:
'plugin'
|
'app'
;
appStatus
?:
boolean
;
detail
:
RelatedApp
}
>
=
({
type
=
'app'
,
type
=
'app'
,
appStatus
=
true
,
appStatus
=
true
,
detail
detail
,
})
=>
{
})
=>
{
return
(
return
(
<
Link
prefetch
className=
{
s
.
itemWrapper
}
href=
{
`/app/${detail?.id}/overview`
}
>
<
Link
prefetch
className=
{
s
.
itemWrapper
}
href=
{
`/app/${detail?.id}/overview`
}
>
...
@@ -58,7 +59,7 @@ const LikedItem: FC<{ type?: 'plugin' | 'app'; appStatus?: boolean; detail: Rela
...
@@ -58,7 +59,7 @@ const LikedItem: FC<{ type?: 'plugin' | 'app'; appStatus?: boolean; detail: Rela
const
TargetIcon
:
FC
<
{
className
?:
string
}
>
=
({
className
})
=>
{
const
TargetIcon
:
FC
<
{
className
?:
string
}
>
=
({
className
})
=>
{
return
<
svg
width=
"16"
height=
"16"
viewBox=
"0 0 16 16"
fill=
"none"
xmlns=
"http://www.w3.org/2000/svg"
className=
{
className
??
''
}
>
return
<
svg
width=
"16"
height=
"16"
viewBox=
"0 0 16 16"
fill=
"none"
xmlns=
"http://www.w3.org/2000/svg"
className=
{
className
??
''
}
>
<
g
clip
-
path=
"url(#clip0_4610_6951)"
>
<
g
clip
-
path=
"url(#clip0_4610_6951)"
>
<
path
d=
"M10.6666 5.33325V3.33325L12.6666 1.33325L13.3332 2.66659L14.6666 3.33325L12.6666 5.33325H10.6666ZM10.6666 5.33325L7.9999 7.99988M14.6666 7.99992C14.6666 11.6818 11.6818 14.6666 7.99992 14.6666C4.31802 14.6666 1.33325 11.6818 1.33325 7.99992C1.33325 4.31802 4.31802 1.33325 7.99992 1.33325M11.3333 7.99992C11.3333 9.84087 9.84087 11.3333 7.99992 11.3333C6.15897 11.3333 4.66659 9.84087 4.66659 7.99992C4.66659 6.15897 6.15897 4.66659 7.99992 4.66659"
stroke=
"#344054"
stroke
-
width=
"1.25"
stroke
-
linecap=
"round"
stroke
-
l
inejoin=
"round"
/>
<
path
d=
"M10.6666 5.33325V3.33325L12.6666 1.33325L13.3332 2.66659L14.6666 3.33325L12.6666 5.33325H10.6666ZM10.6666 5.33325L7.9999 7.99988M14.6666 7.99992C14.6666 11.6818 11.6818 14.6666 7.99992 14.6666C4.31802 14.6666 1.33325 11.6818 1.33325 7.99992C1.33325 4.31802 4.31802 1.33325 7.99992 1.33325M11.3333 7.99992C11.3333 9.84087 9.84087 11.3333 7.99992 11.3333C6.15897 11.3333 4.66659 9.84087 4.66659 7.99992C4.66659 6.15897 6.15897 4.66659 7.99992 4.66659"
stroke=
"#344054"
stroke
Width=
"1.25"
strokeLinecap=
"round"
strokeL
inejoin=
"round"
/>
</
g
>
</
g
>
<
defs
>
<
defs
>
<
clipPath
id=
"clip0_4610_6951"
>
<
clipPath
id=
"clip0_4610_6951"
>
...
@@ -79,7 +80,7 @@ const TargetSolidIcon: FC<{ className?: string }> = ({ className }) => {
...
@@ -79,7 +80,7 @@ const TargetSolidIcon: FC<{ className?: string }> = ({ className }) => {
const
BookOpenIcon
:
FC
<
{
className
?:
string
}
>
=
({
className
})
=>
{
const
BookOpenIcon
:
FC
<
{
className
?:
string
}
>
=
({
className
})
=>
{
return
<
svg
width=
"12"
height=
"12"
viewBox=
"0 0 12 12"
fill=
"none"
xmlns=
"http://www.w3.org/2000/svg"
className=
{
className
??
''
}
>
return
<
svg
width=
"12"
height=
"12"
viewBox=
"0 0 12 12"
fill=
"none"
xmlns=
"http://www.w3.org/2000/svg"
className=
{
className
??
''
}
>
<
path
opacity=
"0.12"
d=
"M1 3.1C1 2.53995 1 2.25992 1.10899 2.04601C1.20487 1.85785 1.35785 1.70487 1.54601 1.60899C1.75992 1.5 2.03995 1.5 2.6 1.5H2.8C3.9201 1.5 4.48016 1.5 4.90798 1.71799C5.28431 1.90973 5.59027 2.21569 5.78201 2.59202C6 3.01984 6 3.5799 6 4.7V10.5L5.94997 10.425C5.60265 9.90398 5.42899 9.64349 5.19955 9.45491C4.99643 9.28796 4.76238 9.1627 4.5108 9.0863C4.22663 9 3.91355 9 3.28741 9H2.6C2.03995 9 1.75992 9 1.54601 8.89101C1.35785 8.79513 1.20487 8.64215 1.10899 8.45399C1 8.24008 1 7.96005 1 7.4V3.1Z"
fill=
"#155EEF"
/>
<
path
opacity=
"0.12"
d=
"M1 3.1C1 2.53995 1 2.25992 1.10899 2.04601C1.20487 1.85785 1.35785 1.70487 1.54601 1.60899C1.75992 1.5 2.03995 1.5 2.6 1.5H2.8C3.9201 1.5 4.48016 1.5 4.90798 1.71799C5.28431 1.90973 5.59027 2.21569 5.78201 2.59202C6 3.01984 6 3.5799 6 4.7V10.5L5.94997 10.425C5.60265 9.90398 5.42899 9.64349 5.19955 9.45491C4.99643 9.28796 4.76238 9.1627 4.5108 9.0863C4.22663 9 3.91355 9 3.28741 9H2.6C2.03995 9 1.75992 9 1.54601 8.89101C1.35785 8.79513 1.20487 8.64215 1.10899 8.45399C1 8.24008 1 7.96005 1 7.4V3.1Z"
fill=
"#155EEF"
/>
<
path
d=
"M6 10.5L5.94997 10.425C5.60265 9.90398 5.42899 9.64349 5.19955 9.45491C4.99643 9.28796 4.76238 9.1627 4.5108 9.0863C4.22663 9 3.91355 9 3.28741 9H2.6C2.03995 9 1.75992 9 1.54601 8.89101C1.35785 8.79513 1.20487 8.64215 1.10899 8.45399C1 8.24008 1 7.96005 1 7.4V3.1C1 2.53995 1 2.25992 1.10899 2.04601C1.20487 1.85785 1.35785 1.70487 1.54601 1.60899C1.75992 1.5 2.03995 1.5 2.6 1.5H2.8C3.9201 1.5 4.48016 1.5 4.90798 1.71799C5.28431 1.90973 5.59027 2.21569 5.78201 2.59202C6 3.01984 6 3.5799 6 4.7M6 10.5V4.7M6 10.5L6.05003 10.425C6.39735 9.90398 6.57101 9.64349 6.80045 9.45491C7.00357 9.28796 7.23762 9.1627 7.4892 9.0863C7.77337 9 8.08645 9 8.71259 9H9.4C9.96005 9 10.2401 9 10.454 8.89101C10.6422 8.79513 10.7951 8.64215 10.891 8.45399C11 8.24008 11 7.96005 11 7.4V3.1C11 2.53995 11 2.25992 10.891 2.04601C10.7951 1.85785 10.6422 1.70487 10.454 1.60899C10.2401 1.5 9.96005 1.5 9.4 1.5H9.2C8.07989 1.5 7.51984 1.5 7.09202 1.71799C6.71569 1.90973 6.40973 2.21569 6.21799 2.59202C6 3.01984 6 3.5799 6 4.7"
stroke=
"#155EEF"
stroke
-
linecap=
"round"
stroke
-
l
inejoin=
"round"
/>
<
path
d=
"M6 10.5L5.94997 10.425C5.60265 9.90398 5.42899 9.64349 5.19955 9.45491C4.99643 9.28796 4.76238 9.1627 4.5108 9.0863C4.22663 9 3.91355 9 3.28741 9H2.6C2.03995 9 1.75992 9 1.54601 8.89101C1.35785 8.79513 1.20487 8.64215 1.10899 8.45399C1 8.24008 1 7.96005 1 7.4V3.1C1 2.53995 1 2.25992 1.10899 2.04601C1.20487 1.85785 1.35785 1.70487 1.54601 1.60899C1.75992 1.5 2.03995 1.5 2.6 1.5H2.8C3.9201 1.5 4.48016 1.5 4.90798 1.71799C5.28431 1.90973 5.59027 2.21569 5.78201 2.59202C6 3.01984 6 3.5799 6 4.7M6 10.5V4.7M6 10.5L6.05003 10.425C6.39735 9.90398 6.57101 9.64349 6.80045 9.45491C7.00357 9.28796 7.23762 9.1627 7.4892 9.0863C7.77337 9 8.08645 9 8.71259 9H9.4C9.96005 9 10.2401 9 10.454 8.89101C10.6422 8.79513 10.7951 8.64215 10.891 8.45399C11 8.24008 11 7.96005 11 7.4V3.1C11 2.53995 11 2.25992 10.891 2.04601C10.7951 1.85785 10.6422 1.70487 10.454 1.60899C10.2401 1.5 9.96005 1.5 9.4 1.5H9.2C8.07989 1.5 7.51984 1.5 7.09202 1.71799C6.71569 1.90973 6.40973 2.21569 6.21799 2.59202C6 3.01984 6 3.5799 6 4.7"
stroke=
"#155EEF"
stroke
Linecap=
"round"
strokeL
inejoin=
"round"
/>
</
svg
>
</
svg
>
}
}
...
@@ -109,9 +110,8 @@ const DatasetDetailLayout: FC<IAppDetailLayoutProps> = (props) => {
...
@@ -109,9 +110,8 @@ const DatasetDetailLayout: FC<IAppDetailLayoutProps> = (props) => {
]
]
useEffect
(()
=>
{
useEffect
(()
=>
{
if
(
datasetRes
)
{
if
(
datasetRes
)
document
.
title
=
`
${
datasetRes
.
name
||
'Dataset'
}
- Dify`
document
.
title
=
`
${
datasetRes
.
name
||
'Dataset'
}
- Dify`
}
},
[
datasetRes
])
},
[
datasetRes
])
const
ExtraInfo
:
FC
=
()
=>
{
const
ExtraInfo
:
FC
=
()
=>
{
...
@@ -119,32 +119,34 @@ const DatasetDetailLayout: FC<IAppDetailLayoutProps> = (props) => {
...
@@ -119,32 +119,34 @@ const DatasetDetailLayout: FC<IAppDetailLayoutProps> = (props) => {
return
<
div
className=
'w-full'
>
return
<
div
className=
'w-full'
>
<
Divider
className=
'mt-5'
/>
<
Divider
className=
'mt-5'
/>
{
relatedApps
?.
data
?.
length
?
(
{
relatedApps
?.
data
?.
length
<>
?
(
<
div
className=
{
s
.
subTitle
}
>
{
relatedApps
?.
total
||
'--'
}
{
t
(
'common.datasetMenus.relatedApp'
)
}
</
div
>
<>
{
relatedApps
?.
data
?.
map
((
item
)
=>
(<
LikedItem
detail=
{
item
}
/>))
}
<
div
className=
{
s
.
subTitle
}
>
{
relatedApps
?.
total
||
'--'
}
{
t
(
'common.datasetMenus.relatedApp'
)
}
</
div
>
</>
{
relatedApps
?.
data
?.
map
(
item
=>
(<
LikedItem
detail=
{
item
}
/>))
}
)
:
(
</>
<
div
className=
'mt-5 p-3'
>
)
<
div
className=
'flex items-center justify-start gap-2'
>
:
(
<
div
className=
{
s
.
emptyIconDiv
}
>
<
div
className=
'mt-5 p-3'
>
<
Squares2X2Icon
className=
'w-3 h-3 text-gray-500'
/>
<
div
className=
'flex items-center justify-start gap-2'
>
</
div
>
<
div
className=
{
s
.
emptyIconDiv
}
>
<
div
className=
{
s
.
emptyIconDiv
}
>
<
Squares2X2Icon
className=
'w-3 h-3 text-gray-500'
/>
<
PuzzlePieceIcon
className=
'w-3 h-3 text-gray-500'
/>
</
div
>
<
div
className=
{
s
.
emptyIconDiv
}
>
<
PuzzlePieceIcon
className=
'w-3 h-3 text-gray-500'
/>
</
div
>
</
div
>
</
div
>
<
div
className=
'text-xs text-gray-500 mt-2'
>
{
t
(
'common.datasetMenus.emptyTip'
)
}
</
div
>
<
a
className=
'inline-flex items-center text-xs text-primary-600 mt-2 cursor-pointer'
href=
{
`https://docs.dify.ai/${locale === 'en' ? '' : 'v/zh-hans'}/application/prompt-engineering`
}
target=
'_blank'
>
<
BookOpenIcon
className=
'mr-1'
/>
{
t
(
'common.datasetMenus.viewDoc'
)
}
</
a
>
</
div
>
</
div
>
<
div
className=
'text-xs text-gray-500 mt-2'
>
{
t
(
'common.datasetMenus.emptyTip'
)
}
</
div
>
)
}
<
a
className=
'inline-flex items-center text-xs text-primary-600 mt-2 cursor-pointer'
href=
{
`https://docs.dify.ai/${locale === 'en' ? '' : 'v/zh-hans'}/application/prompt-engineering`
}
target=
'_blank'
>
<
BookOpenIcon
className=
'mr-1'
/>
{
t
(
'common.datasetMenus.viewDoc'
)
}
</
a
>
</
div
>
)
}
</
div
>
</
div
>
}
}
...
...
web/app/components/app-sidebar/basic.tsx
View file @
91bcbd0b
...
@@ -15,8 +15,8 @@ export function randomString(length: number) {
...
@@ -15,8 +15,8 @@ export function randomString(length: number) {
export
type
IAppBasicProps
=
{
export
type
IAppBasicProps
=
{
iconType
?:
'app'
|
'api'
|
'dataset'
iconType
?:
'app'
|
'api'
|
'dataset'
icon
?:
string
,
icon
?:
string
icon_background
?:
string
,
icon_background
?:
string
name
:
string
name
:
string
type
:
string
|
React
.
ReactNode
type
:
string
|
React
.
ReactNode
hoverTip
?:
string
hoverTip
?:
string
...
@@ -24,12 +24,12 @@ export type IAppBasicProps = {
...
@@ -24,12 +24,12 @@ export type IAppBasicProps = {
}
}
const
AlgorithmSvg
=
<
svg
width=
"18"
height=
"18"
viewBox=
"0 0 18 18"
fill=
"none"
xmlns=
"http://www.w3.org/2000/svg"
>
const
AlgorithmSvg
=
<
svg
width=
"18"
height=
"18"
viewBox=
"0 0 18 18"
fill=
"none"
xmlns=
"http://www.w3.org/2000/svg"
>
<
path
d=
"M8.5 3.5C8.5 4.60457 9.39543 5.5 10.5 5.5C11.6046 5.5 12.5 4.60457 12.5 3.5C12.5 2.39543 11.6046 1.5 10.5 1.5C9.39543 1.5 8.5 2.39543 8.5 3.5Z"
stroke=
"#5850EC"
stroke
-
width=
"1.5"
stroke
-
linecap=
"round"
stroke
-
l
inejoin=
"round"
/>
<
path
d=
"M8.5 3.5C8.5 4.60457 9.39543 5.5 10.5 5.5C11.6046 5.5 12.5 4.60457 12.5 3.5C12.5 2.39543 11.6046 1.5 10.5 1.5C9.39543 1.5 8.5 2.39543 8.5 3.5Z"
stroke=
"#5850EC"
stroke
Width=
"1.5"
strokeLinecap=
"round"
strokeL
inejoin=
"round"
/>
<
path
d=
"M12.5 9C12.5 10.1046 13.3954 11 14.5 11C15.6046 11 16.5 10.1046 16.5 9C16.5 7.89543 15.6046 7 14.5 7C13.3954 7 12.5 7.89543 12.5 9Z"
stroke=
"#5850EC"
stroke
-
width=
"1.5"
stroke
-
linecap=
"round"
stroke
-
l
inejoin=
"round"
/>
<
path
d=
"M12.5 9C12.5 10.1046 13.3954 11 14.5 11C15.6046 11 16.5 10.1046 16.5 9C16.5 7.89543 15.6046 7 14.5 7C13.3954 7 12.5 7.89543 12.5 9Z"
stroke=
"#5850EC"
stroke
Width=
"1.5"
strokeLinecap=
"round"
strokeL
inejoin=
"round"
/>
<
path
d=
"M8.5 3.5H5.5L3.5 6.5"
stroke=
"#5850EC"
stroke
-
width=
"1.5"
stroke
-
linecap=
"round"
stroke
-
l
inejoin=
"round"
/>
<
path
d=
"M8.5 3.5H5.5L3.5 6.5"
stroke=
"#5850EC"
stroke
Width=
"1.5"
strokeLinecap=
"round"
strokeL
inejoin=
"round"
/>
<
path
d=
"M8.5 14.5C8.5 15.6046 9.39543 16.5 10.5 16.5C11.6046 16.5 12.5 15.6046 12.5 14.5C12.5 13.3954 11.6046 12.5 10.5 12.5C9.39543 12.5 8.5 13.3954 8.5 14.5Z"
stroke=
"#5850EC"
stroke
-
width=
"1.5"
stroke
-
linecap=
"round"
stroke
-
l
inejoin=
"round"
/>
<
path
d=
"M8.5 14.5C8.5 15.6046 9.39543 16.5 10.5 16.5C11.6046 16.5 12.5 15.6046 12.5 14.5C12.5 13.3954 11.6046 12.5 10.5 12.5C9.39543 12.5 8.5 13.3954 8.5 14.5Z"
stroke=
"#5850EC"
stroke
Width=
"1.5"
strokeLinecap=
"round"
strokeL
inejoin=
"round"
/>
<
path
d=
"M8.5 14.5H5.5L3.5 11.5"
stroke=
"#5850EC"
stroke
-
width=
"1.5"
stroke
-
linecap=
"round"
stroke
-
l
inejoin=
"round"
/>
<
path
d=
"M8.5 14.5H5.5L3.5 11.5"
stroke=
"#5850EC"
stroke
Width=
"1.5"
strokeLinecap=
"round"
strokeL
inejoin=
"round"
/>
<
path
d=
"M12.5 9H1.5"
stroke=
"#5850EC"
stroke
-
width=
"1.5"
stroke
-
linecap=
"round"
stroke
-
l
inejoin=
"round"
/>
<
path
d=
"M12.5 9H1.5"
stroke=
"#5850EC"
stroke
Width=
"1.5"
strokeLinecap=
"round"
strokeL
inejoin=
"round"
/>
</
svg
>
</
svg
>
const
DatasetSvg
=
<
svg
width=
"20"
height=
"20"
viewBox=
"0 0 20 20"
fill=
"none"
xmlns=
"http://www.w3.org/2000/svg"
>
const
DatasetSvg
=
<
svg
width=
"20"
height=
"20"
viewBox=
"0 0 20 20"
fill=
"none"
xmlns=
"http://www.w3.org/2000/svg"
>
...
@@ -37,9 +37,9 @@ const DatasetSvg = <svg width="20" height="20" viewBox="0 0 20 20" fill="none" x
...
@@ -37,9 +37,9 @@ const DatasetSvg = <svg width="20" height="20" viewBox="0 0 20 20" fill="none" x
</
svg
>
</
svg
>
const
ICON_MAP
=
{
const
ICON_MAP
=
{
'app'
:
<
AppIcon
className
=
'border !border-[rgba(0,0,0,0.05)]'
/>
,
app
:
<
AppIcon
className=
'border !border-[rgba(0,0,0,0.05)]'
/>,
'api'
:
<
AppIcon
innerIcon
=
{
AlgorithmSvg
}
className
=
'border !bg-purple-50 !border-purple-200'
/>
,
api
:
<
AppIcon
innerIcon=
{
AlgorithmSvg
}
className=
'border !bg-purple-50 !border-purple-200'
/>,
'dataset'
:
<
AppIcon
innerIcon
=
{
DatasetSvg
}
className
=
'!border-[0.5px] !border-indigo-100 !bg-indigo-25'
/>
dataset
:
<
AppIcon
innerIcon=
{
DatasetSvg
}
className=
'!border-[0.5px] !border-indigo-100 !bg-indigo-25'
/>,
}
}
export
default
function
AppBasic
({
icon
,
icon_background
,
name
,
type
,
hoverTip
,
textStyle
,
iconType
=
'app'
}:
IAppBasicProps
)
{
export
default
function
AppBasic
({
icon
,
icon_background
,
name
,
type
,
hoverTip
,
textStyle
,
iconType
=
'app'
}:
IAppBasicProps
)
{
...
@@ -50,8 +50,8 @@ export default function AppBasic({ icon, icon_background, name, type, hoverTip,
...
@@ -50,8 +50,8 @@ export default function AppBasic({ icon, icon_background, name, type, hoverTip,
<
AppIcon
icon=
{
icon
}
background=
{
icon_background
}
/>
<
AppIcon
icon=
{
icon
}
background=
{
icon_background
}
/>
</
div
>
</
div
>
)
}
)
}
{
iconType
!==
'app'
&&
{
iconType
!==
'app'
<
div
className=
'flex-shrink-0 mr-3'
>
&&
<
div
className=
'flex-shrink-0 mr-3'
>
{
ICON_MAP
[
iconType
]
}
{
ICON_MAP
[
iconType
]
}
</
div
>
</
div
>
...
...
web/app/components/app/log/index.tsx
View file @
91bcbd0b
...
@@ -31,7 +31,7 @@ const limit = 10
...
@@ -31,7 +31,7 @@ const limit = 10
const
ThreeDotsIcon
:
FC
<
{
className
?:
string
}
>
=
({
className
})
=>
{
const
ThreeDotsIcon
:
FC
<
{
className
?:
string
}
>
=
({
className
})
=>
{
return
<
svg
width=
"16"
height=
"16"
viewBox=
"0 0 16 16"
fill=
"none"
xmlns=
"http://www.w3.org/2000/svg"
className=
{
className
??
''
}
>
return
<
svg
width=
"16"
height=
"16"
viewBox=
"0 0 16 16"
fill=
"none"
xmlns=
"http://www.w3.org/2000/svg"
className=
{
className
??
''
}
>
<
path
d=
"M5 6.5V5M8.93934 7.56066L10 6.5M10.0103 11.5H11.5103"
stroke=
"#374151"
stroke
-
width=
"2"
stroke
-
linecap=
"round"
stroke
-
l
inejoin=
"round"
/>
<
path
d=
"M5 6.5V5M8.93934 7.56066L10 6.5M10.0103 11.5H11.5103"
stroke=
"#374151"
stroke
Width=
"2"
strokeLinecap=
"round"
strokeL
inejoin=
"round"
/>
</
svg
>
</
svg
>
}
}
...
@@ -63,9 +63,9 @@ const Logs: FC<ILogsProps> = ({ appId }) => {
...
@@ -63,9 +63,9 @@ const Logs: FC<ILogsProps> = ({ appId }) => {
limit
,
limit
,
...(
queryParams
.
period
!==
'all'
...(
queryParams
.
period
!==
'all'
?
{
?
{
start
:
dayjs
().
subtract
(
queryParams
.
period
as
number
,
'day'
).
format
(
'YYYY-MM-DD HH:mm'
),
start
:
dayjs
().
subtract
(
queryParams
.
period
as
number
,
'day'
).
format
(
'YYYY-MM-DD HH:mm'
),
end
:
dayjs
().
format
(
'YYYY-MM-DD HH:mm'
),
end
:
dayjs
().
format
(
'YYYY-MM-DD HH:mm'
),
}
}
:
{}),
:
{}),
...
omit
(
queryParams
,
[
'period'
]),
...
omit
(
queryParams
,
[
'period'
]),
}
}
...
@@ -77,16 +77,16 @@ const Logs: FC<ILogsProps> = ({ appId }) => {
...
@@ -77,16 +77,16 @@ const Logs: FC<ILogsProps> = ({ appId }) => {
// When the details are obtained, proceed to the next request
// When the details are obtained, proceed to the next request
const
{
data
:
chatConversations
,
mutate
:
mutateChatList
}
=
useSWR
(()
=>
isChatMode
const
{
data
:
chatConversations
,
mutate
:
mutateChatList
}
=
useSWR
(()
=>
isChatMode
?
{
?
{
url
:
`/apps/
${
appId
}
/chat-conversations`
,
url
:
`/apps/
${
appId
}
/chat-conversations`
,
params
:
query
,
params
:
query
,
}
}
:
null
,
fetchChatConversations
)
:
null
,
fetchChatConversations
)
const
{
data
:
completionConversations
,
mutate
:
mutateCompletionList
}
=
useSWR
(()
=>
!
isChatMode
const
{
data
:
completionConversations
,
mutate
:
mutateCompletionList
}
=
useSWR
(()
=>
!
isChatMode
?
{
?
{
url
:
`/apps/
${
appId
}
/completion-conversations`
,
url
:
`/apps/
${
appId
}
/completion-conversations`
,
params
:
query
,
params
:
query
,
}
}
:
null
,
fetchCompletionConversations
)
:
null
,
fetchCompletionConversations
)
const
total
=
isChatMode
?
chatConversations
?.
total
:
completionConversations
?.
total
const
total
=
isChatMode
?
chatConversations
?.
total
:
completionConversations
?.
total
...
...
web/app/components/app/text-generate/saved-items/no-data/index.tsx
View file @
91bcbd0b
'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
Button
from
'@/app/components/base/button'
import
{
PlusIcon
}
from
'@heroicons/react/24/outline'
import
{
PlusIcon
}
from
'@heroicons/react/24/outline'
export
interface
INoDataProps
{
import
Button
from
'@/app/components/base/button'
export
type
INoDataProps
=
{
onStartCreateContent
:
()
=>
void
onStartCreateContent
:
()
=>
void
}
}
const
markIcon
=
(
const
markIcon
=
(
<
svg
width=
"20"
height=
"20"
viewBox=
"0 0 20 20"
fill=
"none"
xmlns=
"http://www.w3.org/2000/svg"
>
<
svg
width=
"20"
height=
"20"
viewBox=
"0 0 20 20"
fill=
"none"
xmlns=
"http://www.w3.org/2000/svg"
>
<
path
d=
"M4.16699 6.5C4.16699 5.09987 4.16699 4.3998 4.43948 3.86502C4.67916 3.39462 5.06161 3.01217 5.53202 2.77248C6.0668 2.5 6.76686 2.5 8.16699 2.5H11.8337C13.2338 2.5 13.9339 2.5 14.4686 2.77248C14.939 3.01217 15.3215 3.39462 15.5612 3.86502C15.8337 4.3998 15.8337 5.09987 15.8337 6.5V17.5L10.0003 14.1667L4.16699 17.5V6.5Z"
stroke=
"#667085"
stroke
-
width=
"1.5"
stroke
-
linecap=
"round"
stroke
-
l
inejoin=
"round"
/>
<
path
d=
"M4.16699 6.5C4.16699 5.09987 4.16699 4.3998 4.43948 3.86502C4.67916 3.39462 5.06161 3.01217 5.53202 2.77248C6.0668 2.5 6.76686 2.5 8.16699 2.5H11.8337C13.2338 2.5 13.9339 2.5 14.4686 2.77248C14.939 3.01217 15.3215 3.39462 15.5612 3.86502C15.8337 4.3998 15.8337 5.09987 15.8337 6.5V17.5L10.0003 14.1667L4.16699 17.5V6.5Z"
stroke=
"#667085"
stroke
Width=
"1.5"
strokeLinecap=
"round"
strokeL
inejoin=
"round"
/>
</
svg
>
</
svg
>
)
)
const
lightIcon
=
(
const
lightIcon
=
(
<
svg
width=
"16"
height=
"16"
viewBox=
"0 0 16 16"
fill=
"none"
xmlns=
"http://www.w3.org/2000/svg"
className=
"inline relative -top-3 -left-1.5"
><
path
d=
"M5 6.5V5M8.93934 7.56066L10 6.5M10.0103 11.5H11.5103"
stroke=
"#374151"
stroke
-
width=
"2"
stroke
-
linecap=
"round"
stroke
-
l
inejoin=
"round"
></
path
></
svg
>
<
svg
width=
"16"
height=
"16"
viewBox=
"0 0 16 16"
fill=
"none"
xmlns=
"http://www.w3.org/2000/svg"
className=
"inline relative -top-3 -left-1.5"
><
path
d=
"M5 6.5V5M8.93934 7.56066L10 6.5M10.0103 11.5H11.5103"
stroke=
"#374151"
stroke
Width=
"2"
strokeLinecap=
"round"
strokeL
inejoin=
"round"
></
path
></
svg
>
)
)
const
NoData
:
FC
<
INoDataProps
>
=
({
const
NoData
:
FC
<
INoDataProps
>
=
({
onStartCreateContent
onStartCreateContent
,
})
=>
{
})
=>
{
const
{
t
}
=
useTranslation
()
const
{
t
}
=
useTranslation
()
...
...
web/app/components/base/input/index.tsx
View file @
91bcbd0b
...
@@ -18,7 +18,7 @@ type InputProps = {
...
@@ -18,7 +18,7 @@ type InputProps = {
const
GlassIcon
:
FC
<
{
className
?:
string
}
>
=
({
className
})
=>
(
const
GlassIcon
:
FC
<
{
className
?:
string
}
>
=
({
className
})
=>
(
<
svg
width=
"14"
height=
"14"
viewBox=
"0 0 14 14"
fill=
"none"
xmlns=
"http://www.w3.org/2000/svg"
className=
{
className
??
''
}
>
<
svg
width=
"14"
height=
"14"
viewBox=
"0 0 14 14"
fill=
"none"
xmlns=
"http://www.w3.org/2000/svg"
className=
{
className
??
''
}
>
<
path
d=
"M12.25 12.25L10.2084 10.2083M11.6667 6.70833C11.6667 9.44675 9.44675 11.6667 6.70833 11.6667C3.96992 11.6667 1.75 9.44675 1.75 6.70833C1.75 3.96992 3.96992 1.75 6.70833 1.75C9.44675 1.75 11.6667 3.96992 11.6667 6.70833Z"
stroke=
"#344054"
stroke
-
width=
"1.25"
stroke
-
linecap=
"round"
stroke
-
l
inejoin=
"round"
/>
<
path
d=
"M12.25 12.25L10.2084 10.2083M11.6667 6.70833C11.6667 9.44675 9.44675 11.6667 6.70833 11.6667C3.96992 11.6667 1.75 9.44675 1.75 6.70833C1.75 3.96992 3.96992 1.75 6.70833 1.75C9.44675 1.75 11.6667 3.96992 11.6667 6.70833Z"
stroke=
"#344054"
stroke
Width=
"1.25"
strokeLinecap=
"round"
strokeL
inejoin=
"round"
/>
</
svg
>
</
svg
>
)
)
...
...
web/app/components/datasets/documents/detail/embedding/index.tsx
View file @
91bcbd0b
import
{
FC
,
useCallback
,
useMemo
,
useState
}
from
'react'
import
type
{
FC
}
from
'react'
import
React
from
'react'
import
React
,
{
useCallback
,
useMemo
,
useState
}
from
'react'
import
useSWR
from
'swr'
import
useSWR
from
'swr'
import
{
useRouter
}
from
'next/navigation'
import
{
useRouter
}
from
'next/navigation'
import
{
useContext
}
from
'use-context-selector'
import
{
useContext
}
from
'use-context-selector'
import
{
useTranslation
}
from
'react-i18next'
import
{
useTranslation
}
from
'react-i18next'
import
{
omit
}
from
'lodash-es'
import
{
omit
}
from
'lodash-es'
import
cn
from
'classnames'
import
cn
from
'classnames'
import
{
ArrowRightIcon
}
from
'@heroicons/react/24/solid'
import
SegmentCard
from
'../completed/SegmentCard'
import
{
FieldInfo
}
from
'../metadata'
import
style
from
'../completed/style.module.css'
import
{
DocumentContext
}
from
'../index'
import
s
from
'./style.module.css'
import
Button
from
'@/app/components/base/button'
import
Button
from
'@/app/components/base/button'
import
Divider
from
'@/app/components/base/divider'
import
Divider
from
'@/app/components/base/divider'
import
Loading
from
'@/app/components/base/loading'
import
{
ToastContext
}
from
'@/app/components/base/toast'
import
{
ToastContext
}
from
'@/app/components/base/toast'
import
{
FullDocumentDetail
,
ProcessRuleResponse
}
from
'@/models/datasets'
import
type
{
FullDocumentDetail
,
ProcessRuleResponse
}
from
'@/models/datasets'
import
type
{
CommonResponse
}
from
'@/models/common'
import
type
{
CommonResponse
}
from
'@/models/common'
import
{
asyncRunSafe
}
from
'@/utils'
import
{
asyncRunSafe
}
from
'@/utils'
import
{
formatNumber
}
from
'@/utils/format'
import
{
formatNumber
}
from
'@/utils/format'
import
{
fetchProcessRule
,
fetchIndexingEstimate
,
fetchIndexingStatus
,
pauseDocIndexing
,
resumeDocIndexing
}
from
'@/service/datasets'
import
{
fetchIndexingEstimate
,
fetchIndexingStatus
,
fetchProcessRule
,
pauseDocIndexing
,
resumeDocIndexing
}
from
'@/service/datasets'
import
SegmentCard
from
'../completed/SegmentCard'
import
{
FieldInfo
}
from
'../metadata'
import
s
from
'./style.module.css'
import
style
from
'../completed/style.module.css'
import
{
DocumentContext
}
from
'../index'
import
DatasetDetailContext
from
'@/context/dataset-detail'
import
DatasetDetailContext
from
'@/context/dataset-detail'
import
StopEmbeddingModal
from
'@/app/components/datasets/create/stop-embedding-modal'
import
StopEmbeddingModal
from
'@/app/components/datasets/create/stop-embedding-modal'
import
{
ArrowRightIcon
}
from
'@heroicons/react/24/solid'
type
Props
=
{
type
Props
=
{
detail
?:
FullDocumentDetail
detail
?:
FullDocumentDetail
...
@@ -35,7 +34,7 @@ type Props = {
...
@@ -35,7 +34,7 @@ type Props = {
const
StopIcon
:
FC
<
{
className
?:
string
}
>
=
({
className
})
=>
{
const
StopIcon
:
FC
<
{
className
?:
string
}
>
=
({
className
})
=>
{
return
<
svg
width=
"12"
height=
"12"
viewBox=
"0 0 12 12"
fill=
"none"
xmlns=
"http://www.w3.org/2000/svg"
className=
{
className
??
''
}
>
return
<
svg
width=
"12"
height=
"12"
viewBox=
"0 0 12 12"
fill=
"none"
xmlns=
"http://www.w3.org/2000/svg"
className=
{
className
??
''
}
>
<
g
clip
-
path=
"url(#clip0_2328_2798)"
>
<
g
clip
-
path=
"url(#clip0_2328_2798)"
>
<
path
d=
"M1.5 3.9C1.5 3.05992 1.5 2.63988 1.66349 2.31901C1.8073 2.03677 2.03677 1.8073 2.31901 1.66349C2.63988 1.5 3.05992 1.5 3.9 1.5H8.1C8.94008 1.5 9.36012 1.5 9.68099 1.66349C9.96323 1.8073 10.1927 2.03677 10.3365 2.31901C10.5 2.63988 10.5 3.05992 10.5 3.9V8.1C10.5 8.94008 10.5 9.36012 10.3365 9.68099C10.1927 9.96323 9.96323 10.1927 9.68099 10.3365C9.36012 10.5 8.94008 10.5 8.1 10.5H3.9C3.05992 10.5 2.63988 10.5 2.31901 10.3365C2.03677 10.1927 1.8073 9.96323 1.66349 9.68099C1.5 9.36012 1.5 8.94008 1.5 8.1V3.9Z"
stroke=
"#344054"
stroke
-
width=
"1.5"
stroke
-
linecap=
"round"
stroke
-
l
inejoin=
"round"
/>
<
path
d=
"M1.5 3.9C1.5 3.05992 1.5 2.63988 1.66349 2.31901C1.8073 2.03677 2.03677 1.8073 2.31901 1.66349C2.63988 1.5 3.05992 1.5 3.9 1.5H8.1C8.94008 1.5 9.36012 1.5 9.68099 1.66349C9.96323 1.8073 10.1927 2.03677 10.3365 2.31901C10.5 2.63988 10.5 3.05992 10.5 3.9V8.1C10.5 8.94008 10.5 9.36012 10.3365 9.68099C10.1927 9.96323 9.96323 10.1927 9.68099 10.3365C9.36012 10.5 8.94008 10.5 8.1 10.5H3.9C3.05992 10.5 2.63988 10.5 2.31901 10.3365C2.03677 10.1927 1.8073 9.96323 1.66349 9.68099C1.5 9.36012 1.5 8.94008 1.5 8.1V3.9Z"
stroke=
"#344054"
stroke
Width=
"1.5"
strokeLinecap=
"round"
strokeL
inejoin=
"round"
/>
</
g
>
</
g
>
<
defs
>
<
defs
>
<
clipPath
id=
"clip0_2328_2798"
>
<
clipPath
id=
"clip0_2328_2798"
>
...
@@ -47,9 +46,8 @@ const StopIcon: FC<{ className?: string }> = ({ className }) => {
...
@@ -47,9 +46,8 @@ const StopIcon: FC<{ className?: string }> = ({ className }) => {
const
ResumeIcon
:
FC
<
{
className
?:
string
}
>
=
({
className
})
=>
{
const
ResumeIcon
:
FC
<
{
className
?:
string
}
>
=
({
className
})
=>
{
return
<
svg
width=
"12"
height=
"12"
viewBox=
"0 0 12 12"
fill=
"none"
xmlns=
"http://www.w3.org/2000/svg"
className=
{
className
??
''
}
>
return
<
svg
width=
"12"
height=
"12"
viewBox=
"0 0 12 12"
fill=
"none"
xmlns=
"http://www.w3.org/2000/svg"
className=
{
className
??
''
}
>
<
path
d=
"M10 3.5H5C3.34315 3.5 2 4.84315 2 6.5C2 8.15685 3.34315 9.5 5 9.5H10M10 3.5L8 1.5M10 3.5L8 5.5"
stroke=
"#344054"
stroke
-
width=
"1.5"
stroke
-
linecap=
"round"
stroke
-
l
inejoin=
"round"
/>
<
path
d=
"M10 3.5H5C3.34315 3.5 2 4.84315 2 6.5C2 8.15685 3.34315 9.5 5 9.5H10M10 3.5L8 1.5M10 3.5L8 5.5"
stroke=
"#344054"
stroke
Width=
"1.5"
strokeLinecap=
"round"
strokeL
inejoin=
"round"
/>
</
svg
>
</
svg
>
}
}
const
RuleDetail
:
FC
<
{
sourceData
?:
ProcessRuleResponse
;
docName
?:
string
}
>
=
({
sourceData
,
docName
})
=>
{
const
RuleDetail
:
FC
<
{
sourceData
?:
ProcessRuleResponse
;
docName
?:
string
}
>
=
({
sourceData
,
docName
})
=>
{
...
@@ -61,43 +59,43 @@ const RuleDetail: FC<{ sourceData?: ProcessRuleResponse; docName?: string }> = (
...
@@ -61,43 +59,43 @@ const RuleDetail: FC<{ sourceData?: ProcessRuleResponse; docName?: string }> = (
segmentLength
:
t
(
'datasetDocuments.embedding.segmentLength'
),
segmentLength
:
t
(
'datasetDocuments.embedding.segmentLength'
),
textCleaning
:
t
(
'datasetDocuments.embedding.textCleaning'
),
textCleaning
:
t
(
'datasetDocuments.embedding.textCleaning'
),
}
}
const
getRuleName
=
(
key
:
string
)
=>
{
if
(
key
===
'remove_extra_spaces'
)
return
t
(
'datasetCreation.stepTwo.removeExtraSpaces'
)
if
(
key
===
'remove_urls_emails'
)
return
t
(
'datasetCreation.stepTwo.removeUrlEmails'
)
if
(
key
===
'remove_stopwords'
)
return
t
(
'datasetCreation.stepTwo.removeStopwords'
)
}
const
getValue
=
useCallback
((
field
:
string
)
=>
{
const
getValue
=
useCallback
((
field
:
string
)
=>
{
let
value
:
string
|
number
|
undefined
=
'-'
;
let
value
:
string
|
number
|
undefined
=
'-'
switch
(
field
)
{
switch
(
field
)
{
case
'docName'
:
case
'docName'
:
value
=
docName
value
=
docName
break
;
break
case
'mode'
:
case
'mode'
:
value
=
sourceData
?.
mode
===
'automatic'
?
(
t
(
'datasetDocuments.embedding.automatic'
)
as
string
)
:
(
t
(
'datasetDocuments.embedding.custom'
)
as
string
)
;
value
=
sourceData
?.
mode
===
'automatic'
?
(
t
(
'datasetDocuments.embedding.automatic'
)
as
string
)
:
(
t
(
'datasetDocuments.embedding.custom'
)
as
string
)
break
;
break
case
'segmentLength'
:
case
'segmentLength'
:
value
=
sourceData
?.
rules
?.
segmentation
?.
max_tokens
value
=
sourceData
?.
rules
?.
segmentation
?.
max_tokens
break
;
break
default
:
default
:
value
=
sourceData
?.
mode
===
'automatic'
?
value
=
sourceData
?.
mode
===
'automatic'
(
t
(
'datasetDocuments.embedding.automatic'
)
as
string
)
:
?
(
t
(
'datasetDocuments.embedding.automatic'
)
as
string
)
sourceData
?.
rules
?.
pre_processing_rules
?.
map
(
rule
=>
{
// eslint-disable-next-line array-callback-return
if
(
rule
.
enabled
)
{
:
sourceData
?.
rules
?.
pre_processing_rules
?.
map
((
rule
)
=>
{
if
(
rule
.
enabled
)
return
getRuleName
(
rule
.
id
)
return
getRuleName
(
rule
.
id
)
}
}).
filter
(
Boolean
).
join
(
';'
)
}).
filter
(
Boolean
).
join
(
';'
)
break
;
break
}
}
return
value
return
value
},
[
sourceData
,
docName
])
},
[
sourceData
,
docName
])
const
getRuleName
=
(
key
:
string
)
=>
{
if
(
key
===
'remove_extra_spaces'
)
{
return
t
(
'datasetCreation.stepTwo.removeExtraSpaces'
)
}
if
(
key
===
'remove_urls_emails'
)
{
return
t
(
'datasetCreation.stepTwo.removeUrlEmails'
)
}
if
(
key
===
'remove_stopwords'
)
{
return
t
(
'datasetCreation.stepTwo.removeStopwords'
)
}
}
return
<
div
className=
'flex flex-col pt-8 pb-10 first:mt-0'
>
return
<
div
className=
'flex flex-col pt-8 pb-10 first:mt-0'
>
{
Object
.
keys
(
segmentationRuleMap
).
map
((
field
)
=>
{
{
Object
.
keys
(
segmentationRuleMap
).
map
((
field
)
=>
{
return
<
FieldInfo
return
<
FieldInfo
...
@@ -134,12 +132,12 @@ const EmbeddingDetail: FC<Props> = ({ detail, stopPosition = 'top', datasetId: d
...
@@ -134,12 +132,12 @@ const EmbeddingDetail: FC<Props> = ({ detail, stopPosition = 'top', datasetId: d
datasetId
:
localDatasetId
,
datasetId
:
localDatasetId
,
documentId
:
localDocumentId
,
documentId
:
localDocumentId
,
},
apiParams
=>
fetchIndexingEstimate
(
omit
(
apiParams
,
'action'
)),
{
},
apiParams
=>
fetchIndexingEstimate
(
omit
(
apiParams
,
'action'
)),
{
revalidateOnFocus
:
false
revalidateOnFocus
:
false
,
})
})
const
{
data
:
ruleDetail
,
error
:
ruleError
}
=
useSWR
({
const
{
data
:
ruleDetail
,
error
:
ruleError
}
=
useSWR
({
action
:
'fetchProcessRule'
,
action
:
'fetchProcessRule'
,
params
:
{
documentId
:
localDocumentId
}
params
:
{
documentId
:
localDocumentId
}
,
},
apiParams
=>
fetchProcessRule
(
omit
(
apiParams
,
'action'
)),
{
},
apiParams
=>
fetchProcessRule
(
omit
(
apiParams
,
'action'
)),
{
revalidateOnFocus
:
false
,
revalidateOnFocus
:
false
,
})
})
...
@@ -159,7 +157,8 @@ const EmbeddingDetail: FC<Props> = ({ detail, stopPosition = 'top', datasetId: d
...
@@ -159,7 +157,8 @@ const EmbeddingDetail: FC<Props> = ({ detail, stopPosition = 'top', datasetId: d
const
percent
=
useMemo
(()
=>
{
const
percent
=
useMemo
(()
=>
{
const
completedCount
=
indexingStatusDetail
?.
completed_segments
||
0
const
completedCount
=
indexingStatusDetail
?.
completed_segments
||
0
const
totalCount
=
indexingStatusDetail
?.
total_segments
||
0
const
totalCount
=
indexingStatusDetail
?.
total_segments
||
0
if
(
totalCount
===
0
)
return
0
if
(
totalCount
===
0
)
return
0
const
percent
=
Math
.
round
(
completedCount
*
100
/
totalCount
)
const
percent
=
Math
.
round
(
completedCount
*
100
/
totalCount
)
return
percent
>
100
?
100
:
percent
return
percent
>
100
?
100
:
percent
},
[
indexingStatusDetail
])
},
[
indexingStatusDetail
])
...
@@ -170,7 +169,8 @@ const EmbeddingDetail: FC<Props> = ({ detail, stopPosition = 'top', datasetId: d
...
@@ -170,7 +169,8 @@ const EmbeddingDetail: FC<Props> = ({ detail, stopPosition = 'top', datasetId: d
if
(
!
e
)
{
if
(
!
e
)
{
notify
({
type
:
'success'
,
message
:
t
(
'common.actionMsg.modifiedSuccessfully'
)
})
notify
({
type
:
'success'
,
message
:
t
(
'common.actionMsg.modifiedSuccessfully'
)
})
statusMutate
()
statusMutate
()
}
else
{
}
else
{
notify
({
type
:
'error'
,
message
:
t
(
'common.actionMsg.modificationFailed'
)
})
notify
({
type
:
'error'
,
message
:
t
(
'common.actionMsg.modificationFailed'
)
})
}
}
}
}
...
@@ -211,7 +211,7 @@ const EmbeddingDetail: FC<Props> = ({ detail, stopPosition = 'top', datasetId: d
...
@@ -211,7 +211,7 @@ const EmbeddingDetail: FC<Props> = ({ detail, stopPosition = 'top', datasetId: d
(
isEmbeddingPaused
||
isEmbeddingError
)
&&
s
.
barPaused
,
(
isEmbeddingPaused
||
isEmbeddingError
)
&&
s
.
barPaused
,
indexingStatusDetail
?.
indexing_status
===
'completed'
&&
'rounded-r-md'
)
indexingStatusDetail
?.
indexing_status
===
'completed'
&&
'rounded-r-md'
)
}
}
style=
{
{
width
:
`${percent}%`
}
}
style=
{
{
width
:
`${percent}%`
}
}
/>
/>
</
div
>
</
div
>
<
div
className=
{
s
.
progressData
}
>
<
div
className=
{
s
.
progressData
}
>
...
@@ -255,7 +255,7 @@ const EmbeddingDetail: FC<Props> = ({ detail, stopPosition = 'top', datasetId: d
...
@@ -255,7 +255,7 @@ const EmbeddingDetail: FC<Props> = ({ detail, stopPosition = 'top', datasetId: d
<
Divider
/>
<
Divider
/>
<
div
className=
{
s
.
previewTip
}
>
{
t
(
'datasetDocuments.embedding.previewTip'
)
}
</
div
>
<
div
className=
{
s
.
previewTip
}
>
{
t
(
'datasetDocuments.embedding.previewTip'
)
}
</
div
>
<
div
className=
{
style
.
cardWrapper
}
>
<
div
className=
{
style
.
cardWrapper
}
>
{
[
1
,
2
,
3
].
map
(
(
v
)
=>
(
{
[
1
,
2
,
3
].
map
(
v
=>
(
<
SegmentCard
loading=
{
true
}
detail=
{
{
position
:
v
}
as
any
}
/>
<
SegmentCard
loading=
{
true
}
detail=
{
{
position
:
v
}
as
any
}
/>
))
}
))
}
</
div
>
</
div
>
...
...
web/app/components/datasets/documents/index.tsx
View file @
91bcbd0b
'use client'
'use client'
import
type
{
FC
}
from
'react'
import
type
{
FC
}
from
'react'
import
React
,
{
use
State
,
useMemo
}
from
'react'
import
React
,
{
use
Memo
,
useState
}
from
'react'
import
useSWR
from
'swr'
import
useSWR
from
'swr'
import
{
useTranslation
}
from
'react-i18next'
import
{
useTranslation
}
from
'react-i18next'
import
{
useRouter
}
from
'next/navigation'
import
{
useRouter
}
from
'next/navigation'
import
{
debounce
}
from
'lodash-es'
import
{
debounce
,
omit
}
from
'lodash-es'
// import Link from 'next/link'
// import Link from 'next/link'
import
{
PlusIcon
}
from
'@heroicons/react/24/solid'
import
{
PlusIcon
}
from
'@heroicons/react/24/solid'
import
{
omit
}
from
'lodash-es'
import
List
from
'./list'
import
List
from
'./list'
import
s
from
'./style.module.css'
import
s
from
'./style.module.css'
import
Loading
from
'@/app/components/base/loading'
import
Loading
from
'@/app/components/base/loading'
...
@@ -22,13 +21,13 @@ const limit = 15
...
@@ -22,13 +21,13 @@ const limit = 15
const
FolderPlusIcon
:
FC
<
{
className
?:
string
}
>
=
({
className
})
=>
{
const
FolderPlusIcon
:
FC
<
{
className
?:
string
}
>
=
({
className
})
=>
{
return
<
svg
width=
"20"
height=
"20"
viewBox=
"0 0 20 20"
fill=
"none"
xmlns=
"http://www.w3.org/2000/svg"
className=
{
className
??
''
}
>
return
<
svg
width=
"20"
height=
"20"
viewBox=
"0 0 20 20"
fill=
"none"
xmlns=
"http://www.w3.org/2000/svg"
className=
{
className
??
''
}
>
<
path
d=
"M10.8332 5.83333L9.90355 3.9741C9.63601 3.439 9.50222 3.17144 9.30265 2.97597C9.12615 2.80311 8.91344 2.67164 8.6799 2.59109C8.41581 2.5 8.11668 2.5 7.51841 2.5H4.33317C3.39975 2.5 2.93304 2.5 2.57652 2.68166C2.26292 2.84144 2.00795 3.09641 1.84816 3.41002C1.6665 3.76654 1.6665 4.23325 1.6665 5.16667V5.83333M1.6665 5.83333H14.3332C15.7333 5.83333 16.4334 5.83333 16.9681 6.10582C17.4386 6.3455 17.821 6.72795 18.0607 7.19836C18.3332 7.73314 18.3332 8.4332 18.3332 9.83333V13.5C18.3332 14.9001 18.3332 15.6002 18.0607 16.135C17.821 16.6054 17.4386 16.9878 16.9681 17.2275C16.4334 17.5 15.7333 17.5 14.3332 17.5H5.6665C4.26637 17.5 3.56631 17.5 3.03153 17.2275C2.56112 16.9878 2.17867 16.6054 1.93899 16.135C1.6665 15.6002 1.6665 14.9001 1.6665 13.5V5.83333ZM9.99984 14.1667V9.16667M7.49984 11.6667H12.4998"
stroke=
"#667085"
stroke
-
width=
"1.5"
stroke
-
linecap=
"round"
stroke
-
l
inejoin=
"round"
/>
<
path
d=
"M10.8332 5.83333L9.90355 3.9741C9.63601 3.439 9.50222 3.17144 9.30265 2.97597C9.12615 2.80311 8.91344 2.67164 8.6799 2.59109C8.41581 2.5 8.11668 2.5 7.51841 2.5H4.33317C3.39975 2.5 2.93304 2.5 2.57652 2.68166C2.26292 2.84144 2.00795 3.09641 1.84816 3.41002C1.6665 3.76654 1.6665 4.23325 1.6665 5.16667V5.83333M1.6665 5.83333H14.3332C15.7333 5.83333 16.4334 5.83333 16.9681 6.10582C17.4386 6.3455 17.821 6.72795 18.0607 7.19836C18.3332 7.73314 18.3332 8.4332 18.3332 9.83333V13.5C18.3332 14.9001 18.3332 15.6002 18.0607 16.135C17.821 16.6054 17.4386 16.9878 16.9681 17.2275C16.4334 17.5 15.7333 17.5 14.3332 17.5H5.6665C4.26637 17.5 3.56631 17.5 3.03153 17.2275C2.56112 16.9878 2.17867 16.6054 1.93899 16.135C1.6665 15.6002 1.6665 14.9001 1.6665 13.5V5.83333ZM9.99984 14.1667V9.16667M7.49984 11.6667H12.4998"
stroke=
"#667085"
stroke
Width=
"1.5"
strokeLinecap=
"round"
strokeL
inejoin=
"round"
/>
</
svg
>
</
svg
>
}
}
const
ThreeDotsIcon
:
FC
<
{
className
?:
string
}
>
=
({
className
})
=>
{
const
ThreeDotsIcon
:
FC
<
{
className
?:
string
}
>
=
({
className
})
=>
{
return
<
svg
width=
"16"
height=
"16"
viewBox=
"0 0 16 16"
fill=
"none"
xmlns=
"http://www.w3.org/2000/svg"
className=
{
className
??
''
}
>
return
<
svg
width=
"16"
height=
"16"
viewBox=
"0 0 16 16"
fill=
"none"
xmlns=
"http://www.w3.org/2000/svg"
className=
{
className
??
''
}
>
<
path
d=
"M5 6.5V5M8.93934 7.56066L10 6.5M10.0103 11.5H11.5103"
stroke=
"#374151"
stroke
-
width=
"2"
stroke
-
linecap=
"round"
stroke
-
l
inejoin=
"round"
/>
<
path
d=
"M5 6.5V5M8.93934 7.56066L10 6.5M10.0103 11.5H11.5103"
stroke=
"#374151"
stroke
Width=
"2"
strokeLinecap=
"round"
strokeL
inejoin=
"round"
/>
</
svg
>
</
svg
>
}
}
...
...
web/app/components/datasets/documents/list.tsx
View file @
91bcbd0b
/* eslint-disable no-mixed-operators */
'use client'
'use client'
import
type
{
FC
}
from
'react'
import
type
{
FC
}
from
'react'
import
React
,
{
use
State
,
useEffect
}
from
'react'
import
React
,
{
use
Effect
,
useState
}
from
'react'
import
{
TrashIcon
,
ArrowDown
Icon
}
from
'@heroicons/react/24/outline'
import
{
ArrowDownIcon
,
Trash
Icon
}
from
'@heroicons/react/24/outline'
import
{
ExclamationCircleIcon
}
from
'@heroicons/react/24/solid'
import
{
ExclamationCircleIcon
}
from
'@heroicons/react/24/solid'
import
dayjs
from
'dayjs'
import
dayjs
from
'dayjs'
import
{
pick
}
from
'lodash-es'
import
{
pick
}
from
'lodash-es'
import
{
useContext
}
from
'use-context-selector'
import
{
useContext
}
from
'use-context-selector'
import
{
useRouter
}
from
'next/navigation'
import
{
useRouter
}
from
'next/navigation'
import
{
useTranslation
}
from
'react-i18next'
import
{
useTranslation
}
from
'react-i18next'
import
cn
from
'classnames'
import
s
from
'./style.module.css'
import
Switch
from
'@/app/components/base/switch'
import
Switch
from
'@/app/components/base/switch'
import
Divider
from
'@/app/components/base/divider'
import
Divider
from
'@/app/components/base/divider'
import
Popover
from
'@/app/components/base/popover'
import
Popover
from
'@/app/components/base/popover'
...
@@ -20,26 +23,24 @@ import Indicator from '@/app/components/header/indicator'
...
@@ -20,26 +23,24 @@ import Indicator from '@/app/components/header/indicator'
import
{
asyncRunSafe
}
from
'@/utils'
import
{
asyncRunSafe
}
from
'@/utils'
import
{
formatNumber
}
from
'@/utils/format'
import
{
formatNumber
}
from
'@/utils/format'
import
{
archiveDocument
,
deleteDocument
,
disableDocument
,
enableDocument
}
from
'@/service/datasets'
import
{
archiveDocument
,
deleteDocument
,
disableDocument
,
enableDocument
}
from
'@/service/datasets'
import
type
{
Document
ListResponse
,
DocumentDisplayStatus
}
from
'@/models/datasets'
import
type
{
Document
DisplayStatus
,
DocumentListResponse
}
from
'@/models/datasets'
import
type
{
CommonResponse
}
from
'@/models/common'
import
type
{
CommonResponse
}
from
'@/models/common'
import
cn
from
'classnames'
import
s
from
'./style.module.css'
export
const
SettingsIcon
:
FC
<
{
className
?:
string
}
>
=
({
className
})
=>
{
export
const
SettingsIcon
:
FC
<
{
className
?:
string
}
>
=
({
className
})
=>
{
return
<
svg
width=
"16"
height=
"16"
viewBox=
"0 0 16 16"
fill=
"none"
xmlns=
"http://www.w3.org/2000/svg"
className=
{
className
??
''
}
>
return
<
svg
width=
"16"
height=
"16"
viewBox=
"0 0 16 16"
fill=
"none"
xmlns=
"http://www.w3.org/2000/svg"
className=
{
className
??
''
}
>
<
path
d=
"M2 5.33325L10 5.33325M10 5.33325C10 6.43782 10.8954 7.33325 12 7.33325C13.1046 7.33325 14 6.43782 14 5.33325C14 4.22868 13.1046 3.33325 12 3.33325C10.8954 3.33325 10 4.22868 10 5.33325ZM6 10.6666L14 10.6666M6 10.6666C6 11.7712 5.10457 12.6666 4 12.6666C2.89543 12.6666 2 11.7712 2 10.6666C2 9.56202 2.89543 8.66659 4 8.66659C5.10457 8.66659 6 9.56202 6 10.6666Z"
stroke=
"#667085"
stroke
-
width=
"1.5"
stroke
-
linecap=
"round"
stroke
-
l
inejoin=
"round"
/>
<
path
d=
"M2 5.33325L10 5.33325M10 5.33325C10 6.43782 10.8954 7.33325 12 7.33325C13.1046 7.33325 14 6.43782 14 5.33325C14 4.22868 13.1046 3.33325 12 3.33325C10.8954 3.33325 10 4.22868 10 5.33325ZM6 10.6666L14 10.6666M6 10.6666C6 11.7712 5.10457 12.6666 4 12.6666C2.89543 12.6666 2 11.7712 2 10.6666C2 9.56202 2.89543 8.66659 4 8.66659C5.10457 8.66659 6 9.56202 6 10.6666Z"
stroke=
"#667085"
stroke
Width=
"1.5"
strokeLinecap=
"round"
strokeL
inejoin=
"round"
/>
</
svg
>
</
svg
>
}
}
export
const
FilePlusIcon
:
FC
<
{
className
?:
string
}
>
=
({
className
})
=>
{
export
const
FilePlusIcon
:
FC
<
{
className
?:
string
}
>
=
({
className
})
=>
{
return
<
svg
width=
"16"
height=
"16"
viewBox=
"0 0 16 16"
fill=
"none"
xmlns=
"http://www.w3.org/2000/svg"
className=
{
className
??
''
}
>
return
<
svg
width=
"16"
height=
"16"
viewBox=
"0 0 16 16"
fill=
"none"
xmlns=
"http://www.w3.org/2000/svg"
className=
{
className
??
''
}
>
<
path
d=
"M13.3332 6.99992V4.53325C13.3332 3.41315 13.3332 2.85309 13.1152 2.42527C12.9234 2.04895 12.6175 1.74299 12.2412 1.55124C11.8133 1.33325 11.2533 1.33325 10.1332 1.33325H5.8665C4.7464 1.33325 4.18635 1.33325 3.75852 1.55124C3.3822 1.74299 3.07624 2.04895 2.88449 2.42527C2.6665 2.85309 2.6665 3.41315 2.6665 4.53325V11.4666C2.6665 12.5867 2.6665 13.1467 2.88449 13.5746C3.07624 13.9509 3.3822 14.2569 3.75852 14.4486C4.18635 14.6666 4.7464 14.6666 5.8665 14.6666H7.99984M9.33317 7.33325H5.33317M6.6665 9.99992H5.33317M10.6665 4.66659H5.33317M11.9998 13.9999V9.99992M9.99984 11.9999H13.9998"
stroke=
"#667085"
stroke
-
width=
"1.5"
stroke
-
linecap=
"round"
stroke
-
l
inejoin=
"round"
/>
<
path
d=
"M13.3332 6.99992V4.53325C13.3332 3.41315 13.3332 2.85309 13.1152 2.42527C12.9234 2.04895 12.6175 1.74299 12.2412 1.55124C11.8133 1.33325 11.2533 1.33325 10.1332 1.33325H5.8665C4.7464 1.33325 4.18635 1.33325 3.75852 1.55124C3.3822 1.74299 3.07624 2.04895 2.88449 2.42527C2.6665 2.85309 2.6665 3.41315 2.6665 4.53325V11.4666C2.6665 12.5867 2.6665 13.1467 2.88449 13.5746C3.07624 13.9509 3.3822 14.2569 3.75852 14.4486C4.18635 14.6666 4.7464 14.6666 5.8665 14.6666H7.99984M9.33317 7.33325H5.33317M6.6665 9.99992H5.33317M10.6665 4.66659H5.33317M11.9998 13.9999V9.99992M9.99984 11.9999H13.9998"
stroke=
"#667085"
stroke
Width=
"1.5"
strokeLinecap=
"round"
strokeL
inejoin=
"round"
/>
</
svg
>
</
svg
>
}
}
export
const
ArchiveIcon
:
FC
<
{
className
?:
string
}
>
=
({
className
})
=>
{
export
const
ArchiveIcon
:
FC
<
{
className
?:
string
}
>
=
({
className
})
=>
{
return
<
svg
width=
"16"
height=
"16"
viewBox=
"0 0 16 16"
fill=
"none"
xmlns=
"http://www.w3.org/2000/svg"
className=
{
className
??
''
}
>
return
<
svg
width=
"16"
height=
"16"
viewBox=
"0 0 16 16"
fill=
"none"
xmlns=
"http://www.w3.org/2000/svg"
className=
{
className
??
''
}
>
<
path
d=
"M2.66683 5.33106C2.55749 5.32824 2.47809 5.32191 2.40671 5.30771C1.87779 5.2025 1.46432 4.78904 1.35912 4.26012C1.3335 4.13132 1.3335 3.97644 1.3335 3.66667C1.3335 3.3569 1.3335 3.20201 1.35912 3.07321C1.46432 2.54429 1.87779 2.13083 2.40671 2.02562C2.53551 2 2.69039 2 3.00016 2H13.0002C13.3099 2 13.4648 2 13.5936 2.02562C14.1225 2.13083 14.536 2.54429 14.6412 3.07321C14.6668 3.20201 14.6668 3.3569 14.6668 3.66667C14.6668 3.97644 14.6668 4.13132 14.6412 4.26012C14.536 4.78904 14.1225 5.2025 13.5936 5.30771C13.5222 5.32191 13.4428 5.32824 13.3335 5.33106M6.66683 8.66667H9.3335M2.66683 5.33333H13.3335V10.8C13.3335 11.9201 13.3335 12.4802 13.1155 12.908C12.9238 13.2843 12.6178 13.5903 12.2415 13.782C11.8137 14 11.2536 14 10.1335 14H5.86683C4.74672 14 4.18667 14 3.75885 13.782C3.38252 13.5903 3.07656 13.2843 2.88482 12.908C2.66683 12.4802 2.66683 11.9201 2.66683 10.8V5.33333Z"
stroke=
"#667085"
stroke
-
width=
"1.5"
stroke
-
linecap=
"round"
stroke
-
l
inejoin=
"round"
/>
<
path
d=
"M2.66683 5.33106C2.55749 5.32824 2.47809 5.32191 2.40671 5.30771C1.87779 5.2025 1.46432 4.78904 1.35912 4.26012C1.3335 4.13132 1.3335 3.97644 1.3335 3.66667C1.3335 3.3569 1.3335 3.20201 1.35912 3.07321C1.46432 2.54429 1.87779 2.13083 2.40671 2.02562C2.53551 2 2.69039 2 3.00016 2H13.0002C13.3099 2 13.4648 2 13.5936 2.02562C14.1225 2.13083 14.536 2.54429 14.6412 3.07321C14.6668 3.20201 14.6668 3.3569 14.6668 3.66667C14.6668 3.97644 14.6668 4.13132 14.6412 4.26012C14.536 4.78904 14.1225 5.2025 13.5936 5.30771C13.5222 5.32191 13.4428 5.32824 13.3335 5.33106M6.66683 8.66667H9.3335M2.66683 5.33333H13.3335V10.8C13.3335 11.9201 13.3335 12.4802 13.1155 12.908C12.9238 13.2843 12.6178 13.5903 12.2415 13.782C11.8137 14 11.2536 14 10.1335 14H5.86683C4.74672 14 4.18667 14 3.75885 13.782C3.38252 13.5903 3.07656 13.2843 2.88482 12.908C2.66683 12.4802 2.66683 11.9201 2.66683 10.8V5.33333Z"
stroke=
"#667085"
stroke
Width=
"1.5"
strokeLinecap=
"round"
strokeL
inejoin=
"round"
/>
</
svg
>
</
svg
>
}
}
...
@@ -59,12 +60,12 @@ export const useIndexStatus = () => {
...
@@ -59,12 +60,12 @@ export const useIndexStatus = () => {
// status item for list
// status item for list
export
const
StatusItem
:
FC
<
{
export
const
StatusItem
:
FC
<
{
status
:
DocumentDisplayStatus
;
status
:
DocumentDisplayStatus
reverse
?:
boolean
;
reverse
?:
boolean
scene
?:
'list'
|
'detail'
scene
?:
'list'
|
'detail'
textCls
?:
string
textCls
?:
string
}
>
=
({
status
,
reverse
=
false
,
scene
=
'list'
,
textCls
=
''
})
=>
{
}
>
=
({
status
,
reverse
=
false
,
scene
=
'list'
,
textCls
=
''
})
=>
{
const
DOC_INDEX_STATUS_MAP
=
useIndexStatus
()
;
const
DOC_INDEX_STATUS_MAP
=
useIndexStatus
()
const
localStatus
=
status
.
toLowerCase
()
as
keyof
typeof
DOC_INDEX_STATUS_MAP
const
localStatus
=
status
.
toLowerCase
()
as
keyof
typeof
DOC_INDEX_STATUS_MAP
return
<
div
className=
{
return
<
div
className=
{
cn
(
'flex items-center'
,
cn
(
'flex items-center'
,
...
@@ -81,11 +82,11 @@ type OperationName = 'delete' | 'archive' | 'enable' | 'disable'
...
@@ -81,11 +82,11 @@ type OperationName = 'delete' | 'archive' | 'enable' | 'disable'
// operation action for list and detail
// operation action for list and detail
export
const
OperationAction
:
FC
<
{
export
const
OperationAction
:
FC
<
{
detail
:
{
detail
:
{
enabled
:
boolean
;
enabled
:
boolean
archived
:
boolean
;
archived
:
boolean
id
:
string
id
:
string
}
}
datasetId
:
string
;
datasetId
:
string
onUpdate
:
()
=>
void
onUpdate
:
()
=>
void
scene
?:
'list'
|
'detail'
scene
?:
'list'
|
'detail'
className
?:
string
className
?:
string
...
@@ -95,7 +96,7 @@ export const OperationAction: FC<{
...
@@ -95,7 +96,7 @@ export const OperationAction: FC<{
const
{
notify
}
=
useContext
(
ToastContext
)
const
{
notify
}
=
useContext
(
ToastContext
)
const
{
t
}
=
useTranslation
()
const
{
t
}
=
useTranslation
()
const
isListScene
=
scene
===
'list'
;
const
isListScene
=
scene
===
'list'
const
onOperate
=
async
(
operationName
:
OperationName
)
=>
{
const
onOperate
=
async
(
operationName
:
OperationName
)
=>
{
let
opApi
=
deleteDocument
let
opApi
=
deleteDocument
...
@@ -123,16 +124,16 @@ export const OperationAction: FC<{
...
@@ -123,16 +124,16 @@ export const OperationAction: FC<{
return
<
div
return
<
div
className=
'flex items-center'
className=
'flex items-center'
onClick=
{
(
e
)
=>
e
.
stopPropagation
()
}
onClick=
{
e
=>
e
.
stopPropagation
()
}
>
>
{
isListScene
&&
<>
{
isListScene
&&
<>
{
archived
?
{
archived
<
Tooltip
selector=
{
`list-switch-${id}`
}
content=
{
t
(
'datasetDocuments.list.action.enableWarning'
)
as
string
}
className=
'!font-semibold'
>
?
<
Tooltip
selector=
{
`list-switch-${id}`
}
content=
{
t
(
'datasetDocuments.list.action.enableWarning'
)
as
string
}
className=
'!font-semibold'
>
<
div
>
<
div
>
<
Switch
defaultValue=
{
false
}
onChange=
{
()
=>
{
}
}
disabled=
{
true
}
size=
'md'
/>
<
Switch
defaultValue=
{
false
}
onChange=
{
()
=>
{
}
}
disabled=
{
true
}
size=
'md'
/>
</
div
>
</
div
>
</
Tooltip
>
:
</
Tooltip
>
<
Switch
defaultValue=
{
enabled
}
onChange=
{
v
=>
onOperate
(
v
?
'enable'
:
'disable'
)
}
size=
'md'
/>
:
<
Switch
defaultValue=
{
enabled
}
onChange=
{
v
=>
onOperate
(
v
?
'enable'
:
'disable'
)
}
size=
'md'
/>
}
}
<
Divider
className=
'!ml-4 !mr-2 !h-3'
type=
'vertical'
/>
<
Divider
className=
'!ml-4 !mr-2 !h-3'
type=
'vertical'
/>
</>
}
</>
}
...
@@ -187,7 +188,7 @@ export const OperationAction: FC<{
...
@@ -187,7 +188,7 @@ export const OperationAction: FC<{
trigger=
'click'
trigger=
'click'
position=
'br'
position=
'br'
btnElement=
{
<
div
className=
{
cn
(
s
.
actionIcon
,
s
.
commonIcon
)
}
/>
}
btnElement=
{
<
div
className=
{
cn
(
s
.
actionIcon
,
s
.
commonIcon
)
}
/>
}
btnClassName=
{
(
open
)
=>
cn
(
isListScene
?
s
.
actionIconWrapperList
:
s
.
actionIconWrapperDetail
,
open
?
'!bg-gray-100 !shadow-none'
:
'!bg-transparent'
)
}
btnClassName=
{
open
=>
cn
(
isListScene
?
s
.
actionIconWrapperList
:
s
.
actionIconWrapperDetail
,
open
?
'!bg-gray-100 !shadow-none'
:
'!bg-transparent'
)
}
className=
{
`!w-[200px] h-fit !z-20 ${className}`
}
className=
{
`!w-[200px] h-fit !z-20 ${className}`
}
/>
/>
{
showModal
&&
<
Modal
isShow=
{
showModal
}
onClose=
{
()
=>
setShowModal
(
false
)
}
className=
{
s
.
delModal
}
closable
>
{
showModal
&&
<
Modal
isShow=
{
showModal
}
onClose=
{
()
=>
setShowModal
(
false
)
}
className=
{
s
.
delModal
}
closable
>
...
@@ -221,12 +222,12 @@ export const renderTdValue = (value: string | number | null, isEmptyStyle = fals
...
@@ -221,12 +222,12 @@ export const renderTdValue = (value: string | number | null, isEmptyStyle = fals
}
}
const
renderCount
=
(
count
:
number
|
undefined
)
=>
{
const
renderCount
=
(
count
:
number
|
undefined
)
=>
{
if
(
!
count
)
{
if
(
!
count
)
return
renderTdValue
(
0
,
true
)
return
renderTdValue
(
0
,
true
)
}
if
(
count
<
1000
)
{
if
(
count
<
1000
)
return
count
;
return
count
}
return
`
${
formatNumber
((
count
/
1000
).
toFixed
(
1
))}
k`
return
`
${
formatNumber
((
count
/
1000
).
toFixed
(
1
))}
k`
}
}
...
@@ -242,20 +243,21 @@ type IDocumentListProps = {
...
@@ -242,20 +243,21 @@ type IDocumentListProps = {
const
DocumentList
:
FC
<
IDocumentListProps
>
=
({
documents
=
[],
datasetId
,
onUpdate
})
=>
{
const
DocumentList
:
FC
<
IDocumentListProps
>
=
({
documents
=
[],
datasetId
,
onUpdate
})
=>
{
const
{
t
}
=
useTranslation
()
const
{
t
}
=
useTranslation
()
const
router
=
useRouter
()
const
router
=
useRouter
()
const
[
localDocs
,
setLocalDocs
]
=
useState
<
DocumentListResponse
[
'data'
]
>
(
documents
)
;
const
[
localDocs
,
setLocalDocs
]
=
useState
<
DocumentListResponse
[
'data'
]
>
(
documents
)
const
[
enableSort
,
setEnableSort
]
=
useState
(
false
)
;
const
[
enableSort
,
setEnableSort
]
=
useState
(
false
)
useEffect
(()
=>
{
useEffect
(()
=>
{
setLocalDocs
(
documents
)
setLocalDocs
(
documents
)
},
[
documents
])
},
[
documents
])
const
onClickSort
=
()
=>
{
const
onClickSort
=
()
=>
{
setEnableSort
(
!
enableSort
)
;
setEnableSort
(
!
enableSort
)
if
(
!
enableSort
)
{
if
(
!
enableSort
)
{
const
sortedDocs
=
[...
localDocs
].
sort
((
a
,
b
)
=>
dayjs
(
a
.
created_at
).
isBefore
(
dayjs
(
b
.
created_at
))
?
-
1
:
1
);
const
sortedDocs
=
[...
localDocs
].
sort
((
a
,
b
)
=>
dayjs
(
a
.
created_at
).
isBefore
(
dayjs
(
b
.
created_at
))
?
-
1
:
1
)
setLocalDocs
(
sortedDocs
);
setLocalDocs
(
sortedDocs
)
}
else
{
}
setLocalDocs
(
documents
);
else
{
setLocalDocs
(
documents
)
}
}
}
}
...
@@ -290,7 +292,7 @@ const DocumentList: FC<IDocumentListProps> = ({ documents = [], datasetId, onUpd
...
@@ -290,7 +292,7 @@ const DocumentList: FC<IDocumentListProps> = ({ documents = [], datasetId, onUpd
<
td
className=
'text-left align-middle text-gray-500 text-xs'
>
{
doc
.
position
}
</
td
>
<
td
className=
'text-left align-middle text-gray-500 text-xs'
>
{
doc
.
position
}
</
td
>
<
td
className=
{
s
.
tdValue
}
>
<
td
className=
{
s
.
tdValue
}
>
<
div
className=
{
cn
(
s
[
`${doc?.data_source_info?.upload_file?.extension ?? suffix}Icon`
],
s
.
commonIcon
,
'mr-1.5'
)
}
></
div
>
<
div
className=
{
cn
(
s
[
`${doc?.data_source_info?.upload_file?.extension ?? suffix}Icon`
],
s
.
commonIcon
,
'mr-1.5'
)
}
></
div
>
<
span
>
{
doc
?.
name
?.
replace
(
/
\.[^/
.
]
+$/
,
""
)
}
<
span
className=
'text-gray-500'
>
.
{
suffix
}
</
span
></
span
>
<
span
>
{
doc
?.
name
?.
replace
(
/
\.[^/
.
]
+$/
,
''
)
}
<
span
className=
'text-gray-500'
>
.
{
suffix
}
</
span
></
span
>
</
td
>
</
td
>
<
td
>
{
renderCount
(
doc
.
word_count
)
}
</
td
>
<
td
>
{
renderCount
(
doc
.
word_count
)
}
</
td
>
<
td
>
{
renderCount
(
doc
.
hit_count
)
}
</
td
>
<
td
>
{
renderCount
(
doc
.
hit_count
)
}
</
td
>
...
...
web/app/components/explore/app-card/index.tsx
View file @
91bcbd0b
'use client'
'use client'
import
cn
from
'classnames'
import
cn
from
'classnames'
import
{
useTranslation
}
from
'react-i18next'
import
{
useTranslation
}
from
'react-i18next'
import
{
App
}
from
'@/models/explore'
import
AppModeLabel
from
'@/app/(commonLayout)/apps/AppModeLabel'
import
AppIcon
from
'@/app/components/base/app-icon'
import
{
PlusIcon
}
from
'@heroicons/react/20/solid'
import
{
PlusIcon
}
from
'@heroicons/react/20/solid'
import
Button
from
'../../base/button'
import
Button
from
'../../base/button'
import
s
from
'./style.module.css'
import
s
from
'./style.module.css'
import
type
{
App
}
from
'@/models/explore'
import
AppModeLabel
from
'@/app/(commonLayout)/apps/AppModeLabel'
import
AppIcon
from
'@/app/components/base/app-icon'
const
CustomizeBtn
=
(
const
CustomizeBtn
=
(
<
svg
width=
"15"
height=
"14"
viewBox=
"0 0 15 14"
fill=
"none"
xmlns=
"http://www.w3.org/2000/svg"
>
<
svg
width=
"15"
height=
"14"
viewBox=
"0 0 15 14"
fill=
"none"
xmlns=
"http://www.w3.org/2000/svg"
>
<
path
d=
"M7.5 2.33366C6.69458 2.33366 6.04167 2.98658 6.04167 3.79199C6.04167 4.59741 6.69458 5.25033 7.5 5.25033C8.30542 5.25033 8.95833 4.59741 8.95833 3.79199C8.95833 2.98658 8.30542 2.33366 7.5 2.33366ZM7.5 2.33366V1.16699M12.75 8.71385C11.4673 10.1671 9.59071 11.0837 7.5 11.0837C5.40929 11.0837 3.53265 10.1671 2.25 8.71385M6.76782 5.05298L2.25 12.8337M8.23218 5.05298L12.75 12.8337"
stroke=
"#344054"
stroke
-
width=
"1.25"
stroke
-
linecap=
"round"
stroke
-
l
inejoin=
"round"
/>
<
path
d=
"M7.5 2.33366C6.69458 2.33366 6.04167 2.98658 6.04167 3.79199C6.04167 4.59741 6.69458 5.25033 7.5 5.25033C8.30542 5.25033 8.95833 4.59741 8.95833 3.79199C8.95833 2.98658 8.30542 2.33366 7.5 2.33366ZM7.5 2.33366V1.16699M12.75 8.71385C11.4673 10.1671 9.59071 11.0837 7.5 11.0837C5.40929 11.0837 3.53265 10.1671 2.25 8.71385M6.76782 5.05298L2.25 12.8337M8.23218 5.05298L12.75 12.8337"
stroke=
"#344054"
stroke
Width=
"1.25"
strokeLinecap=
"round"
strokeL
inejoin=
"round"
/>
</
svg
>
</
svg
>
)
)
export
type
AppCardProps
=
{
export
type
AppCardProps
=
{
app
:
App
,
app
:
App
canCreate
:
boolean
,
canCreate
:
boolean
onCreate
:
()
=>
void
,
onCreate
:
()
=>
void
onAddToWorkspace
:
(
appId
:
string
)
=>
void
,
onAddToWorkspace
:
(
appId
:
string
)
=>
void
}
}
const
AppCard
=
({
const
AppCard
=
({
...
@@ -29,7 +28,7 @@ const AppCard = ({
...
@@ -29,7 +28,7 @@ const AppCard = ({
onAddToWorkspace
,
onAddToWorkspace
,
}:
AppCardProps
)
=>
{
}:
AppCardProps
)
=>
{
const
{
t
}
=
useTranslation
()
const
{
t
}
=
useTranslation
()
const
{
app
:
appBasicInfo
}
=
app
const
{
app
:
appBasicInfo
}
=
app
return
(
return
(
<
div
className=
{
s
.
wrap
}
>
<
div
className=
{
s
.
wrap
}
>
<
div
className=
'col-span-1 bg-white border-2 border-solid border-transparent rounded-lg shadow-sm min-h-[160px] flex flex-col transition-all duration-200 ease-in-out cursor-pointer hover:shadow-lg'
>
<
div
className=
'col-span-1 bg-white border-2 border-solid border-transparent rounded-lg shadow-sm min-h-[160px] flex flex-col transition-all duration-200 ease-in-out cursor-pointer hover:shadow-lg'
>
...
...
web/app/components/explore/sidebar/index.tsx
View file @
91bcbd0b
'use client'
'use client'
import
React
,
{
FC
,
useEffect
,
useState
}
from
'react'
import
type
{
FC
}
from
'react'
import
React
,
{
useEffect
,
useState
}
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
ExploreContext
from
'@/context/explore-context'
import
cn
from
'classnames'
import
cn
from
'classnames'
import
{
useSelectedLayoutSegments
}
from
'next/navigation'
import
{
useSelectedLayoutSegments
}
from
'next/navigation'
import
Link
from
'next/link'
import
Link
from
'next/link'
import
Item
from
'./app-nav-item'
import
{
fetchInstalledAppList
as
doFetchInstalledAppList
,
uninstallApp
,
updatePinStatus
}
from
'@/service/explore'
import
Toast
from
'../../base/toast'
import
Toast
from
'../../base/toast'
import
Item
from
'./app-nav-item'
import
{
fetchInstalledAppList
as
doFetchInstalledAppList
,
uninstallApp
,
updatePinStatus
}
from
'@/service/explore'
import
ExploreContext
from
'@/context/explore-context'
import
Confirm
from
'@/app/components/base/confirm'
import
Confirm
from
'@/app/components/base/confirm'
const
SelectedDiscoveryIcon
=
()
=>
(
const
SelectedDiscoveryIcon
=
()
=>
(
...
@@ -19,12 +20,12 @@ const SelectedDiscoveryIcon = () => (
...
@@ -19,12 +20,12 @@ const SelectedDiscoveryIcon = () => (
const
DiscoveryIcon
=
()
=>
(
const
DiscoveryIcon
=
()
=>
(
<
svg
width=
"16"
height=
"16"
viewBox=
"0 0 16 16"
fill=
"none"
xmlns=
"http://www.w3.org/2000/svg"
>
<
svg
width=
"16"
height=
"16"
viewBox=
"0 0 16 16"
fill=
"none"
xmlns=
"http://www.w3.org/2000/svg"
>
<
path
d=
"M8.74786 9.89676L12.0003 14.6669M7.25269 9.89676L4.00027 14.6669M9.3336 8.80031C9.3336 9.53669 8.73665 10.1336 8.00027 10.1336C7.26389 10.1336 6.66694 9.53669 6.66694 8.80031C6.66694 8.06393 7.26389 7.46698 8.00027 7.46698C8.73665 7.46698 9.3336 8.06393 9.3336 8.80031ZM11.4326 3.02182L3.57641 5.12689C3.39609 5.1752 3.30593 5.19936 3.24646 5.25291C3.19415 5.30001 3.15809 5.36247 3.14345 5.43132C3.12681 5.5096 3.15097 5.59976 3.19929 5.78008L3.78595 7.96951C3.83426 8.14984 3.85842 8.24 3.91197 8.29947C3.95907 8.35178 4.02153 8.38784 4.09038 8.40248C4.16866 8.41911 4.25882 8.39496 4.43914 8.34664L12.2953 6.24158L11.4326 3.02182ZM14.5285 6.33338C13.8072 6.52665 13.4466 6.62328 13.1335 6.55673C12.8581 6.49819 12.6082 6.35396 12.4198 6.14471C12.2056 5.90682 12.109 5.54618 11.9157 4.82489L11.8122 4.43852C11.6189 3.71722 11.5223 3.35658 11.5889 3.04347C11.6474 2.76805 11.7916 2.51823 12.0009 2.32982C12.2388 2.11563 12.5994 2.019 13.3207 1.82573C13.501 1.77741 13.5912 1.75325 13.6695 1.76989C13.7383 1.78452 13.8008 1.82058 13.8479 1.87289C13.9014 1.93237 13.9256 2.02253 13.9739 2.20285L14.9057 5.68018C14.954 5.86051 14.9781 5.95067 14.9615 6.02894C14.9469 6.0978 14.9108 6.16025 14.8585 6.20736C14.799 6.2609 14.7088 6.28506 14.5285 6.33338ZM2.33475 8.22033L3.23628 7.97876C3.4166 7.93044 3.50676 7.90628 3.56623 7.85274C3.61854 7.80563 3.6546 7.74318 3.66924 7.67433C3.68588 7.59605 3.66172 7.50589 3.6134 7.32556L3.37184 6.42403C3.32352 6.24371 3.29936 6.15355 3.24581 6.09408C3.19871 6.04176 3.13626 6.00571 3.0674 5.99107C2.98912 5.97443 2.89896 5.99859 2.71864 6.04691L1.81711 6.28847C1.63678 6.33679 1.54662 6.36095 1.48715 6.4145C1.43484 6.4616 1.39878 6.52405 1.38415 6.59291C1.36751 6.67119 1.39167 6.76135 1.43998 6.94167L1.68155 7.8432C1.72987 8.02352 1.75402 8.11369 1.80757 8.17316C1.85467 8.22547 1.91713 8.26153 1.98598 8.27616C2.06426 8.2928 2.15442 8.26864 2.33475 8.22033Z"
stroke=
"#344054"
stroke
-
width=
"1.25"
stroke
-
linecap=
"round"
stroke
-
l
inejoin=
"round"
/>
<
path
d=
"M8.74786 9.89676L12.0003 14.6669M7.25269 9.89676L4.00027 14.6669M9.3336 8.80031C9.3336 9.53669 8.73665 10.1336 8.00027 10.1336C7.26389 10.1336 6.66694 9.53669 6.66694 8.80031C6.66694 8.06393 7.26389 7.46698 8.00027 7.46698C8.73665 7.46698 9.3336 8.06393 9.3336 8.80031ZM11.4326 3.02182L3.57641 5.12689C3.39609 5.1752 3.30593 5.19936 3.24646 5.25291C3.19415 5.30001 3.15809 5.36247 3.14345 5.43132C3.12681 5.5096 3.15097 5.59976 3.19929 5.78008L3.78595 7.96951C3.83426 8.14984 3.85842 8.24 3.91197 8.29947C3.95907 8.35178 4.02153 8.38784 4.09038 8.40248C4.16866 8.41911 4.25882 8.39496 4.43914 8.34664L12.2953 6.24158L11.4326 3.02182ZM14.5285 6.33338C13.8072 6.52665 13.4466 6.62328 13.1335 6.55673C12.8581 6.49819 12.6082 6.35396 12.4198 6.14471C12.2056 5.90682 12.109 5.54618 11.9157 4.82489L11.8122 4.43852C11.6189 3.71722 11.5223 3.35658 11.5889 3.04347C11.6474 2.76805 11.7916 2.51823 12.0009 2.32982C12.2388 2.11563 12.5994 2.019 13.3207 1.82573C13.501 1.77741 13.5912 1.75325 13.6695 1.76989C13.7383 1.78452 13.8008 1.82058 13.8479 1.87289C13.9014 1.93237 13.9256 2.02253 13.9739 2.20285L14.9057 5.68018C14.954 5.86051 14.9781 5.95067 14.9615 6.02894C14.9469 6.0978 14.9108 6.16025 14.8585 6.20736C14.799 6.2609 14.7088 6.28506 14.5285 6.33338ZM2.33475 8.22033L3.23628 7.97876C3.4166 7.93044 3.50676 7.90628 3.56623 7.85274C3.61854 7.80563 3.6546 7.74318 3.66924 7.67433C3.68588 7.59605 3.66172 7.50589 3.6134 7.32556L3.37184 6.42403C3.32352 6.24371 3.29936 6.15355 3.24581 6.09408C3.19871 6.04176 3.13626 6.00571 3.0674 5.99107C2.98912 5.97443 2.89896 5.99859 2.71864 6.04691L1.81711 6.28847C1.63678 6.33679 1.54662 6.36095 1.48715 6.4145C1.43484 6.4616 1.39878 6.52405 1.38415 6.59291C1.36751 6.67119 1.39167 6.76135 1.43998 6.94167L1.68155 7.8432C1.72987 8.02352 1.75402 8.11369 1.80757 8.17316C1.85467 8.22547 1.91713 8.26153 1.98598 8.27616C2.06426 8.2928 2.15442 8.26864 2.33475 8.22033Z"
stroke=
"#344054"
stroke
Width=
"1.25"
strokeLinecap=
"round"
strokeL
inejoin=
"round"
/>
</
svg
>
</
svg
>
)
)
const
SideBar
:
FC
<
{
const
SideBar
:
FC
<
{
controlUpdateInstalledApps
:
number
,
controlUpdateInstalledApps
:
number
}
>
=
({
}
>
=
({
controlUpdateInstalledApps
,
controlUpdateInstalledApps
,
})
=>
{
})
=>
{
...
@@ -35,10 +36,10 @@ const SideBar: FC<{
...
@@ -35,10 +36,10 @@ const SideBar: FC<{
const
{
installedApps
,
setInstalledApps
}
=
useContext
(
ExploreContext
)
const
{
installedApps
,
setInstalledApps
}
=
useContext
(
ExploreContext
)
const
fetchInstalledAppList
=
async
()
=>
{
const
fetchInstalledAppList
=
async
()
=>
{
const
{
installed_apps
}
:
any
=
await
doFetchInstalledAppList
()
const
{
installed_apps
}
:
any
=
await
doFetchInstalledAppList
()
setInstalledApps
(
installed_apps
)
setInstalledApps
(
installed_apps
)
}
}
const
[
showConfirm
,
setShowConfirm
]
=
useState
(
false
)
const
[
showConfirm
,
setShowConfirm
]
=
useState
(
false
)
const
[
currId
,
setCurrId
]
=
useState
(
''
)
const
[
currId
,
setCurrId
]
=
useState
(
''
)
const
handleDelete
=
async
()
=>
{
const
handleDelete
=
async
()
=>
{
...
@@ -47,7 +48,7 @@ const SideBar: FC<{
...
@@ -47,7 +48,7 @@ const SideBar: FC<{
setShowConfirm
(
false
)
setShowConfirm
(
false
)
Toast
.
notify
({
Toast
.
notify
({
type
:
'success'
,
type
:
'success'
,
message
:
t
(
'common.api.remove'
)
message
:
t
(
'common.api.remove'
)
,
})
})
fetchInstalledAppList
()
fetchInstalledAppList
()
}
}
...
@@ -56,7 +57,7 @@ const SideBar: FC<{
...
@@ -56,7 +57,7 @@ const SideBar: FC<{
await
updatePinStatus
(
id
,
isPinned
)
await
updatePinStatus
(
id
,
isPinned
)
Toast
.
notify
({
Toast
.
notify
({
type
:
'success'
,
type
:
'success'
,
message
:
t
(
'common.api.success'
)
message
:
t
(
'common.api.success'
)
,
})
})
fetchInstalledAppList
()
fetchInstalledAppList
()
}
}
...
@@ -74,8 +75,8 @@ const SideBar: FC<{
...
@@ -74,8 +75,8 @@ const SideBar: FC<{
<
div
>
<
div
>
<
Link
<
Link
href=
'/explore/apps'
href=
'/explore/apps'
className=
{
cn
(
isDiscoverySelected
?
'text-primary-600 bg-white font-semibold'
:
'text-gray-700 font-medium'
,
'flex items-center h-9 pl-3 space-x-2 rounded-lg'
)
}
className=
{
cn
(
isDiscoverySelected
?
'text-primary-600 bg-white font-semibold'
:
'text-gray-700 font-medium'
,
'flex items-center h-9 pl-3 space-x-2 rounded-lg'
)
}
style=
{
isDiscoverySelected
?
{
boxShadow
:
'0px 1px 2px rgba(16, 24, 40, 0.05)'
}
:
{}
}
style=
{
isDiscoverySelected
?
{
boxShadow
:
'0px 1px 2px rgba(16, 24, 40, 0.05)'
}
:
{}
}
>
>
{
isDiscoverySelected
?
<
SelectedDiscoveryIcon
/>
:
<
DiscoveryIcon
/>
}
{
isDiscoverySelected
?
<
SelectedDiscoveryIcon
/>
:
<
DiscoveryIcon
/>
}
<
div
className=
'text-sm'
>
{
t
(
'explore.sidebar.discovery'
)
}
</
div
>
<
div
className=
'text-sm'
>
{
t
(
'explore.sidebar.discovery'
)
}
</
div
>
...
@@ -86,12 +87,12 @@ const SideBar: FC<{
...
@@ -86,12 +87,12 @@ const SideBar: FC<{
<
div
className=
'pl-2 text-xs text-gray-500 font-medium uppercase'
>
{
t
(
'explore.sidebar.workspace'
)
}
</
div
>
<
div
className=
'pl-2 text-xs text-gray-500 font-medium uppercase'
>
{
t
(
'explore.sidebar.workspace'
)
}
</
div
>
<
div
className=
'mt-3 space-y-1 overflow-y-auto overflow-x-hidden pb-20'
<
div
className=
'mt-3 space-y-1 overflow-y-auto overflow-x-hidden pb-20'
style=
{
{
style=
{
{
maxHeight
:
'calc(100vh - 250px)'
maxHeight
:
'calc(100vh - 250px)'
,
}
}
}
}
>
>
{
installedApps
.
map
(({
id
,
is_pinned
,
uninstallable
,
app
:
{
name
,
icon
,
icon_background
}
})
=>
{
{
installedApps
.
map
(({
id
,
is_pinned
,
uninstallable
,
app
:
{
name
,
icon
,
icon_background
}
})
=>
{
return
(
return
(
<
Item
<
Item
key=
{
id
}
key=
{
id
}
name=
{
name
}
name=
{
name
}
icon=
{
icon
}
icon=
{
icon
}
...
@@ -112,15 +113,15 @@ const SideBar: FC<{
...
@@ -112,15 +113,15 @@ const SideBar: FC<{
</
div
>
</
div
>
)
}
)
}
{
showConfirm
&&
(
{
showConfirm
&&
(
<
Confirm
<
Confirm
title=
{
t
(
'explore.sidebar.delete.title'
)
}
title=
{
t
(
'explore.sidebar.delete.title'
)
}
content=
{
t
(
'explore.sidebar.delete.content'
)
}
content=
{
t
(
'explore.sidebar.delete.content'
)
}
isShow=
{
showConfirm
}
isShow=
{
showConfirm
}
onClose=
{
()
=>
setShowConfirm
(
false
)
}
onClose=
{
()
=>
setShowConfirm
(
false
)
}
onConfirm=
{
handleDelete
}
onConfirm=
{
handleDelete
}
onCancel=
{
()
=>
setShowConfirm
(
false
)
}
onCancel=
{
()
=>
setShowConfirm
(
false
)
}
/>
/>
)
}
)
}
</
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