mirror of
https://github.com/langgenius/dify.git
synced 2026-05-10 05:56:31 +08:00
feat: add feature provider to rag pipeline to reduce problem
This commit is contained in:
parent
e9c2279b80
commit
0711af20f2
@ -64,6 +64,12 @@ vi.mock('@/app/components/workflow/context', () => ({
|
||||
),
|
||||
}))
|
||||
|
||||
vi.mock('@/app/components/workflow/store', () => ({
|
||||
useStore: (selector: (state: { fileUploadConfig?: Record<string, unknown> }) => unknown) => {
|
||||
return selector({ fileUploadConfig: undefined })
|
||||
},
|
||||
}))
|
||||
|
||||
// Type assertions for mocked functions
|
||||
const mockUseDatasetDetailContextWithSelector = vi.mocked(useDatasetDetailContextWithSelector)
|
||||
const mockUsePipelineInit = vi.mocked(usePipelineInit)
|
||||
|
||||
@ -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 (
|
||||
<div className="relative flex h-full w-full items-center justify-center">
|
||||
@ -51,11 +60,13 @@ const RagPipeline = () => {
|
||||
edges={edgesData}
|
||||
nodes={processedNodes}
|
||||
>
|
||||
<RagPipelineMain
|
||||
edges={edgesData}
|
||||
nodes={processedNodes}
|
||||
viewport={viewport}
|
||||
/>
|
||||
<FeaturesProvider features={initialFeatures}>
|
||||
<RagPipelineMain
|
||||
edges={edgesData}
|
||||
nodes={processedNodes}
|
||||
viewport={viewport}
|
||||
/>
|
||||
</FeaturesProvider>
|
||||
</WorkflowWithDefaultContext>
|
||||
)
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user