From 40bbdb2faae11462149a8dff3ae5a38901c35285 Mon Sep 17 00:00:00 2001 From: perf3ct Date: Sun, 30 Mar 2025 19:41:31 +0000 Subject: [PATCH] fix chunking imports again --- src/services/llm/context/content_chunking.ts | 4 ++-- src/services/llm/embeddings/chunking/chunking_processor.ts | 5 +++-- src/services/llm/embeddings/content_processing.ts | 4 ++-- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/services/llm/context/content_chunking.ts b/src/services/llm/context/content_chunking.ts index c083dac48..a9f032684 100644 --- a/src/services/llm/context/content_chunking.ts +++ b/src/services/llm/context/content_chunking.ts @@ -50,8 +50,8 @@ export interface ChunkOptions { * Default options for chunking */ async function getDefaultChunkOptions(): Promise> { - // Import constants dynamically to avoid circular dependencies - const { LLM_CONSTANTS } = await import('../../../routes/api/llm.js'); + // Import constants directly + const { LLM_CONSTANTS } = await import('../constants/provider_constants.js'); return { maxChunkSize: LLM_CONSTANTS.CHUNKING.DEFAULT_SIZE, diff --git a/src/services/llm/embeddings/chunking/chunking_processor.ts b/src/services/llm/embeddings/chunking/chunking_processor.ts index e1bbb5e10..0d16124bb 100644 --- a/src/services/llm/embeddings/chunking/chunking_processor.ts +++ b/src/services/llm/embeddings/chunking/chunking_processor.ts @@ -4,6 +4,7 @@ import sql from "../../../sql.js"; import becca from "../../../../becca/becca.js"; import cls from "../../../../services/cls.js"; import type { NoteEmbeddingContext } from "../types.js"; +import { LLM_CONSTANTS } from "../../../llm/constants/provider_constants.js"; // Remove static imports that cause circular dependencies // import { storeNoteEmbedding, deleteNoteEmbeddings } from "./storage.js"; @@ -120,8 +121,8 @@ export async function processNoteWithChunking( { // Adjust chunk size based on provider using constants maxChunkSize: provider.name === 'ollama' ? - (await import('../../../llm/constants/provider_constants.js')).LLM_CONSTANTS.CHUNKING.OLLAMA_SIZE : - (await import('../../../llm/constants/provider_constants.js')).LLM_CONSTANTS.CHUNKING.DEFAULT_SIZE, + LLM_CONSTANTS.CHUNKING.OLLAMA_SIZE : + LLM_CONSTANTS.CHUNKING.DEFAULT_SIZE, respectBoundaries: true } ); diff --git a/src/services/llm/embeddings/content_processing.ts b/src/services/llm/embeddings/content_processing.ts index 2730d07cf..63c0aa54b 100644 --- a/src/services/llm/embeddings/content_processing.ts +++ b/src/services/llm/embeddings/content_processing.ts @@ -37,8 +37,8 @@ export async function cleanNoteContent(content: string, type: string, mime: stri // Trim the content content = content.trim(); - // Import constants dynamically to avoid circular dependencies - const { LLM_CONSTANTS } = await import('../../../routes/api/llm.js'); + // Import constants directly + const { LLM_CONSTANTS } = await import('../constants/provider_constants.js'); // Truncate if extremely long if (content.length > LLM_CONSTANTS.CONTENT.MAX_TOTAL_CONTENT_LENGTH) { content = content.substring(0, LLM_CONSTANTS.CONTENT.MAX_TOTAL_CONTENT_LENGTH) + ' [content truncated]';