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

Function retryDocumentProcessing

apps/sim/lib/knowledge/documents/service.ts:1553–1603  ·  view source on GitHub ↗
(
  knowledgeBaseId: string,
  documentId: string,
  docData: {
    filename: string
    fileUrl: string
    fileSize: number
    mimeType: string
  },
  requestId: string
)

Source from the content-addressed store, hash-verified

1551}
1552
1553export async function retryDocumentProcessing(
1554 knowledgeBaseId: string,
1555 documentId: string,
1556 docData: {
1557 filename: string
1558 fileUrl: string
1559 fileSize: number
1560 mimeType: string
1561 },
1562 requestId: string
1563): Promise<{ success: boolean; status: string; message: string }> {
1564 await db.transaction(async (tx) => {
1565 await tx.delete(embedding).where(eq(embedding.documentId, documentId))
1566
1567 await tx
1568 .update(document)
1569 .set({
1570 processingStatus: 'pending',
1571 processingStartedAt: null,
1572 processingCompletedAt: null,
1573 processingError: null,
1574 chunkCount: 0,
1575 tokenCount: 0,
1576 characterCount: 0,
1577 })
1578 .where(eq(document.id, documentId))
1579 })
1580
1581 await processDocumentsWithQueue(
1582 [
1583 {
1584 documentId,
1585 filename: docData.filename,
1586 fileUrl: docData.fileUrl,
1587 fileSize: docData.fileSize,
1588 mimeType: docData.mimeType,
1589 },
1590 ],
1591 knowledgeBaseId,
1592 {},
1593 requestId
1594 )
1595
1596 logger.info(`[${requestId}] Document retry initiated: ${documentId}`)
1597
1598 return {
1599 success: true,
1600 status: 'pending',
1601 message: 'Document retry processing started',
1602 }
1603}
1604
1605export async function updateDocument(
1606 documentId: string,

Callers 1

route.tsFile · 0.90

Calls 5

infoMethod · 0.80
deleteMethod · 0.65
setMethod · 0.65
eqFunction · 0.50

Tested by

no test coverage detected