Skip to content

Build your personal knowledge base with Trilium Notes

fix(llm): remove the vectorSearch stage from the pipeline

perf3ctb0d804da08b0
diff --git a/apps/server/src/services/llm/pipeline/chat_pipeline.ts b/apps/server/src/services/llm/pipeline/chat_pipeline.ts
index 2dd2fc2936..60c5df87c0 100644
--- a/apps/server/src/services/llm/pipeline/chat_pipeline.ts
+++ b/apps/server/src/services/llm/pipeline/chat_pipeline.ts
@@ -210,7 +210,7 @@ export class ChatPipeline {
executionTime: Date.now() - vectorSearchStartTime
};
- this.updateStageMetrics('vectorSearch', vectorSearchStartTime);
+ // Skip metrics update for disabled vector search functionality
log.info(`Vector search disabled - using tool-based context extraction instead`);
// Extract context from search results
@@ -899,6 +899,12 @@ export class ChatPipeline {
const executionTime = Date.now() - startTime;
const metrics = this.metrics.stageMetrics[stageName];
+ // Guard against undefined metrics (e.g., for removed stages)
+ if (!metrics) {
+ log.info(`WARNING: Attempted to update metrics for unknown stage: ${stageName}`);
+ return;
+ }
+
metrics.totalExecutions++;
metrics.averageExecutionTime =
(metrics.averageExecutionTime * (metrics.totalExecutions - 1) + executionTime) /