diff --git a/apps/server/src/services/llm/chat/utils/message_formatter.ts b/apps/server/src/services/llm/chat/utils/message_formatter.ts index 30ac9a7da..e7d80dda3 100644 --- a/apps/server/src/services/llm/chat/utils/message_formatter.ts +++ b/apps/server/src/services/llm/chat/utils/message_formatter.ts @@ -2,6 +2,7 @@ * Message formatting utilities for different LLM providers */ import type { Message } from "../../ai_interface.js"; +import { CONTEXT_PROMPTS } from "../../constants/llm_prompt_constants.js"; /** * Interface for message formatters @@ -111,9 +112,6 @@ export function buildContextFromNotes(sources: any[], query: string): string { return query || ''; } - // Import the CONTEXT_PROMPTS constant - const { CONTEXT_PROMPTS } = require('../../constants/llm_prompt_constants.js'); - // Use the template from the constants file, replacing placeholders return CONTEXT_PROMPTS.CONTEXT_NOTES_WRAPPER .replace('{noteContexts}', noteContexts) diff --git a/apps/server/src/services/llm/pipeline/stages/tool_calling_stage.ts b/apps/server/src/services/llm/pipeline/stages/tool_calling_stage.ts index bab29fdf1..a5a913f24 100644 --- a/apps/server/src/services/llm/pipeline/stages/tool_calling_stage.ts +++ b/apps/server/src/services/llm/pipeline/stages/tool_calling_stage.ts @@ -422,7 +422,7 @@ export class ToolCallingStage extends BasePipelineStage { - const aiServiceManager = require('../../../ai_service_manager.js').default; + const aiServiceManager = (await import('../../ai_service_manager.js')).default; try { log.info(`Getting dependency '${dependencyType}' for tool '${toolName}'`);