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.

2.5 KB
Raw Blame
'use client'
import type { PipelineDocument } from '@dify/contracts/api/console/rag/types.gen'
import { RiBookOpenLine } from '@remixicon/react'
import * as React from 'react'
import { useTranslation } from 'react-i18next'
import { useDatasetDetailContextWithSelector } from '@/context/dataset-detail'
import { useDocLink } from '@/context/i18n'
import EmbeddingProcess from './embedding-process'

type ProcessingProps = {
  batchId: string
  documents: PipelineDocument[]
}

const Processing = ({ batchId, documents }: ProcessingProps) => {
  const { t } = useTranslation(['datasetCreation', 'datasetPipeline'])
  const docLink = useDocLink()
  const datasetId = useDatasetDetailContextWithSelector((s) => s.dataset?.id)
  const indexingType = useDatasetDetailContextWithSelector(
    (s) => s.dataset?.indexing_technique ?? undefined,
  )
  const retrievalMethod = useDatasetDetailContextWithSelector(
    (s) => s.dataset?.retrieval_model_dict?.search_method,
  )

  return (
    <div className="flex size-full justify-center overflow-hidden">
      <div className="h-full w-3/5 overflow-y-auto pt-10 pb-8">
        <div className="max-w-160">
          <EmbeddingProcess
            datasetId={datasetId!}
            batchId={batchId}
            documents={documents}
            indexingType={indexingType}
            retrievalMethod={retrievalMethod}
          />
        </div>
      </div>
      <div className="w-2/5 pt-22 pr-8">
        <div className="flex w-82 flex-col gap-3 rounded-xl bg-background-section p-6">
          <div className="flex size-10 items-center justify-center rounded-[10px] bg-components-card-bg shadow-lg shadow-shadow-shadow-5">
            <RiBookOpenLine className="size-5 text-text-accent" />
          </div>
          <div className="flex flex-col gap-y-2">
            <div className="system-xl-semibold text-text-secondary">
              {t(($) => $['stepThree.sideTipTitle'], { ns: 'datasetCreation' })}
            </div>
            <div className="system-sm-regular text-text-tertiary">
              {t(($) => $['stepThree.sideTipContent'], { ns: 'datasetCreation' })}
            </div>
            <a
              href={docLink('/use-dify/knowledge/knowledge-pipeline/authorize-data-source')}
              target="_blank"
              rel="noreferrer noopener"
              className="system-sm-regular text-text-accent"
            >
              {t(($) => $['addDocuments.stepThree.learnMore'], { ns: 'datasetPipeline' })}
            </a>
          </div>
        </div>
      </div>
    </div>
  )
}

export default Processing