sessions router mounted onto root

This commit is contained in:
Storme-bit
2026-04-05 23:12:10 -07:00
parent aebea6c231
commit 9af77438b3
3 changed files with 23 additions and 15 deletions

View File

@@ -22,19 +22,4 @@ 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;