Skip to content

armgit / dify

Public Imported from GitHub
0

Build Agentic workflows, RAG pipelines, with rich AI model and tool support on one collaborative workspace. Deploy on cloud, VPC, or self-hosted, so teams move from prototype to production without rebuilding the stack.

975 B
Raw Blame
import type { KnowledgeBaseNodeType } from '@/app/components/workflow/nodes/knowledge-base/types'
import { useTranslation } from 'react-i18next'
import { START_INITIAL_POSITION } from '@/app/components/workflow/constants'
import knowledgeBaseDefault from '@/app/components/workflow/nodes/knowledge-base/default'
import { generateNewNode } from '@/app/components/workflow/utils'

export const usePipelineTemplate = () => {
  const { t } = useTranslation(['workflow'])

  const { newNode: knowledgeBaseNode } = generateNewNode({
    id: 'knowledgeBase',
    data: {
      ...(knowledgeBaseDefault.defaultValue as KnowledgeBaseNodeType),
      type: knowledgeBaseDefault.metaData.type,
      title: t(($) => $[`blocks.${knowledgeBaseDefault.metaData.type}`], { ns: 'workflow' }),
      selected: true,
    },
    position: {
      x: START_INITIAL_POSITION.x + 500,
      y: START_INITIAL_POSITION.y,
    },
  })

  return {
    nodes: [knowledgeBaseNode],
    edges: [],
  }
}