From 7758f9a58d976c1ced745c979562e08bae8e3961 Mon Sep 17 00:00:00 2001 From: ValueOn AG Date: Tue, 14 Apr 2026 08:40:44 +0200 Subject: [PATCH] tool fix --- .../WorkspaceRagInsightsPage.module.css | 25 ++++++ .../workspace/WorkspaceRagInsightsPage.tsx | 81 +++++++++++++++++++ 2 files changed, 106 insertions(+) diff --git a/src/pages/views/workspace/WorkspaceRagInsightsPage.module.css b/src/pages/views/workspace/WorkspaceRagInsightsPage.module.css index 712c04e..2633881 100644 --- a/src/pages/views/workspace/WorkspaceRagInsightsPage.module.css +++ b/src/pages/views/workspace/WorkspaceRagInsightsPage.module.css @@ -80,3 +80,28 @@ color: #c62828; padding: 1rem; } + +.recentTable { + width: 100%; + border-collapse: collapse; + font-size: 0.85rem; +} + +.recentTable th { + text-align: left; + font-weight: 600; + color: var(--text-secondary, #666); + padding: 0.5rem 0.75rem; + border-bottom: 2px solid var(--border-color, #e0e0e0); + white-space: nowrap; +} + +.recentTable td { + padding: 0.45rem 0.75rem; + border-bottom: 1px solid var(--border-color, #f0f0f0); + color: var(--text-primary, #1a1a1a); +} + +.recentTable tbody tr:hover { + background: var(--bg-secondary, #fafafa); +} diff --git a/src/pages/views/workspace/WorkspaceRagInsightsPage.tsx b/src/pages/views/workspace/WorkspaceRagInsightsPage.tsx index 0079c41..c473326 100644 --- a/src/pages/views/workspace/WorkspaceRagInsightsPage.tsx +++ b/src/pages/views/workspace/WorkspaceRagInsightsPage.tsx @@ -41,6 +41,39 @@ function _mimeLabel(key: string, t: (k: string) => string): string { const CHART_COLORS = ['#1976d2', '#00897b', '#6a1b9a', '#e65100', '#5d4037', '#455a64', '#c62828']; +function _formatTimestamp(ts: number | null | undefined): string { + if (ts == null || ts <= 0) return '–'; + try { + const d = new Date(ts * 1000); + return d.toLocaleString('de-CH', { + day: '2-digit', month: '2-digit', year: 'numeric', + hour: '2-digit', minute: '2-digit', + }); + } catch { + return '–'; + } +} + +function _shortMime(mime: string): string { + const m = (mime || '').toLowerCase(); + if (m.includes('pdf')) return 'PDF'; + if (m.includes('wordprocessing') || m.includes('msword')) return 'Word'; + if (m.includes('spreadsheet') || m.includes('excel')) return 'Excel'; + if (m.includes('presentation') || m.includes('powerpoint')) return 'PowerPoint'; + if (m.startsWith('text/')) return 'Text'; + if (m.startsWith('image/')) return 'Bild'; + if (m.includes('html')) return 'HTML'; + return mime || '–'; +} + +const _STATUS_COLORS: Record = { + indexed: '#2e7d32', + extracted: '#1565c0', + embedding: '#6a1b9a', + pending: '#e65100', + failed: '#c62828', +}; + interface RagKpis { indexedDocuments: number; indexedBytesTotal: number; @@ -51,6 +84,14 @@ interface RagKpis { workflowEntities: number; } +interface RecentlyIndexedDoc { + fileName: string; + mimeType: string; + status: string; + extractedAt: number | null; + totalSize: number; +} + interface RagStatsResponse { error?: string; scope?: { @@ -63,6 +104,7 @@ interface RagStatsResponse { documentsByMimeCategory?: Record; chunksByContentType?: Record; timelineIndexedDocuments?: Array<{ date: string; indexedDocuments: number }>; + recentlyIndexedDocuments?: RecentlyIndexedDoc[]; generatedAtUtc?: string; } @@ -181,6 +223,45 @@ export const WorkspaceRagInsightsPage: React.FC = () => { )} + {(stats?.recentlyIndexedDocuments ?? []).length > 0 && ( +
+

{t('Zuletzt indexierte Dokumente')}

+
+ + + + + + + + + + + + {(stats?.recentlyIndexedDocuments ?? []).map((doc, i) => ( + + + + + + + + ))} + +
{t('Dateiname')}{t('Format')}{t('Grösse')}{t('Status')}{t('Indexiert am')}
+ {doc.fileName || '–'} + {_shortMime(doc.mimeType)}{formatBinaryDataSizeBytes(doc.totalSize)} + + {doc.status} + + {_formatTimestamp(doc.extractedAt)}
+
+
+ )} +

{t('Neu indexierte Dokumente pro Tag')}

{timeline.length === 0 ? (