feat(llm): add utils for excluding notes from LLM

This commit is contained in:
perf3ct
2025-06-01 02:51:36 +00:00
parent ba98bd9097
commit 3fae664877
6 changed files with 138 additions and 0 deletions

View File

@@ -20,6 +20,7 @@ import sql from "../sql.js";
import sqlInit from "../sql_init.js";
import { CONTEXT_PROMPTS } from './constants/llm_prompt_constants.js';
import { SEARCH_CONSTANTS } from './constants/search_constants.js';
import { isNoteExcludedFromAI } from "./utils/ai_exclusion_utils.js";
export class IndexService {
private initialized = false;
@@ -803,6 +804,12 @@ export class IndexService {
throw new Error(`Note ${noteId} not found`);
}
// Check if this note is excluded from AI features
if (isNoteExcludedFromAI(note)) {
log.info(`Note ${noteId} (${note.title}) excluded from AI indexing due to exclusion label`);
return true; // Return true to indicate successful handling (exclusion is intentional)
}
// Check where embedding generation should happen
const embeddingLocation = await options.getOption('embeddingGenerationLocation') || 'client';