MCPcopy Index your code
hub / github.com/simstudioai/sim / skipDocuments

Function skipDocuments

apps/sim/lib/knowledge/connectors/sync-engine.ts:1143–1167  ·  view source on GitHub ↗

* Records source files that were intentionally not indexed (e.g. they exceed the * connector's size limit) as content-less `failed` documents in a single bulk insert. * This keeps the files visible in the knowledge base UI — with `processingError` * explaining why — instead of silently dropping t

(
  knowledgeBaseId: string,
  connectorId: string,
  connectorType: string,
  extDocs: ExternalDocument[],
  sourceConfig?: Record<string, unknown>
)

Source from the content-addressed store, hash-verified

1141 * Returns the number of rows recorded.
1142 */
1143async function skipDocuments(
1144 knowledgeBaseId: string,
1145 connectorId: string,
1146 connectorType: string,
1147 extDocs: ExternalDocument[],
1148 sourceConfig?: Record<string, unknown>
1149): Promise<number> {
1150 if (extDocs.length === 0) {
1151 return 0
1152 }
1153 const rows = extDocs.map((extDoc) =>
1154 buildSkippedDocumentRow(knowledgeBaseId, connectorId, connectorType, extDoc, sourceConfig)
1155 )
1156
1157 await db.transaction(async (tx) => {
1158 const isActive = await isKnowledgeBaseActiveInTx(tx, knowledgeBaseId)
1159 if (!isActive) {
1160 throw new Error(`Knowledge base ${knowledgeBaseId} is deleted`)
1161 }
1162
1163 await tx.insert(document).values(rows)
1164 })
1165
1166 return rows.length
1167}
1168
1169/**
1170 * Upload content to storage as a .txt file, create a document record,

Callers 1

executeSyncFunction · 0.85

Calls 2

buildSkippedDocumentRowFunction · 0.85

Tested by

no test coverage detected