Skip to content
Snippets Groups Projects
Unverified Commit 13d8d7cb authored by ezirmusitua's avatar ezirmusitua Committed by GitHub
Browse files

fix: use `Array.prototype.flat` (#760)


Co-authored-by: default avatarAlex Yang <himself65@outlook.com>
parent 9c34e44b
Branches
Tags
No related merge requests found
......@@ -94,20 +94,20 @@ export class IngestionPipeline {
documents?: Document[],
nodes?: BaseNode[],
): Promise<BaseNode[]> {
const inputNodes: BaseNode[] = [];
const inputNodes: BaseNode[][] = [];
if (documents) {
inputNodes.push(...documents);
inputNodes.push(documents);
}
if (nodes) {
inputNodes.push(...nodes);
inputNodes.push(nodes);
}
if (this.documents) {
inputNodes.push(...this.documents);
inputNodes.push(this.documents);
}
if (this.reader) {
inputNodes.push(...(await this.reader.loadData()));
inputNodes.push(await this.reader.loadData());
}
return inputNodes;
return inputNodes.flat();
}
async run(
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment