Skip to content

Commit

Permalink
fix: use Array.prototype.flat (#760)
Browse files Browse the repository at this point in the history
Co-authored-by: Alex Yang <himself65@outlook.com>
  • Loading branch information
ezirmusitua and himself65 committed Apr 24, 2024
1 parent 9c34e44 commit 13d8d7c
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions packages/core/src/ingestion/IngestionPipeline.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down

0 comments on commit 13d8d7c

Please sign in to comment.