fix chunking imports again

This commit is contained in:
perf3ct 2025-03-30 19:41:31 +00:00
parent 53c756be4f
commit 40bbdb2faa
No known key found for this signature in database
GPG Key ID: 569C4EEC436F5232
3 changed files with 7 additions and 6 deletions

View File

@ -50,8 +50,8 @@ export interface ChunkOptions {
* Default options for chunking * Default options for chunking
*/ */
async function getDefaultChunkOptions(): Promise<Required<ChunkOptions>> { async function getDefaultChunkOptions(): Promise<Required<ChunkOptions>> {
// Import constants dynamically to avoid circular dependencies // Import constants directly
const { LLM_CONSTANTS } = await import('../../../routes/api/llm.js'); const { LLM_CONSTANTS } = await import('../constants/provider_constants.js');
return { return {
maxChunkSize: LLM_CONSTANTS.CHUNKING.DEFAULT_SIZE, maxChunkSize: LLM_CONSTANTS.CHUNKING.DEFAULT_SIZE,

View File

@ -4,6 +4,7 @@ import sql from "../../../sql.js";
import becca from "../../../../becca/becca.js"; import becca from "../../../../becca/becca.js";
import cls from "../../../../services/cls.js"; import cls from "../../../../services/cls.js";
import type { NoteEmbeddingContext } from "../types.js"; import type { NoteEmbeddingContext } from "../types.js";
import { LLM_CONSTANTS } from "../../../llm/constants/provider_constants.js";
// Remove static imports that cause circular dependencies // Remove static imports that cause circular dependencies
// import { storeNoteEmbedding, deleteNoteEmbeddings } from "./storage.js"; // import { storeNoteEmbedding, deleteNoteEmbeddings } from "./storage.js";
@ -120,8 +121,8 @@ export async function processNoteWithChunking(
{ {
// Adjust chunk size based on provider using constants // Adjust chunk size based on provider using constants
maxChunkSize: provider.name === 'ollama' ? maxChunkSize: provider.name === 'ollama' ?
(await import('../../../llm/constants/provider_constants.js')).LLM_CONSTANTS.CHUNKING.OLLAMA_SIZE : LLM_CONSTANTS.CHUNKING.OLLAMA_SIZE :
(await import('../../../llm/constants/provider_constants.js')).LLM_CONSTANTS.CHUNKING.DEFAULT_SIZE, LLM_CONSTANTS.CHUNKING.DEFAULT_SIZE,
respectBoundaries: true respectBoundaries: true
} }
); );

View File

@ -37,8 +37,8 @@ export async function cleanNoteContent(content: string, type: string, mime: stri
// Trim the content // Trim the content
content = content.trim(); content = content.trim();
// Import constants dynamically to avoid circular dependencies // Import constants directly
const { LLM_CONSTANTS } = await import('../../../routes/api/llm.js'); const { LLM_CONSTANTS } = await import('../constants/provider_constants.js');
// Truncate if extremely long // Truncate if extremely long
if (content.length > LLM_CONSTANTS.CONTENT.MAX_TOTAL_CONTENT_LENGTH) { if (content.length > LLM_CONSTANTS.CONTENT.MAX_TOTAL_CONTENT_LENGTH) {
content = content.substring(0, LLM_CONSTANTS.CONTENT.MAX_TOTAL_CONTENT_LENGTH) + ' [content truncated]'; content = content.substring(0, LLM_CONSTANTS.CONTENT.MAX_TOTAL_CONTENT_LENGTH) + ' [content truncated]';