added chat history orchestration endpoint
This commit is contained in:
@@ -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;
|
||||||
Reference in New Issue
Block a user