diff --git a/web/app/components/datasets/create-from-pipeline/header.tsx b/web/app/components/datasets/create-from-pipeline/header.tsx
index 4989133cf6c..532f9c0c4a4 100644
--- a/web/app/components/datasets/create-from-pipeline/header.tsx
+++ b/web/app/components/datasets/create-from-pipeline/header.tsx
@@ -1,4 +1,5 @@
-import { Button } from '@langgenius/dify-ui/button'
+import { buttonVariants } from '@langgenius/dify-ui/button'
+import { cn } from '@langgenius/dify-ui/cn'
import { RiArrowLeftLine } from '@remixicon/react'
import * as React from 'react'
import { useTranslation } from 'react-i18next'
@@ -10,10 +11,15 @@ const Header = () => {
return (
{t(($) => $['creation.backToKnowledge'], { ns: 'datasetPipeline' })}
-
-
+
+
)
diff --git a/web/app/components/datasets/create/embedding-process/__tests__/index.spec.tsx b/web/app/components/datasets/create/embedding-process/__tests__/index.spec.tsx
index 09eb56eb06f..4aa3641eabb 100644
--- a/web/app/components/datasets/create/embedding-process/__tests__/index.spec.tsx
+++ b/web/app/components/datasets/create/embedding-process/__tests__/index.spec.tsx
@@ -3,7 +3,6 @@ import { render, screen } from '@testing-library/react'
import userEvent from '@testing-library/user-event'
import EmbeddingProcess from '../index'
-const mockPush = vi.fn()
const mockInvalidDocumentList = vi.fn()
let mockEnableBilling = false
let mockPlanType = 'sandbox'
@@ -17,10 +16,6 @@ let mockPollingState: {
isEmbeddingCompleted: false,
}
-vi.mock('@/next/navigation', () => ({
- useRouter: () => ({ push: mockPush }),
-}))
-
vi.mock('@/next/link', () => ({
default: ({
children,
@@ -184,14 +179,15 @@ describe('EmbeddingProcess', () => {
).toBeInTheDocument()
})
- it('invalidates the document list before navigating to it', async () => {
+ it('links to the document list and invalidates its cache on activation', async () => {
const user = userEvent.setup()
render(
)
- await user.click(screen.getByRole('button', { name: 'datasetCreation.stepThree.navTo' }))
+ const link = screen.getByRole('link', { name: 'datasetCreation.stepThree.navTo' })
+ expect(link).toHaveAttribute('href', '/datasets/dataset-1/documents')
+ await user.click(link)
expect(mockInvalidDocumentList).toHaveBeenCalledOnce()
- expect(mockPush).toHaveBeenCalledWith('/datasets/dataset-1/documents')
})
it('links to the dataset API reference', () => {
diff --git a/web/app/components/datasets/create/embedding-process/index.tsx b/web/app/components/datasets/create/embedding-process/index.tsx
index e0456f650a9..54719c14628 100644
--- a/web/app/components/datasets/create/embedding-process/index.tsx
+++ b/web/app/components/datasets/create/embedding-process/index.tsx
@@ -1,7 +1,8 @@
import type { FC } from 'react'
import type { FullDocumentDetail } from '@/models/datasets'
import type { RETRIEVE_METHOD } from '@/types/app'
-import { Button } from '@langgenius/dify-ui/button'
+import { buttonVariants } from '@langgenius/dify-ui/button'
+import { cn } from '@langgenius/dify-ui/cn'
import { RiArrowRightLine, RiLoader2Fill, RiTerminalBoxLine } from '@remixicon/react'
import { useMemo } from 'react'
import { useTranslation } from 'react-i18next'
@@ -10,7 +11,6 @@ import VectorSpaceAdmissionAlert from '@/app/components/datasets/common/vector-s
import { useProviderContext } from '@/context/provider-context'
import { useDatasetApiAccessUrl } from '@/hooks/use-api-access-url'
import Link from '@/next/link'
-import { useRouter } from '@/next/navigation'
import { useProcessRule } from '@/service/knowledge/use-dataset'
import { useInvalidDocumentList } from '@/service/knowledge/use-document'
import IndexingProgressItem from './indexing-progress-item'
@@ -50,22 +50,30 @@ const StatusHeader: FC<{ isEmbedding: boolean; isCompleted: boolean }> = ({
// Action buttons component
const ActionButtons: FC<{
apiReferenceUrl: string
- onNavToDocuments: () => void
-}> = ({ apiReferenceUrl, onNavToDocuments }) => {
+ documentsHref: string
+ onNavigateToDocuments: () => void
+}> = ({ apiReferenceUrl, documentsHref, onNavigateToDocuments }) => {
const { t } = useTranslation()
return (
-
-
+
+
+ Access the API
-
+
)
}
@@ -78,7 +86,6 @@ const EmbeddingProcess: FC
= ({
retrievalMethod,
}) => {
const { enableBilling, plan } = useProviderContext()
- const router = useRouter()
const invalidDocumentList = useInvalidDocumentList()
const apiReferenceUrl = useDatasetApiAccessUrl()
@@ -95,10 +102,7 @@ const EmbeddingProcess: FC = ({
// Document lookup utilities - memoized for performance
const documentLookup = useMemo(() => createDocumentLookup(documents), [documents])
- const handleNavToDocuments = () => {
- invalidDocumentList()
- router.push(`/datasets/${datasetId}/documents`)
- }
+ const documentsHref = `/datasets/${datasetId}/documents`
const showUpgradeBanner = enableBilling && plan.type !== 'team'
const showVectorSpaceUpgrade =
@@ -145,7 +149,11 @@ const EmbeddingProcess: FC = ({
/>
-