Split Batch Manually node CODDE ID798
🧩 Syntax:
// This node manually replicates the 'Split Out' functionality to bypass a bug.
// It takes the single item from the LLM, splits the analysisResults array,
// and merges the other fields back into each new item.
// Since this runs once for all items, and the LLM only outputs one item, we get the first one.
const inputItem = $input.item;
// Extract the array of results we want to split.
const analysisResultsArray = inputItem.json.analysisResults;
// Extract all the *other* data from the original item that we want to keep.
const otherFields = { ...inputItem.json };
delete otherFields.analysisResults; // Remove the array we are splitting
// Create a new list of items.
const newItems = analysisResultsArray.map(singleResult => {
// For each result, create a new JSON object.
// Start with all the other data from the original item.
const newItemJson = { ...otherFields };
// Add the individual analysis result into a field called 'llmAnalysis'.
// This matches what the old 'Split Out' node was configured to do.
newItemJson.llmAnalysis = singleResult;
return { json: newItemJson };
});
// Return the newly created list of multiple items.
return newItems;Balih00
Member