mirror of https://github.com/langgenius/dify.git
feat: separate input fields into datasource and global categories in RAG pipeline
This commit is contained in:
parent
8f2ad89027
commit
264b95e572
|
|
@ -67,16 +67,27 @@ const InputFieldDialog = ({
|
|||
|
||||
const updateInputFields = useCallback(async (key: string, value: InputVar[]) => {
|
||||
inputFieldsMap.current[key] = value
|
||||
const newRagPipelineVariables: RAGPipelineVariables = []
|
||||
const datasourceNodeInputFields: RAGPipelineVariables = []
|
||||
const globalInputFields: RAGPipelineVariables = []
|
||||
Object.keys(inputFieldsMap.current).forEach((key) => {
|
||||
const inputFields = inputFieldsMap.current[key]
|
||||
inputFields.forEach((inputField) => {
|
||||
newRagPipelineVariables.push({
|
||||
...inputField,
|
||||
belong_to_node_id: key,
|
||||
})
|
||||
if (key === 'shared') {
|
||||
globalInputFields.push({
|
||||
...inputField,
|
||||
belong_to_node_id: key,
|
||||
})
|
||||
}
|
||||
else {
|
||||
datasourceNodeInputFields.push({
|
||||
...inputField,
|
||||
belong_to_node_id: key,
|
||||
})
|
||||
}
|
||||
})
|
||||
})
|
||||
// Datasource node input fields come first, then global input fields
|
||||
const newRagPipelineVariables = [...datasourceNodeInputFields, ...globalInputFields]
|
||||
setRagPipelineVariables?.(newRagPipelineVariables)
|
||||
handleSyncWorkflowDraft()
|
||||
}, [setRagPipelineVariables, handleSyncWorkflowDraft])
|
||||
|
|
|
|||
Loading…
Reference in New Issue