MCPcopy
hub / github.com/FlowiseAI/Flowise / _deduplicateInOrder

Function _deduplicateInOrder

packages/components/src/indexing.ts:195–210  ·  view source on GitHub ↗
(hashedDocuments: HashedDocumentInterface[])

Source from the content-addressed store, hash-verified

193}
194
195export function _deduplicateInOrder(hashedDocuments: HashedDocumentInterface[]): HashedDocumentInterface[] {
196 const seen = new Set<string>()
197 const deduplicated: HashedDocumentInterface[] = []
198
199 for (const hashedDoc of hashedDocuments) {
200 if (!hashedDoc.hash_) {
201 throw new Error('Hashed document does not have a hash')
202 }
203
204 if (!seen.has(hashedDoc.hash_)) {
205 seen.add(hashedDoc.hash_)
206 deduplicated.push(hashedDoc)
207 }
208 }
209 return deduplicated
210}
211
212export function _getSourceIdAssigner(sourceIdKey: StringOrDocFunc | null): (doc: DocumentInterface) => string | null {
213 if (sourceIdKey === null) {

Callers 1

indexFunction · 0.85

Calls 1

addMethod · 0.45

Tested by

no test coverage detected