Build your personal knowledge base with Trilium Notes
TypeScript electronelectron-appknowledge-baseknowledge-graphknowledge-managementknowledge-management-graphlocal-firstnote-managmentnote-takernote-takingnotebooknotesnotes-apppersonal-knowledge-basepersonal-wikiscriptableself-hostedself-hostingwiki
fix chunking imports again
perf3ct40bbdb2faae1
diff --git a/src/services/llm/context/content_chunking.ts b/src/services/llm/context/content_chunking.tsindex c083dac484..a9f032684f 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<Required<ChunkOptions>> {- // 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.tsindex e1bbb5e10e..0d16124bbd 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 constantsmaxChunkSize: 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.tsindex 2730d07cfd..63c0aa54b7 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 contentcontent = 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 longif (content.length > LLM_CONSTANTS.CONTENT.MAX_TOTAL_CONTENT_LENGTH) {content = content.substring(0, LLM_CONSTANTS.CONTENT.MAX_TOTAL_CONTENT_LENGTH) + ' [content truncated]';