@@ -12,6 +12,7 @@ import Textarea from './textarea'
12
12
import s from './style.module.css'
13
13
import ModifyRetrievalModal from './modify-retrieval-modal'
14
14
import ResultItem from './components/result-item'
15
+ import ResultItemExternal from "./components/result-item-external"
15
16
import cn from '@/utils/classnames'
16
17
import type { ExternalKnowledgeBaseHitTestingResponse , HitTestingResponse } from '@/models/datasets'
17
18
import Loading from '@/app/components/base/loading'
@@ -24,6 +25,7 @@ import type { RetrievalConfig } from '@/types/app'
24
25
import useBreakpoints , { MediaType } from '@/hooks/use-breakpoints'
25
26
import useTimestamp from '@/hooks/use-timestamp'
26
27
import docStyle from '@/app/components/datasets/documents/detail/completed/style.module.css'
28
+ import type { HitTesting , ExternalKnowledgeBaseHitTesting } from "@/models/datasets"
27
29
28
30
const limit = 10
29
31
@@ -68,22 +70,27 @@ const HitTesting: FC<Props> = ({ datasetId }: Props) => {
68
70
const [ retrievalConfig , setRetrievalConfig ] = useState ( currentDataset ?. retrieval_model_dict as RetrievalConfig )
69
71
const [ isShowModifyRetrievalModal , setIsShowModifyRetrievalModal ] = useState ( false )
70
72
const [ isShowRightPanel , { setTrue : showRightPanel , setFalse : hideRightPanel , set : setShowRightPanel } ] = useBoolean ( ! isMobile )
71
- const renderHitResults = ( results : any [ ] ) => (
72
- < div className = 'h-full flex flex-col py-3 px-4 rounded-t-2xl bg-background-body' >
73
- < div className = 'shrink-0 pl-2 text-text-primary font-semibold leading-6 mb-2' >
74
- { t ( 'datasetHitTesting.hit.title' , { num : results . length } ) }
73
+ const renderHitResults = (
74
+ results : HitTesting [ ] | ExternalKnowledgeBaseHitTesting [ ]
75
+ ) => (
76
+ < div className = "h-full flex flex-col py-3 px-4 rounded-t-2xl bg-background-body" >
77
+ < div className = "shrink-0 pl-2 text-text-primary font-semibold leading-6 mb-2" >
78
+ { t ( "datasetHitTesting.hit.title" , { num : results . length } ) }
75
79
</ div >
76
- < div className = 'grow overflow-y-auto space-y-2' >
77
- { results . map ( ( record , idx ) => (
78
- < ResultItem
79
- key = { idx }
80
- payload = { record }
81
- isExternal = { isExternal }
82
- />
83
- ) ) }
80
+ < div className = "grow overflow-y-auto space-y-2" >
81
+ { results . map ( ( record , idx ) =>
82
+ isExternal ? (
83
+ < ResultItemExternal
84
+ key = { idx }
85
+ payload = { record as ExternalKnowledgeBaseHitTesting }
86
+ />
87
+ ) : (
88
+ < ResultItem key = { idx } payload = { record as HitTesting } />
89
+ )
90
+ ) }
84
91
</ div >
85
92
</ div >
86
- )
93
+ ) ;
87
94
88
95
const renderEmptyState = ( ) => (
89
96
< div className = 'h-full flex flex-col justify-center items-center py-3 px-4 rounded-t-2xl bg-background-body' >
0 commit comments