From 590912ac048a227cc6fd5777886f20593a3e3ebc Mon Sep 17 00:00:00 2001 From: RaymondVerhoef Date: Mon, 18 May 2026 21:42:14 +0200 Subject: [PATCH] feat: add KnowledgeGraph component for visualizing and managing knowledge base topics and relations --- src/components/admin/KnowledgeGraph.jsx | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/components/admin/KnowledgeGraph.jsx b/src/components/admin/KnowledgeGraph.jsx index 200b624..87fd65e 100644 --- a/src/components/admin/KnowledgeGraph.jsx +++ b/src/components/admin/KnowledgeGraph.jsx @@ -235,9 +235,20 @@ const KnowledgeGraph = () => { const rawContent = await getFileContent('respellion', 'employee-handbook', file.path); await analyzeHandbookDelta(rawContent, file.path); await db.updateHandbookSyncState(file.path, file.sha); + + // To respect Anthropic's 5 requests per minute rate limit on this tier, + // we pause for 15 seconds before processing the next file. + if (count < filesToProcess.length) { + setSyncProgress(`Waiting 15s to avoid rate limits... (${count}/${filesToProcess.length})`); + await new Promise(resolve => setTimeout(resolve, 15000)); + } } catch (err) { console.error('Failed to process file:', file.path, err); - // We continue processing other files even if one fails + // We continue processing other files even if one fails, but still wait to avoid further rate limits + if (count < filesToProcess.length) { + setSyncProgress(`Error on ${file.name}. Waiting 15s... (${count}/${filesToProcess.length})`); + await new Promise(resolve => setTimeout(resolve, 15000)); + } } } setSyncProgress('Sync Complete!');