Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ EMBEDDING_MODEL=text-embedding-3-small
# You can customize it according to the throughput of your embedding model. Generally, larger batch size means less indexing time.
EMBEDDING_BATCH_SIZE=100

# Maximum number of chunks to index before stopping (default: 450000)
# Set a lower value to limit indexing for very large codebases. Minimum value is 1000.
# CHUNK_LIMIT=450000

# =============================================================================
# OpenAI Configuration
# =============================================================================
Expand Down
3 changes: 2 additions & 1 deletion packages/core/src/context.ts
Original file line number Diff line number Diff line change
Expand Up @@ -702,8 +702,9 @@ export class Context {
): Promise<{ processedFiles: number; totalChunks: number; status: 'completed' | 'limit_reached' }> {
const isHybrid = this.getIsHybrid();
const EMBEDDING_BATCH_SIZE = Math.max(1, parseInt(envManager.get('EMBEDDING_BATCH_SIZE') || '100', 10));
const CHUNK_LIMIT = 450000;
const CHUNK_LIMIT = Math.max(1000, parseInt(envManager.get('CHUNK_LIMIT') || '450000', 10));
console.log(`[Context] 🔧 Using EMBEDDING_BATCH_SIZE: ${EMBEDDING_BATCH_SIZE}`);
console.log(`[Context] 🔧 Using CHUNK_LIMIT: ${CHUNK_LIMIT}`);

let chunkBuffer: Array<{ chunk: CodeChunk; codebasePath: string }> = [];
let processedFiles = 0;
Expand Down