Skip to content

Commit 14fbee6

Browse files
committed
refactor(indexer): consolidate embedding initialization to use config
Architectural fix: Symbol resolution now uses the same configuration path as main indexing instead of creating a separate EmbeddingGenerator with environment variables. Before: ai_resolve_symbol() called with_auto_from_env() - different init path After: ai_resolve_symbol() calls with_config(&self.global_config) - same as main indexing This ensures: 1. Single source of truth for embedding configuration 2. Consistent provider selection across all code paths 3. No duplicate initialization logic 4. Easier maintenance and testing The indexer already has access to global_config in the ProjectIndexer struct, so this is a simple one-line change that eliminates architectural inconsistency.
1 parent d5b8f13 commit 14fbee6

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

crates/codegraph-mcp/src/indexer.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1674,8 +1674,8 @@ impl ProjectIndexer {
16741674
use codegraph_vector::{search::SemanticSearch, EmbeddingGenerator};
16751675
use std::sync::Arc;
16761676

1677-
// Create a simple embedding for the target symbol
1678-
let embedder = EmbeddingGenerator::with_auto_from_env().await;
1677+
// Use same config as main indexing for consistency
1678+
let embedder = EmbeddingGenerator::with_config(&self.global_config).await;
16791679
if let Ok(target_embedding) = embedder.generate_text_embedding(target_symbol).await {
16801680
// Find the most similar symbol in our symbol map using cosine similarity
16811681
let mut best_match: Option<(NodeId, f32)> = None;

0 commit comments

Comments
 (0)