1
1
import 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' ;
3
3
import { getDatasetDataItemById } from '@/web/core/dataset/api' ;
4
4
import { useLoading } from '@/web/common/hooks/useLoading' ;
5
5
import { useToast } from '@/web/common/hooks/useToast' ;
@@ -13,6 +13,9 @@ import MyModal from '../MyModal';
13
13
import { useTranslation } from 'react-i18next' ;
14
14
import { useRouter } from 'next/router' ;
15
15
import 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' ;
16
19
17
20
const QuoteModal = ( {
18
21
rawSearch = [ ] ,
@@ -22,6 +25,7 @@ const QuoteModal = ({
22
25
onClose : ( ) => void ;
23
26
} ) => {
24
27
const { t } = useTranslation ( ) ;
28
+ const { isPc } = useSystemStore ( ) ;
25
29
const theme = useTheme ( ) ;
26
30
const router = useRouter ( ) ;
27
31
const { toast } = useToast ( ) ;
@@ -67,7 +71,7 @@ const QuoteModal = ({
67
71
title = {
68
72
< >
69
73
知识库引用({ rawSearch . length } 条)
70
- < Box fontSize = { [ 'xs' , 'sm' ] } fontWeight = { 'normal' } >
74
+ < Box fontSize = { '10px' } color = { 'myGray.500' } fontWeight = { 'normal' } >
71
75
注意: 修改知识库内容成功后,此处不会显示变更情况。点击编辑后,会显示知识库最新的内容。
72
76
</ Box >
73
77
</ >
@@ -89,58 +93,83 @@ const QuoteModal = ({
89
93
border = { theme . borders . base }
90
94
_notLast = { { mb : 2 } }
91
95
position = { 'relative' }
92
- _hover = { { '& .edit' : { display : 'flex' } } }
93
96
overflow = { 'hidden' }
94
97
>
95
98
{ ! isShare && (
96
- < Flex alignItems = { 'center ' } mb = { 1 } >
99
+ < Flex alignItems = { 'flex-end ' } mb = { 1 } >
97
100
< 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 >
113
112
</ Flex >
114
113
) }
115
114
116
115
< Box > { item . q } </ Box >
117
116
< 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 >
144
173
) }
145
174
</ Box >
146
175
) ) }
0 commit comments