added chat history orchestration endpoint
This commit is contained in:
@@ -47,10 +47,20 @@ async function getEpisodeById(episodeId) {
|
||||
return res.json();
|
||||
}
|
||||
|
||||
async function getSessionHistory(sessionId, limit = 20, offset = 0) {
|
||||
const res = await fetch(
|
||||
`${BASE_URL}/sessions/${sessionId}/episodes?limit=${limit}&offset=${offset}`
|
||||
);
|
||||
if (res.status === 404 ) return null;
|
||||
if (!res.ok) throw new Error(`Failed to fetch history: ${res.status}`);
|
||||
return res.json();
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
getSessionByExternalId,
|
||||
createSession,
|
||||
getRecentEpisodes,
|
||||
createEpisode,
|
||||
getEpisodeById
|
||||
getEpisodeById,
|
||||
getSessionHistory
|
||||
}
|
||||
Reference in New Issue
Block a user