feat: separate input fields into datasource and global categories in RAG pipeline

This commit is contained in:
twwu 2025-06-27 15:23:04 +08:00
parent 8f2ad89027
commit 264b95e572
1 changed files with 16 additions and 5 deletions

View File

@ -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])