added endpoints and routes to get sessions

This commit is contained in:
Storme-bit
2026-04-06 01:16:19 -07:00
parent 710107ce5a
commit 461438e81b
4 changed files with 39 additions and 1 deletions

View File

@@ -23,6 +23,16 @@ function getSession(id) {
return parseSession(stmt.get(id));
}
function getSessions(limit = EPISODIC.DEFAULT_PAGE_SIZE, offset = 0) {
const db = getDB();
const stmt = db.prepare(`
SELECT * FROM sessions
ORDER BY updated_at DESC
LIMIT ? OFFSET ?
`);
return stmt.all(limit, offset).map(parseSession);
}
// Retrieves a session by its external ID
function getSessionByExternalId(externalId) {
const db = getDB();
@@ -172,6 +182,7 @@ async function getEpisodeEmbedding(userMessage, aiResponse){
module.exports = {
createSession,
getSession,
getSessions,
getSessionByExternalId,
deleteSession,
createEpisode,