You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

built-in-pipeline-list.tsx 2.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. import { usePipelineTemplateList } from '@/service/use-pipeline'
  2. import TemplateCard from './template-card'
  3. import { ChunkingMode } from '@/models/datasets'
  4. import type { PipelineTemple } from '@/models/pipeline'
  5. const BuiltInPipelineList = () => {
  6. // TODO: remove mock data
  7. const mockData: PipelineTemple[] = [{
  8. id: '1',
  9. name: 'Pipeline 1',
  10. 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.',
  11. icon_info: {
  12. icon: '🤖',
  13. icon_background: '#F0FDF9',
  14. icon_type: 'emoji',
  15. },
  16. doc_form: ChunkingMode.text,
  17. position: 0,
  18. }, {
  19. id: '2',
  20. name: 'Pipeline 2',
  21. description: 'This is a description of Pipeline 2. When use the general chunking mode, the chunks retrieved and recalled are the same.',
  22. icon_info: {
  23. icon: '🏖️',
  24. icon_background: '#FFF4ED',
  25. icon_type: 'emoji',
  26. },
  27. doc_form: ChunkingMode.parentChild,
  28. position: 1,
  29. }, {
  30. id: '3',
  31. name: 'Pipeline 3',
  32. description: 'This is a description of Pipeline 3',
  33. icon_info: {
  34. icon: '🚀',
  35. icon_background: '#FEFBE8',
  36. icon_type: 'emoji',
  37. },
  38. doc_form: ChunkingMode.qa,
  39. position: 2,
  40. }, {
  41. id: '4',
  42. name: 'Pipeline 4',
  43. description: 'This is a description of Pipeline 4',
  44. icon_info: {
  45. icon: '🍯',
  46. icon_background: '#F5F3FF',
  47. icon_type: 'emoji',
  48. },
  49. doc_form: ChunkingMode.graph,
  50. position: 3,
  51. }]
  52. const { data: pipelineList, isLoading } = usePipelineTemplateList({ type: 'built-in' })
  53. const list = pipelineList?.pipelines || mockData
  54. if (isLoading || !list)
  55. return null
  56. return (
  57. <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'>
  58. {list.map((pipeline, index) => (
  59. <TemplateCard
  60. key={index}
  61. pipeline={pipeline}
  62. showMoreOperations={false}
  63. />
  64. ))}
  65. </div>
  66. )
  67. }
  68. export default BuiltInPipelineList