diff --git a/src/components/ops/doc-intelligence-drawer.tsx b/src/components/ops/doc-intelligence-drawer.tsx index 0928aa2..693cdc9 100644 --- a/src/components/ops/doc-intelligence-drawer.tsx +++ b/src/components/ops/doc-intelligence-drawer.tsx @@ -57,10 +57,19 @@ export function DocIntelligenceBody({ documentId }: { documentId: string }) { const t = toast.loading("Re-extracting intelligence…"); try { const r = await api.kbReExtractDocument(documentId); - toast.success( - `Found ${formatNumber(r.entities)} entities · ${formatNumber(r.relations)} relations in this document`, - { id: t }, - ); + if ((r.failed_chunks ?? 0) > 0) { + // Partial failure: some chunks extracted, some did not — say both. + toast.warning( + `Found ${formatNumber(r.entities)} entities · ${formatNumber(r.relations)} relations — ` + + `${formatNumber(r.failed_chunks ?? 0)} chunks failed${r.error ? ` (${r.error})` : ""}`, + { id: t }, + ); + } else { + toast.success( + `Found ${formatNumber(r.entities)} entities · ${formatNumber(r.relations)} relations in this document`, + { id: t }, + ); + } intel.refresh(); } catch (e) { toast.error(`Re-extract failed: ${e instanceof Error ? e.message : String(e)}`, { id: t }); diff --git a/src/lib/types.ts b/src/lib/types.ts index 3697a0a..8bf2544 100644 --- a/src/lib/types.ts +++ b/src/lib/types.ts @@ -281,6 +281,11 @@ export interface KbReExtractResult { document_id: string; entities: number; relations: number; + /** Chunks the extractor failed on. Non-zero with zero entities means the + * extraction failed — not "no entities". Older gateways omit it. */ + failed_chunks?: number; + /** First failure reason (short; never the upstream body). */ + error?: string; } export interface ChannelsInfo {