Implementation:Langgenius Dify UseDraftPipelineProcessingParams
| Knowledge Sources | Dify |
|---|---|
| Domains | RAG, Pipeline, Frontend |
| Last Updated | 2026-02-12 00:00 GMT |
Overview
Description
UseDraftPipelineProcessingParams is a React Query hook that fetches the configurable processing parameters for a specific node in a draft RAG pipeline workflow. It queries the backend to retrieve the list of RAGPipelineVariable objects that define what inputs the processing node accepts, enabling dynamic form rendering in the pipeline editor.
This hook is part of a family of parameter-fetching hooks:
- useDraftPipelineProcessingParams -- Retrieves processing parameters from the draft workflow version at
/rag/pipelines/{pipeline_id}/workflows/draft/processing/parameters. - useDraftPipelinePreProcessingParams -- Retrieves pre-processing parameters from the draft workflow version at
/rag/pipelines/{pipeline_id}/workflows/draft/pre-processing/parameters.
Both hooks use staleTime: 0 to ensure the UI always reflects the latest node configuration during editing.
Usage
These hooks are consumed by processing node configuration panels in the pipeline editor. When a user selects a processing node in the graph, the corresponding hook fetches the node's parameter schema and the panel renders dynamic form controls based on the returned variable types.
Code Reference
Source Location
web/service/use-pipeline.ts, lines 147--161 (processing) and lines 267--281 (pre-processing)
Signature
export const useDraftPipelineProcessingParams = (
params: PipelineProcessingParamsRequest,
enabled = true,
) => {
const { pipeline_id, node_id } = params
return useQuery<PipelineProcessingParamsResponse>({
queryKey: [NAME_SPACE, 'draft-pipeline-processing-params', pipeline_id, node_id],
queryFn: () => {
return get<PipelineProcessingParamsResponse>(
`/rag/pipelines/${pipeline_id}/workflows/draft/processing/parameters`,
{ params: { node_id } },
)
},
staleTime: 0,
enabled,
})
}
export const useDraftPipelinePreProcessingParams = (
params: PipelinePreProcessingParamsRequest,
enabled = true,
) => {
const { pipeline_id, node_id } = params
return useQuery<PipelinePreProcessingParamsResponse>({
queryKey: [NAME_SPACE, 'draft-pipeline-pre-processing-params', pipeline_id, node_id],
queryFn: () => {
return get<PipelinePreProcessingParamsResponse>(
`/rag/pipelines/${pipeline_id}/workflows/draft/pre-processing/parameters`,
{ params: { node_id } },
)
},
staleTime: 0,
enabled,
})
}
Import
import {
useDraftPipelineProcessingParams,
useDraftPipelinePreProcessingParams,
} from '@/service/use-pipeline'
I/O Contract
useDraftPipelineProcessingParams
Inputs:
| Parameter | Type | Required | Description |
|---|---|---|---|
| params | PipelineProcessingParamsRequest |
Yes | Request containing pipeline and node identifiers |
| params.pipeline_id | string |
Yes | The pipeline whose draft workflow to query |
| params.node_id | string |
Yes | The processing node within the pipeline graph |
| enabled | boolean |
No | Whether the query should execute (default: true)
|
Outputs:
| Field | Type | Description |
|---|---|---|
| variables | RAGPipelineVariables |
Array of RAGPipelineVariable objects defining configurable parameters
|
| variables[].belong_to_node_id | string |
Node ID this variable belongs to (or 'shared')
|
| variables[].type | PipelineInputVarType |
Variable type: text-input, paragraph, select, number, file, file-list, or checkbox
|
| variables[].label | string |
Human-readable label for the variable |
| variables[].variable | string |
Machine-readable variable name |
| variables[].required | boolean |
Whether the variable must be provided |
| variables[].default_value | string |
Optional default value |
| variables[].options | string[] |
Options for select-type variables |
| variables[].max_length | number |
Maximum input length (for text inputs) |
| variables[].placeholder | string |
Placeholder text for the input field |
| variables[].tooltips | string |
Tooltip help text |
useDraftPipelinePreProcessingParams
Inputs:
| Parameter | Type | Required | Description |
|---|---|---|---|
| params | PipelinePreProcessingParamsRequest |
Yes | Request containing pipeline and node identifiers |
| params.pipeline_id | string |
Yes | The pipeline whose draft workflow to query |
| params.node_id | string |
Yes | The pre-processing node within the pipeline graph |
| enabled | boolean |
No | Whether the query should execute (default: true)
|
Outputs:
| Field | Type | Description |
|---|---|---|
| variables | RAGPipelineVariables |
Array of RAGPipelineVariable objects defining pre-processing parameters
|
Usage Examples
// Fetch processing parameters for a specific node in the draft pipeline
const { data: processingParams, isLoading } = useDraftPipelineProcessingParams(
{ pipeline_id: 'pipeline-abc', node_id: 'node-chunker-1' },
isNodeSelected,
)
// Render dynamic form controls based on variable types
if (processingParams) {
processingParams.variables.forEach((variable) => {
// variable.type determines the form control (text, select, number, etc.)
renderFormField(variable)
})
}
// Fetch pre-processing parameters for content extraction configuration
const { data: preProcessingParams } = useDraftPipelinePreProcessingParams(
{ pipeline_id: 'pipeline-abc', node_id: 'node-extractor-1' },
isPreProcessNodeSelected,
)