mirror of
https://github.com/TriliumNext/Notes.git
synced 2025-08-11 02:42:27 +08:00
fix chunking imports again
This commit is contained in:
parent
53c756be4f
commit
40bbdb2faa
@ -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,
|
||||||
|
@ -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
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
@ -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]';
|
||||||
|
Loading…
x
Reference in New Issue
Block a user