From b0d804da08b00c3e077dc4869b90ad7485ee3507 Mon Sep 17 00:00:00 2001 From: perf3ct Date: Sat, 7 Jun 2025 18:57:08 +0000 Subject: [PATCH] fix(llm): remove the vectorSearch stage from the pipeline --- apps/server/src/services/llm/pipeline/chat_pipeline.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/apps/server/src/services/llm/pipeline/chat_pipeline.ts b/apps/server/src/services/llm/pipeline/chat_pipeline.ts index 2dd2fc293..60c5df87c 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) /