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

Function createSingleDocument

apps/sim/lib/knowledge/documents/service.ts:1211–1359  ·  view source on GitHub ↗
(
  documentData: {
    filename: string
    fileUrl: string
    fileSize: number
    mimeType: string
    documentTagsData?: string
    tag1?: string
    tag2?: string
    tag3?: string
    tag4?: string
    tag5?: string
    tag6?: string
    tag7?: string
  },
  knowledgeBaseId: string,
  requestId: string,
  uploadedBy: string | null = null
)

Source from the content-addressed store, hash-verified

1209}
1210
1211export async function createSingleDocument(
1212 documentData: {
1213 filename: string
1214 fileUrl: string
1215 fileSize: number
1216 mimeType: string
1217 documentTagsData?: string
1218 tag1?: string
1219 tag2?: string
1220 tag3?: string
1221 tag4?: string
1222 tag5?: string
1223 tag6?: string
1224 tag7?: string
1225 },
1226 knowledgeBaseId: string,
1227 requestId: string,
1228 uploadedBy: string | null = null
1229): Promise<{
1230 id: string
1231 knowledgeBaseId: string
1232 filename: string
1233 fileUrl: string
1234 fileSize: number
1235 mimeType: string
1236 chunkCount: number
1237 tokenCount: number
1238 characterCount: number
1239 enabled: boolean
1240 uploadedAt: Date
1241 tag1: string | null
1242 tag2: string | null
1243 tag3: string | null
1244 tag4: string | null
1245 tag5: string | null
1246 tag6: string | null
1247 tag7: string | null
1248}> {
1249 const documentId = generateId()
1250 const now = new Date()
1251
1252 let processedTags: ProcessedDocumentTags = {
1253 tag1: documentData.tag1 ?? null,
1254 tag2: documentData.tag2 ?? null,
1255 tag3: documentData.tag3 ?? null,
1256 tag4: documentData.tag4 ?? null,
1257 tag5: documentData.tag5 ?? null,
1258 tag6: documentData.tag6 ?? null,
1259 tag7: documentData.tag7 ?? null,
1260 number1: null,
1261 number2: null,
1262 number3: null,
1263 number4: null,
1264 number5: null,
1265 date1: null,
1266 date2: null,
1267 boolean1: null,
1268 boolean2: null,

Callers 3

executeFunction · 0.90
route.tsFile · 0.90
route.tsFile · 0.90

Calls 11

generateIdFunction · 0.90
loadTagDefinitionsFunction · 0.85
resolveDocumentTagsFunction · 0.85
parseMethod · 0.80
infoMethod · 0.80
warnMethod · 0.65
executeMethod · 0.65
setMethod · 0.65
eqFunction · 0.50

Tested by

no test coverage detected