feat: add KnowledgeGraph component for visualizing and managing knowledge base topics and relations
This commit is contained in:
@@ -235,9 +235,20 @@ const KnowledgeGraph = () => {
|
|||||||
const rawContent = await getFileContent('respellion', 'employee-handbook', file.path);
|
const rawContent = await getFileContent('respellion', 'employee-handbook', file.path);
|
||||||
await analyzeHandbookDelta(rawContent, file.path);
|
await analyzeHandbookDelta(rawContent, file.path);
|
||||||
await db.updateHandbookSyncState(file.path, file.sha);
|
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) {
|
} catch (err) {
|
||||||
console.error('Failed to process file:', file.path, 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!');
|
setSyncProgress('Sync Complete!');
|
||||||
|
|||||||
Reference in New Issue
Block a user