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

@@ -9,6 +9,7 @@ import { deleteNoteEmbeddings } from "./storage.js";
import type { QueueItem } from "./types.js";
import { getChunkingOperations } from "./chunking/chunking_interface.js";
import indexService from '../index_service.js';
import { isNoteExcludedFromAIById } from "../utils/ai_exclusion_utils.js";
// Track which notes are currently being processed
const notesInProcess = new Set<string>();
@@ -261,6 +262,17 @@ export async function processEmbeddingQueue() {
continue;
}
// Check if this note is excluded from AI features
if (isNoteExcludedFromAIById(noteId)) {
log.info(`Note ${noteId} excluded from AI features, removing from embedding queue`);
await sql.execute(
"DELETE FROM embedding_queue WHERE noteId = ?",
[noteId]
);
await deleteNoteEmbeddings(noteId); // Also remove any existing embeddings
continue;
}
if (noteData.operation === 'DELETE') {
await deleteNoteEmbeddings(noteId);
await sql.execute(