fix: add null guards for getChromaSync() when Chroma is disabled (#1336)
When CLAUDE_MEM_CHROMA_ENABLED=false, getChromaSync() returns null. Two call sites were missing null guards, causing "null is not an object" errors on every UserPromptSubmit / session init. Fixes #1294 Vibe-coded by Ousama Ben Younes Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -61,6 +61,9 @@ export class SearchManager {
|
|||||||
limit: number,
|
limit: number,
|
||||||
whereFilter?: Record<string, any>
|
whereFilter?: Record<string, any>
|
||||||
): Promise<{ ids: number[]; distances: number[]; metadatas: any[] }> {
|
): Promise<{ ids: number[]; distances: number[]; metadatas: any[] }> {
|
||||||
|
if (!this.chromaSync) {
|
||||||
|
return { ids: [], distances: [], metadatas: [] };
|
||||||
|
}
|
||||||
return await this.chromaSync.queryChroma(query, limit, whereFilter);
|
return await this.chromaSync.queryChroma(query, limit, whereFilter);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -356,7 +356,7 @@ export class SessionRoutes extends BaseRouteHandler {
|
|||||||
// Sync user prompt to Chroma
|
// Sync user prompt to Chroma
|
||||||
const chromaStart = Date.now();
|
const chromaStart = Date.now();
|
||||||
const promptText = latestPrompt.prompt_text;
|
const promptText = latestPrompt.prompt_text;
|
||||||
this.dbManager.getChromaSync().syncUserPrompt(
|
this.dbManager.getChromaSync()?.syncUserPrompt(
|
||||||
latestPrompt.id,
|
latestPrompt.id,
|
||||||
latestPrompt.memory_session_id,
|
latestPrompt.memory_session_id,
|
||||||
latestPrompt.project,
|
latestPrompt.project,
|
||||||
|
|||||||
Reference in New Issue
Block a user