2025-05-07 11:30:13 +08:00
import { usePipelineTemplateList } from '@/service/use-pipeline'
2025-05-03 17:16:00 +08:00
import TemplateCard from './template-card'
2025-05-07 11:30:13 +08:00
import { ChunkingMode } from '@/models/datasets'
2025-05-14 10:48:54 +08:00
import type { PipelineTemplate } from '@/models/pipeline'
2025-05-03 17:16:00 +08:00
const BuiltInPipelineList = ( ) = > {
2025-05-07 11:30:13 +08:00
// TODO: remove mock data
2025-05-14 10:48:54 +08:00
const mockData : PipelineTemplate [ ] = [ {
2025-05-03 17:16:00 +08:00
id : '1' ,
name : 'Pipeline 1' ,
description : 'This is a description of Pipeline 1. When use the general chunking mode, the chunks retrieved and recalled are the same. When use the general chunking mode, the chunks retrieved and recalled are the same.' ,
2025-05-07 11:30:13 +08:00
icon_info : {
icon : '🤖' ,
icon_background : '#F0FDF9' ,
icon_type : 'emoji' ,
} ,
2025-05-03 17:16:00 +08:00
doc_form : ChunkingMode.text ,
2025-05-07 11:30:13 +08:00
position : 0 ,
2025-05-03 17:16:00 +08:00
} , {
id : '2' ,
name : 'Pipeline 2' ,
description : 'This is a description of Pipeline 2. When use the general chunking mode, the chunks retrieved and recalled are the same.' ,
2025-05-07 11:30:13 +08:00
icon_info : {
icon : '🏖️' ,
icon_background : '#FFF4ED' ,
icon_type : 'emoji' ,
} ,
2025-05-03 17:16:00 +08:00
doc_form : ChunkingMode.parentChild ,
2025-05-07 11:30:13 +08:00
position : 1 ,
2025-05-03 17:16:00 +08:00
} , {
id : '3' ,
name : 'Pipeline 3' ,
description : 'This is a description of Pipeline 3' ,
2025-05-07 11:30:13 +08:00
icon_info : {
icon : '🚀' ,
icon_background : '#FEFBE8' ,
icon_type : 'emoji' ,
} ,
2025-05-03 17:16:00 +08:00
doc_form : ChunkingMode.qa ,
2025-05-07 11:30:13 +08:00
position : 2 ,
2025-05-03 17:16:00 +08:00
} , {
id : '4' ,
name : 'Pipeline 4' ,
description : 'This is a description of Pipeline 4' ,
2025-05-07 11:30:13 +08:00
icon_info : {
icon : '🍯' ,
icon_background : '#F5F3FF' ,
icon_type : 'emoji' ,
} ,
2025-05-03 17:16:00 +08:00
doc_form : ChunkingMode.graph ,
2025-05-07 11:30:13 +08:00
position : 3 ,
2025-05-03 17:16:00 +08:00
} ]
2025-05-07 11:30:13 +08:00
const { data : pipelineList , isLoading } = usePipelineTemplateList ( { type : 'built-in' } )
const list = pipelineList ? . pipelines || mockData
if ( isLoading || ! list )
return null
2025-05-03 17:16:00 +08:00
return (
< div className = 'grid grow grid-cols-1 gap-3 overflow-y-auto px-16 pt-4 sm:grid-cols-2 md:grid-cols-3 lg:grid-cols-4' >
2025-05-07 11:30:13 +08:00
{ list . map ( ( pipeline , index ) = > (
2025-05-03 17:16:00 +08:00
< TemplateCard
key = { index }
pipeline = { pipeline }
showMoreOperations = { false }
/ >
) ) }
< / div >
)
}
export default BuiltInPipelineList