added chat history orchestration endpoint

This commit is contained in:
Storme-bit
2026-04-05 23:01:43 -07:00
parent 157a08fa78
commit 685da6530f

View File

@@ -21,4 +21,19 @@ router.post('/', async (req, res) => {
} }
}); });
router.get('/sessions/:sessionId/history', async (req, res) => {
const { sessionId } = req.params;
const { limit = 20, offset = 0 } = req.query;
try {
const session = await memory.getSessionByExternalId(sessionId);
if (!session) return res.status(404).json({ error: 'Session not found' });
const history = await memory.getSessionHistory(session.id, Number(limit), Number(offset));
res.json({ sessionId, episodes: history });
} catch (err) {
res.status(500).json({ error: err.message });
}
});
module.exports = router; module.exports = router;