minor constants refactoring
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
const {getDB} = require('../db');
|
||||
const { EPISODIC } = require('@nexusai/shared');
|
||||
|
||||
// --Sessions --------------------------------------------------
|
||||
|
||||
@@ -73,7 +74,7 @@ function getEpisode(id) {
|
||||
}
|
||||
|
||||
// Retrieves episodes for a given session, ordered by creation time descending, with pagination
|
||||
function getEpisodesBySession(sessionId, limit = 20, offset = 0) {
|
||||
function getEpisodesBySession(sessionId, limit = EPISODIC.DEFAULT_PAGE_SIZE, offset = 0) {
|
||||
const db = getDB();
|
||||
const stmt = db.prepare(`
|
||||
SELECT * FROM episodes
|
||||
@@ -85,7 +86,7 @@ function getEpisodesBySession(sessionId, limit = 20, offset = 0) {
|
||||
}
|
||||
|
||||
// Retrieves recent episodes across all sessions, ordered by creation time descending, with a limit
|
||||
function getRecentEpisodes(limit = 10) {
|
||||
function getRecentEpisodes(limit = EPISODIC.DEFAULT_RECENT_LIMIT) {
|
||||
// Cross-session recent episodes — useful for recency-based retrieval
|
||||
const db = getDB();
|
||||
const stmt = db.prepare(`
|
||||
@@ -98,7 +99,7 @@ function getRecentEpisodes(limit = 10) {
|
||||
|
||||
|
||||
// Searches episodes using FTS5 full-text search, ordered by relevance, with a limit
|
||||
function searchEpisodes(query, limit = 10) {
|
||||
function searchEpisodes(query, limit = EPISODIC.DEFAULT_SEARCH_LIMIT) {
|
||||
// FTS5 full-text search across all episodes
|
||||
const db = getDB();
|
||||
const stmt = db.prepare(`
|
||||
|
||||
Reference in New Issue
Block a user