added endpoints and routes to get sessions
This commit is contained in:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user