| 
									
										
										
										
											2025-05-20 16:52:21 +08:00
										 |  |  | import { useTranslation } from 'react-i18next' | 
					
						
							|  |  |  | import { generateNewNode } from '@/app/components/workflow/utils' | 
					
						
							|  |  |  | import { | 
					
						
							|  |  |  |   START_INITIAL_POSITION, | 
					
						
							|  |  |  | } from '@/app/components/workflow/constants' | 
					
						
							|  |  |  | import type { KnowledgeBaseNodeType } from '@/app/components/workflow/nodes/knowledge-base/types' | 
					
						
							|  |  |  | import knowledgeBaseDefault from '@/app/components/workflow/nodes/knowledge-base/default' | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-05-09 15:53:31 +08:00
										 |  |  | export const usePipelineTemplate = () => { | 
					
						
							| 
									
										
										
										
											2025-05-20 16:52:21 +08:00
										 |  |  |   const { t } = useTranslation() | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   const { newNode: knowledgeBaseNode } = generateNewNode({ | 
					
						
							|  |  |  |     data: { | 
					
						
							|  |  |  |       ...knowledgeBaseDefault.defaultValue as KnowledgeBaseNodeType, | 
					
						
							|  |  |  |       type: knowledgeBaseDefault.metaData.type, | 
					
						
							|  |  |  |       title: t(`workflow.blocks.${knowledgeBaseDefault.metaData.type}`), | 
					
						
							|  |  |  |     }, | 
					
						
							|  |  |  |     position: START_INITIAL_POSITION, | 
					
						
							|  |  |  |   }) | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-05-09 15:53:31 +08:00
										 |  |  |   return { | 
					
						
							| 
									
										
										
										
											2025-05-20 16:52:21 +08:00
										 |  |  |     nodes: [knowledgeBaseNode], | 
					
						
							| 
									
										
										
										
											2025-05-09 15:53:31 +08:00
										 |  |  |     edges: [], | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  | } |