MCPcopy Index your code
hub / github.com/FlowiseAI/Flowise / _getSourceIdAssigner

Function _getSourceIdAssigner

packages/components/src/indexing.ts:212–222  ·  view source on GitHub ↗
(sourceIdKey: StringOrDocFunc | null)

Source from the content-addressed store, hash-verified

210}
211
212export function _getSourceIdAssigner(sourceIdKey: StringOrDocFunc | null): (doc: DocumentInterface) => string | null {
213 if (sourceIdKey === null) {
214 return (_doc: DocumentInterface) => null
215 } else if (typeof sourceIdKey === 'string') {
216 return (doc: DocumentInterface) => doc.metadata[sourceIdKey]
217 } else if (typeof sourceIdKey === 'function') {
218 return sourceIdKey
219 } else {
220 throw new Error(`sourceIdKey should be null, a string or a function, got ${typeof sourceIdKey}`)
221 }
222}
223
224export const _isBaseDocumentLoader = (arg: any): arg is BaseDocumentLoader => {
225 if ('load' in arg && typeof arg.load === 'function' && 'loadAndSplit' in arg && typeof arg.loadAndSplit === 'function') {

Callers 1

indexFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected