diff --git a/web/app/components/rag-pipeline/hooks/use-pipeline-config.ts b/web/app/components/rag-pipeline/hooks/use-pipeline-config.ts index 8bc41b68d9..5f0daf29ce 100644 --- a/web/app/components/rag-pipeline/hooks/use-pipeline-config.ts +++ b/web/app/components/rag-pipeline/hooks/use-pipeline-config.ts @@ -24,10 +24,19 @@ export const usePipelineConfig = () => { handleUpdateWorkflowConfig, ) - const handleUpdateNodesDefaultConfigs = useCallback((nodesDefaultConfigs: Record) => { + const handleUpdateNodesDefaultConfigs = useCallback((nodesDefaultConfigs: Record | Record[]) => { const { setNodesDefaultConfigs } = workflowStore.getState() + let res: Record = {} + if (Array.isArray(nodesDefaultConfigs)) { + nodesDefaultConfigs.forEach((item) => { + res[item.type] = item.config + }) + } + else { + res = nodesDefaultConfigs as Record + } - setNodesDefaultConfigs!(nodesDefaultConfigs) + setNodesDefaultConfigs!(res) }, [workflowStore]) useWorkflowConfig( pipelineId ? `/rag/pipelines/${pipelineId}/workflows/default-workflow-block-configs` : '',