Skip to content

Commit c31aa8c

Browse files
committed
fix(kb): align bulk chunk operation with API response
1 parent 84691fc commit c31aa8c

File tree

2 files changed

+6
-11
lines changed

2 files changed

+6
-11
lines changed

apps/sim/app/workspace/[workspaceId]/knowledge/[id]/[documentId]/document.tsx

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -541,12 +541,8 @@ export function Document({
541541
if (operation === 'delete') {
542542
refreshChunks()
543543
} else {
544-
result.results.forEach((opResult) => {
545-
if (opResult.operation === operation) {
546-
opResult.chunkIds.forEach((chunkId: string) => {
547-
updateChunk(chunkId, { enabled: operation === 'enable' })
548-
})
549-
}
544+
chunks.forEach((chunk) => {
545+
updateChunk(chunk.id, { enabled: operation === 'enable' })
550546
})
551547
}
552548
logger.info(`Successfully ${operation}d ${result.successCount} chunks`)

apps/sim/hooks/queries/knowledge.ts

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -755,12 +755,11 @@ export interface BulkChunkOperationParams {
755755
}
756756

757757
export interface BulkChunkOperationResult {
758+
operation: string
758759
successCount: number
759-
failedCount: number
760-
results: Array<{
761-
operation: string
762-
chunkIds: string[]
763-
}>
760+
errorCount: number
761+
processed: number
762+
errors: Array<{ chunkId: string; error: string }>
764763
}
765764

766765
export async function bulkChunkOperation({

0 commit comments

Comments
 (0)