From 0711af20f29f031d13b1b6d842db54a5d2b6f933 Mon Sep 17 00:00:00 2001 From: Joel Date: Fri, 30 Jan 2026 14:15:33 +0800 Subject: [PATCH] feat: add feature provider to rag pipeline to reduce problem --- .../components/rag-pipeline/index.spec.tsx | 6 ++++++ web/app/components/rag-pipeline/index.tsx | 21 ++++++++++++++----- 2 files changed, 22 insertions(+), 5 deletions(-) diff --git a/web/app/components/rag-pipeline/index.spec.tsx b/web/app/components/rag-pipeline/index.spec.tsx index 5adfc828cf..d5425b389c 100644 --- a/web/app/components/rag-pipeline/index.spec.tsx +++ b/web/app/components/rag-pipeline/index.spec.tsx @@ -64,6 +64,12 @@ vi.mock('@/app/components/workflow/context', () => ({ ), })) +vi.mock('@/app/components/workflow/store', () => ({ + useStore: (selector: (state: { fileUploadConfig?: Record }) => unknown) => { + return selector({ fileUploadConfig: undefined }) + }, +})) + // Type assertions for mocked functions const mockUseDatasetDetailContextWithSelector = vi.mocked(useDatasetDetailContextWithSelector) const mockUsePipelineInit = vi.mocked(usePipelineInit) diff --git a/web/app/components/rag-pipeline/index.tsx b/web/app/components/rag-pipeline/index.tsx index ddada91bf2..11cd8a70e3 100644 --- a/web/app/components/rag-pipeline/index.tsx +++ b/web/app/components/rag-pipeline/index.tsx @@ -1,5 +1,7 @@ +import type { Features as FeaturesData } from '@/app/components/base/features/types' import type { InjectWorkflowStoreSliceFn } from '@/app/components/workflow/store' import { useMemo } from 'react' +import { FeaturesProvider } from '@/app/components/base/features' import Loading from '@/app/components/base/loading' import WorkflowWithDefaultContext from '@/app/components/workflow' import { @@ -34,6 +36,13 @@ const RagPipeline = () => { return [] }, [data]) + const initialFeatures: FeaturesData = useMemo(() => { + const features = data?.features || {} + return { + sandbox: features.sandbox || { enabled: false }, + } + }, [data?.features]) + if (!data || isLoading) { return (
@@ -51,11 +60,13 @@ const RagPipeline = () => { edges={edgesData} nodes={processedNodes} > - + + + ) }