fix: in pipeline not show the node config right

This commit is contained in:
Joel 2025-09-03 18:21:42 +08:00
parent c4f0691454
commit c8d60f372d
1 changed files with 11 additions and 2 deletions

View File

@ -24,10 +24,19 @@ export const usePipelineConfig = () => {
handleUpdateWorkflowConfig,
)
const handleUpdateNodesDefaultConfigs = useCallback((nodesDefaultConfigs: Record<string, any>) => {
const handleUpdateNodesDefaultConfigs = useCallback((nodesDefaultConfigs: Record<string, any> | Record<string, any>[]) => {
const { setNodesDefaultConfigs } = workflowStore.getState()
let res: Record<string, any> = {}
if (Array.isArray(nodesDefaultConfigs)) {
nodesDefaultConfigs.forEach((item) => {
res[item.type] = item.config
})
}
else {
res = nodesDefaultConfigs as Record<string, any>
}
setNodesDefaultConfigs!(nodesDefaultConfigs)
setNodesDefaultConfigs!(res)
}, [workflowStore])
useWorkflowConfig(
pipelineId ? `/rag/pipelines/${pipelineId}/workflows/default-workflow-block-configs` : '',