11import React , { useCallback , useMemo , useState } from 'react' ;
2- import { ModalBody , Box , useTheme , Flex , Progress } from '@chakra-ui/react' ;
2+ import { ModalBody , Box , useTheme , Flex , Progress , Link } from '@chakra-ui/react' ;
33import { getDatasetDataItemById } from '@/web/core/dataset/api' ;
44import { useLoading } from '@/web/common/hooks/useLoading' ;
55import { useToast } from '@/web/common/hooks/useToast' ;
@@ -13,6 +13,9 @@ import MyModal from '../MyModal';
1313import { useTranslation } from 'react-i18next' ;
1414import { useRouter } from 'next/router' ;
1515import type { SearchDataResponseItemType } from '@fastgpt/global/core/dataset/type' ;
16+ import MyTooltip from '../MyTooltip' ;
17+ import NextLink from 'next/link' ;
18+ import { useSystemStore } from '@/web/common/system/useSystemStore' ;
1619
1720const QuoteModal = ( {
1821 rawSearch = [ ] ,
@@ -22,6 +25,7 @@ const QuoteModal = ({
2225 onClose : ( ) => void ;
2326} ) => {
2427 const { t } = useTranslation ( ) ;
28+ const { isPc } = useSystemStore ( ) ;
2529 const theme = useTheme ( ) ;
2630 const router = useRouter ( ) ;
2731 const { toast } = useToast ( ) ;
@@ -67,7 +71,7 @@ const QuoteModal = ({
6771 title = {
6872 < >
6973 知识库引用({ rawSearch . length } 条)
70- < Box fontSize = { [ 'xs' , 'sm' ] } fontWeight = { 'normal' } >
74+ < Box fontSize = { '10px' } color = { 'myGray.500' } fontWeight = { 'normal' } >
7175 注意: 修改知识库内容成功后,此处不会显示变更情况。点击编辑后,会显示知识库最新的内容。
7276 </ Box >
7377 </ >
@@ -89,58 +93,83 @@ const QuoteModal = ({
8993 border = { theme . borders . base }
9094 _notLast = { { mb : 2 } }
9195 position = { 'relative' }
92- _hover = { { '& .edit' : { display : 'flex' } } }
9396 overflow = { 'hidden' }
9497 >
9598 { ! isShare && (
96- < Flex alignItems = { 'center ' } mb = { 1 } >
99+ < Flex alignItems = { 'flex-end ' } mb = { 1 } >
97100 < RawSourceText sourceName = { item . sourceName } sourceId = { item . sourceId } />
98- < Box flex = { '1' } />
99- { item . score && (
100- < >
101- < Progress
102- mx = { 2 }
103- w = { [ '60px' , '100px' ] }
104- value = { item . score * 100 }
105- size = "sm"
106- borderRadius = { '20px' }
107- colorScheme = "gray"
108- border = { theme . borders . base }
109- />
110- < Box > { item . score . toFixed ( 4 ) } </ Box >
111- </ >
112- ) }
101+ < Box flex = { 1 } />
102+ < Link
103+ as = { NextLink }
104+ display = { 'flex' }
105+ alignItems = { 'center' }
106+ color = { 'myBlue.600' }
107+ href = { `/dataset/detail?datasetId=${ item . datasetId } ¤tTab=dataCard&collectionId=${ item . collectionId } ` }
108+ >
109+ { t ( 'core.dataset.Go Dataset' ) }
110+ < MyIcon name = { 'rightArrowLight' } w = { '10px' } />
111+ </ Link >
113112 </ Flex >
114113 ) }
115114
116115 < Box > { item . q } </ Box >
117116 < Box > { item . a } </ Box >
118- { item . id && ! isShare && (
119- < Box
120- className = "edit"
121- display = { 'none' }
122- position = { 'absolute' }
123- right = { 0 }
124- top = { 0 }
125- bottom = { 0 }
126- w = { '40px' }
127- bg = { 'rgba(255,255,255,0.9)' }
128- alignItems = { 'center' }
129- justifyContent = { 'center' }
130- boxShadow = { '-10px 0 10px rgba(255,255,255,1)' }
131- >
132- < MyIcon
133- name = { 'edit' }
134- w = { '18px' }
135- h = { '18px' }
136- cursor = { 'pointer' }
137- color = { 'myGray.600' }
138- _hover = { {
139- color : 'myBlue.700'
140- } }
141- onClick = { ( ) => onclickEdit ( item ) }
142- />
143- </ Box >
117+ { ! isShare && (
118+ < Flex alignItems = { 'center' } mt = { 2 } gap = { 4 } >
119+ { isPc && (
120+ < MyTooltip label = { t ( 'core.dataset.data.id' ) } >
121+ < Flex border = { theme . borders . base } px = { 3 } borderRadius = { 'md' } >
122+ # { item . id }
123+ </ Flex >
124+ </ MyTooltip >
125+ ) }
126+ < MyTooltip label = { t ( 'core.dataset.Quote Length' ) } >
127+ < Flex alignItems = { 'center' } >
128+ < MyIcon name = "common/text/t" w = { '14px' } mr = { 1 } color = { 'myGray.500' } />
129+ { item . q . length + item . a . length }
130+ </ Flex >
131+ </ MyTooltip >
132+ { ! isShare && item . score && (
133+ < MyTooltip label = { t ( 'core.dataset.Similarity' ) } >
134+ < Flex alignItems = { 'center' } >
135+ < MyIcon name = { 'kbTest' } w = { '12px' } />
136+ < Progress
137+ mx = { 2 }
138+ w = { [ '60px' , '90px' ] }
139+ value = { item . score * 100 }
140+ size = "sm"
141+ borderRadius = { '20px' }
142+ colorScheme = "gray"
143+ border = { theme . borders . base }
144+ />
145+ < Box > { item . score . toFixed ( 4 ) } </ Box >
146+ </ Flex >
147+ </ MyTooltip >
148+ ) }
149+ < Box flex = { 1 } />
150+ { item . id && (
151+ < MyTooltip label = { t ( 'core.dataset.data.Edit' ) } >
152+ < Box
153+ bg = { 'rgba(255,255,255,0.9)' }
154+ alignItems = { 'center' }
155+ justifyContent = { 'center' }
156+ boxShadow = { '-10px 0 10px rgba(255,255,255,1)' }
157+ >
158+ < MyIcon
159+ name = { 'edit' }
160+ w = { [ '16px' , '18px' ] }
161+ h = { [ '16px' , '18px' ] }
162+ cursor = { 'pointer' }
163+ color = { 'myGray.600' }
164+ _hover = { {
165+ color : 'myBlue.700'
166+ } }
167+ onClick = { ( ) => onclickEdit ( item ) }
168+ />
169+ </ Box >
170+ </ MyTooltip >
171+ ) }
172+ </ Flex >
144173 ) }
145174 </ Box >
146175 ) ) }
0 commit comments