Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions src/core/operations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
*/

import type { BrainEngine } from './engine.ts';
import { clampSearchLimit } from './engine.ts';
import type { GBrainConfig } from './config.ts';
import { importFromContent } from './import-file.ts';
import { hybridSearch } from './search/hybrid.ts';
Expand Down Expand Up @@ -156,7 +157,7 @@ const list_pages: Operation = {
const pages = await ctx.engine.listPages({
type: p.type as any,
tag: p.tag as string,
limit: (p.limit as number) || 50,
limit: clampSearchLimit(p.limit as number | undefined, 50),
});
return pages.map(pg => ({
slug: pg.slug,
Expand Down Expand Up @@ -529,7 +530,7 @@ const get_ingest_log: Operation = {
limit: { type: 'number', description: 'Max entries (default 20)' },
},
handler: async (ctx, p) => {
return ctx.engine.getIngestLog({ limit: (p.limit as number) || 20 });
return ctx.engine.getIngestLog({ limit: clampSearchLimit(p.limit as number | undefined, 20) });
},
};

Expand Down
Loading