added chat history orchestration endpoint
This commit is contained in:
@@ -47,10 +47,20 @@ async function getEpisodeById(episodeId) {
|
|||||||
return res.json();
|
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 = {
|
module.exports = {
|
||||||
getSessionByExternalId,
|
getSessionByExternalId,
|
||||||
createSession,
|
createSession,
|
||||||
getRecentEpisodes,
|
getRecentEpisodes,
|
||||||
createEpisode,
|
createEpisode,
|
||||||
getEpisodeById
|
getEpisodeById,
|
||||||
|
getSessionHistory
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user