You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
gcgj-dify-1.7.0/web/app/components/rag-pipeline/hooks/use-pipeline-template.ts

26 lines
835 B
TypeScript

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'
export const usePipelineTemplate = () => {
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,
})
return {
nodes: [knowledgeBaseNode],
edges: [],
}
}