Spaces:
Paused
Paused
File size: 1,867 Bytes
529090e | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 | /**
* Knowledge API - Endpoints for KnowledgeCompiler
*
* Endpoints:
* - GET /api/knowledge/summary - Full system state summary
* - GET /api/knowledge/health - Quick health check
* - GET /api/knowledge/insights - AI-generated insights only
*/
import { Router, Request, Response } from 'express';
import { knowledgeCompiler } from '../services/Knowledge/KnowledgeCompiler.js';
const router = Router();
/**
* GET /api/knowledge/summary
* Returns full system state summary
*/
router.get('/summary', async (_req: Request, res: Response) => {
try {
const summary = await knowledgeCompiler.compile();
res.json({
success: true,
data: summary
});
} catch (error: any) {
console.error('[Knowledge] Summary compilation failed:', error);
res.status(500).json({
success: false,
error: error.message || 'Failed to compile summary'
});
}
});
/**
* GET /api/knowledge/health
* Returns quick health status
*/
router.get('/health', async (_req: Request, res: Response) => {
try {
const health = await knowledgeCompiler.quickHealth();
res.json({
success: true,
data: health
});
} catch (error: any) {
res.status(500).json({
success: false,
error: error.message || 'Health check failed'
});
}
});
/**
* GET /api/knowledge/insights
* Returns AI-generated insights only
*/
router.get('/insights', async (_req: Request, res: Response) => {
try {
const summary = await knowledgeCompiler.compile();
res.json({
success: true,
data: {
overallHealth: summary.health.overall,
insights: summary.insights,
timestamp: summary.timestamp
}
});
} catch (error: any) {
res.status(500).json({
success: false,
error: error.message || 'Failed to generate insights'
});
}
});
export default router;
|