Skip to content

Commit 36a807e

Browse files
committed
Centralize ChromaDB Client Warning Suppression in ChromaManager #7555
1 parent 35078e2 commit 36a807e

3 files changed

Lines changed: 39 additions & 0 deletions

File tree

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
---
2+
title: "Centralize ChromaDB Client Warning Suppression in ChromaManager"
3+
labels: enhancement, AI
4+
---
5+
6+
GH ticket id: #7555
7+
8+
**Epic:** #7536
9+
**Phase:** 3
10+
**Assignee:** tobiu
11+
**Status:** Done
12+
13+
## Description
14+
15+
During the refactoring of the `knowledge-base` services, a piece of code that suppresses console warnings from the ChromaDB client was removed from the `HealthService`. This logic is a cross-cutting concern and should not live within an individual service.
16+
17+
This ticket covers moving the warning suppression logic into the `ChromaManager` for both the `knowledge-base` and `memory-core` servers. This will centralize the logic, remove code duplication, and ensure that all services using the manager benefit from cleaner console output.
18+
19+
## Acceptance Criteria
20+
21+
1. The `getKnowledgeBaseCollection()` method in `ai/mcp/server/knowledge-base/services/ChromaManager.mjs` is updated to wrap the `client.getOrCreateCollection()` call with the `console.warn` suppression logic.
22+
2. The `getMemoryCollection()` and `getSummaryCollection()` methods in `ai/mcp/server/memory-core/services/ChromaManager.mjs` are updated to wrap their respective `client.getCollection()` or `client.getOrCreateCollection()` calls with the `console.warn` suppression logic.
23+
3. The `HealthService` and any other service that previously contained this logic are confirmed to no longer have it.
24+
4. The functionality of all related services remains unchanged, but the console output is cleaner.

ai/mcp/server/knowledge-base/services/ChromaManager.mjs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,10 +90,15 @@ class ChromaManager extends Base {
9090
if (!this.knowledgeBaseCollection) {
9191
const {collectionName} = aiConfig.knowledgeBase;
9292

93+
const originalWarn = console.warn;
94+
console.warn = () => {}; // Suppress unwanted warnings from ChromaDB client
95+
9396
this.knowledgeBaseCollection = await this.client.getOrCreateCollection({
9497
name : collectionName,
9598
embeddingFunction: aiConfig.dummyEmbeddingFunction
9699
});
100+
101+
console.warn = originalWarn;
97102
}
98103

99104
return this.knowledgeBaseCollection;

ai/mcp/server/memory-core/services/ChromaManager.mjs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,10 +111,15 @@ class ChromaManager extends Base {
111111
if (!this.memoryCollection) {
112112
const {collectionName} = aiConfig.memory;
113113

114+
const originalWarn = console.warn;
115+
console.warn = () => {}; // Suppress unwanted warnings from ChromaDB client
116+
114117
this.memoryCollection = await this.client.getCollection({
115118
name : collectionName,
116119
embeddingFunction: aiConfig.dummyEmbeddingFunction
117120
});
121+
122+
console.warn = originalWarn;
118123
}
119124

120125
return this.memoryCollection;
@@ -127,10 +132,15 @@ class ChromaManager extends Base {
127132
if (!this.summaryCollection) {
128133
const {collectionName} = aiConfig.sessions;
129134

135+
const originalWarn = console.warn;
136+
console.warn = () => {}; // Suppress unwanted warnings from ChromaDB client
137+
130138
this.summaryCollection = await this.client.getOrCreateCollection({
131139
name : collectionName,
132140
embeddingFunction: aiConfig.dummyEmbeddingFunction
133141
});
142+
143+
console.warn = originalWarn;
134144
}
135145

136146
return this.summaryCollection;

0 commit comments

Comments
 (0)